Commit a353f453 authored by Milad Farazmand's avatar Milad Farazmand Committed by Commit Bot

PPC: adding torque debug info for AIX on PPC

Due to ppc having a fixed 4 byte instruction length, changing
ByteChunk length from 8 to 4 bytes will fix any padding issues
while generating the "embed.S" file.

Change-Id: Ide799908effd88d5387e97627917b095fcc3051c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1524720
Commit-Queue: Milad Farazmand <miladfar@ca.ibm.com>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60337}
parent 7e5e9e7f
......@@ -300,7 +300,9 @@ void PlatformDependentEmbeddedFileWriter::DeclareLabel(const char* name) {
fprintf(fp_, "_%s:\n", name);
}
void PlatformDependentEmbeddedFileWriter::SourceInfo(int fileid, int line) {
void PlatformDependentEmbeddedFileWriter::SourceInfo(int fileid,
const char* filename,
int line) {
fprintf(fp_, ".loc %d %d\n", fileid, line);
}
......@@ -390,8 +392,10 @@ void PlatformDependentEmbeddedFileWriter::DeclareLabel(const char* name) {
fprintf(fp_, "%s:\n", name);
}
void PlatformDependentEmbeddedFileWriter::SourceInfo(int fileid, int line) {
fprintf(fp_, ".loc %d %d\n", fileid, line);
void PlatformDependentEmbeddedFileWriter::SourceInfo(int fileid,
const char* filename,
int line) {
fprintf(fp_, ".xline %d, \"%s\"\n", line, filename);
}
void PlatformDependentEmbeddedFileWriter::DeclareFunctionBegin(
......@@ -416,7 +420,9 @@ void PlatformDependentEmbeddedFileWriter::FilePrologue() {}
void PlatformDependentEmbeddedFileWriter::DeclareExternalFilename(
int fileid, const char* filename) {
fprintf(fp_, ".file %d \"%s\"\n", fileid, filename);
// File name cannot be declared with an identifier on AIX.
// We use the SourceInfo method to emit debug info in
//.xline <line-number> <file-name> format.
}
void PlatformDependentEmbeddedFileWriter::FileEpilogue() {}
......@@ -520,7 +526,9 @@ void PlatformDependentEmbeddedFileWriter::DeclareLabel(const char* name) {
DirectiveAsString(kByte));
}
void PlatformDependentEmbeddedFileWriter::SourceInfo(int fileid, int line) {
void PlatformDependentEmbeddedFileWriter::SourceInfo(int fileid,
const char* filename,
int line) {
// TODO(mvstanton): output source information for MSVC.
// Its syntax is #line <line> "<filename>"
}
......@@ -626,7 +634,9 @@ void PlatformDependentEmbeddedFileWriter::DeclareLabel(const char* name) {
fprintf(fp_, "%s%s\n", SYMBOL_PREFIX, name);
}
void PlatformDependentEmbeddedFileWriter::SourceInfo(int fileid, int line) {
void PlatformDependentEmbeddedFileWriter::SourceInfo(int fileid,
const char* filename,
int line) {
// TODO(mvstanton): output source information for MSVC.
// Its syntax is #line <line> "<filename>"
}
......@@ -759,7 +769,9 @@ void PlatformDependentEmbeddedFileWriter::DeclareLabel(const char* name) {
fprintf(fp_, "%s%s:\n", SYMBOL_PREFIX, name);
}
void PlatformDependentEmbeddedFileWriter::SourceInfo(int fileid, int line) {
void PlatformDependentEmbeddedFileWriter::SourceInfo(int fileid,
const char* filename,
int line) {
fprintf(fp_, ".loc %d %d\n", fileid, line);
}
......
......@@ -59,7 +59,7 @@ class PlatformDependentEmbeddedFileWriter final {
void DeclareLabel(const char* name);
void SourceInfo(int fileid, int line);
void SourceInfo(int fileid, const char* filename, int line);
void DeclareFunctionBegin(const char* name);
void DeclareFunctionEnd(const char* name);
......@@ -268,6 +268,8 @@ class EmbeddedFileWriter : public EmbeddedFileWriterInterface {
if (i == next_offset) {
// Write source directive.
w->SourceInfo(positions.source_position().ExternalFileId(),
GetExternallyCompiledFilename(
positions.source_position().ExternalFileId()),
positions.source_position().ExternalLine());
positions.Advance();
next_offset = static_cast<uint32_t>(
......@@ -339,16 +341,13 @@ class EmbeddedFileWriter : public EmbeddedFileWriterInterface {
#define V8_COMPILER_IS_MSVC
#endif
#if defined(V8_COMPILER_IS_MSVC) || defined(V8_OS_AIX)
#if defined(V8_COMPILER_IS_MSVC)
// Windows MASM doesn't have an .octa directive, use QWORDs instead.
// Note: MASM *really* does not like large data streams. It takes over 5
// minutes to assemble the ~350K lines of embedded.S produced when using
// BYTE directives in a debug build. QWORD produces roughly 120KLOC and
// reduces assembly time to ~40 seconds. Still terrible, but much better
// than before. See also: https://crbug.com/v8/8475.
// GCC MASM on Aix doesn't have an .octa directive, use .llong instead.
static constexpr DataDirective kByteChunkDirective = kQuad;
static constexpr int kByteChunkSize = 8;
......@@ -357,6 +356,19 @@ class EmbeddedFileWriter : public EmbeddedFileWriterInterface {
const uint64_t* quad_ptr = reinterpret_cast<const uint64_t*>(data);
return current_line_length + w->HexLiteral(*quad_ptr);
}
#elif defined(V8_OS_AIX)
// PPC uses a fixed 4 byte instruction set, using .long
// to prevent any unnecessary padding.
static constexpr DataDirective kByteChunkDirective = kLong;
static constexpr int kByteChunkSize = 4;
static int WriteByteChunk(PlatformDependentEmbeddedFileWriter* w,
int current_line_length, const uint8_t* data) {
const uint32_t* long_ptr = reinterpret_cast<const uint32_t*>(data);
return current_line_length + w->HexLiteral(*long_ptr);
}
#else // defined(V8_COMPILER_IS_MSVC) || defined(V8_OS_AIX)
static constexpr DataDirective kByteChunkDirective = kOcta;
static constexpr int kByteChunkSize = 16;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment