summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-22 23:47:11 +0000
committerChris Lattner <sabre@nondot.org>2010-01-22 23:47:11 +0000
commitfaca5497a26672669934abbcf23894ce93408c10 (patch)
tree5c88b9f68bfa749cc6ff3cbb89f1f0d78c69a74f /lib
parentf537ce17522df35b9879e1d178ab963c41dab825 (diff)
downloadllvm-faca5497a26672669934abbcf23894ce93408c10.tar.gz
llvm-faca5497a26672669934abbcf23894ce93408c10.tar.bz2
llvm-faca5497a26672669934abbcf23894ce93408c10.tar.xz
move "EOL" from asmprinter to dwarfprinter. It should eventually
be completely eliminated, but today is not that day. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94253 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp10
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp176
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfException.cpp33
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfPrinter.cpp10
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfPrinter.h5
5 files changed, 117 insertions, 117 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index d8f89034e5..fcab4aa5e9 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -659,16 +659,6 @@ void AsmPrinter::EmitXXStructorList(Constant *List) {
// Emission and print routines
//
-/// EOL - Print a newline character to asm stream. If a comment is present
-/// then it will be printed first. Comments should not contain '\n'.
-void AsmPrinter::EOL(const Twine &Comment) const {
- if (VerboseAsm && !Comment.isTriviallyEmpty()) {
- O.PadToColumn(MAI->getCommentColumn());
- O << MAI->getCommentString() << ' ' << Comment;
- }
- O << '\n';
-}
-
/// EmitInt8 - Emit a byte directive and value.
///
void AsmPrinter::EmitInt8(int Value) const {
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 86f6adee18..cc2ff8c571 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2383,7 +2383,7 @@ void DwarfDebug::emitDIE(DIE *Die) {
break;
}
- Asm->EOL(dwarf::AttributeString(Attr));
+ EOL(dwarf::AttributeString(Attr));
}
// Emit the DIE children if any.
@@ -2393,7 +2393,7 @@ void DwarfDebug::emitDIE(DIE *Die) {
for (unsigned j = 0, M = Children.size(); j < M; ++j)
emitDIE(Children[j]);
- Asm->EmitInt8(0); Asm->EOL("End Of Children Mark");
+ Asm->EmitInt8(0); EOL("End Of Children Mark");
}
}
@@ -2415,18 +2415,18 @@ void DwarfDebug::emitDebugInfo() {
sizeof(int8_t) + // Pointer Size (in bytes)
sizeof(int32_t); // FIXME - extra pad for gdb bug.
- Asm->EmitInt32(ContentSize); Asm->EOL("Length of Compilation Unit Info");
- Asm->EmitInt16(dwarf::DWARF_VERSION); Asm->EOL("DWARF version number");
+ Asm->EmitInt32(ContentSize); EOL("Length of Compilation Unit Info");
+ Asm->EmitInt16(dwarf::DWARF_VERSION); EOL("DWARF version number");
EmitSectionOffset("abbrev_begin", "section_abbrev", 0, 0, true, false);
- Asm->EOL("Offset Into Abbrev. Section");
- Asm->EmitInt8(TD->getPointerSize()); Asm->EOL("Address Size (in bytes)");
+ EOL("Offset Into Abbrev. Section");
+ Asm->EmitInt8(TD->getPointerSize()); EOL("Address Size (in bytes)");
emitDIE(Die);
// FIXME - extra padding for gdb bug.
- Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB");
- Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB");
- Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB");
- Asm->EmitInt8(0); Asm->EOL("Extra Pad For GDB");
+ Asm->EmitInt8(0); EOL("Extra Pad For GDB");
+ Asm->EmitInt8(0); EOL("Extra Pad For GDB");
+ Asm->EmitInt8(0); EOL("Extra Pad For GDB");
+ Asm->EmitInt8(0); EOL("Extra Pad For GDB");
EmitLabel("info_end", ModuleCU->getID());
Asm->O << '\n';
}
@@ -2468,13 +2468,13 @@ void DwarfDebug::emitAbbreviations() const {
///
void DwarfDebug::emitEndOfLineMatrix(unsigned SectionEnd) {
// Define last address of section.
- Asm->EmitInt8(0); Asm->EOL("Extended Op");
- Asm->EmitInt8(TD->getPointerSize() + 1); Asm->EOL("Op size");
- Asm->EmitInt8(dwarf::DW_LNE_set_address); Asm->EOL("DW_LNE_set_address");
- EmitReference("section_end", SectionEnd); Asm->EOL("Section end label");
+ Asm->EmitInt8(0); EOL("Extended Op");
+ Asm->EmitInt8(TD->getPointerSize() + 1); EOL("Op size");
+ Asm->EmitInt8(dwarf::DW_LNE_set_address); EOL("DW_LNE_set_address");
+ EmitReference("section_end", SectionEnd); EOL("Section end label");
// Mark end of matrix.
- Asm->EmitInt8(0); Asm->EOL("DW_LNE_end_sequence");
+ Asm->EmitInt8(0); EOL("DW_LNE_end_sequence");
Asm->EmitInt8(1);
Asm->EmitInt8(1);
}
@@ -2498,56 +2498,52 @@ void DwarfDebug::emitDebugLines() {
// Construct the section header.
EmitDifference("line_end", 0, "line_begin", 0, true);
- Asm->EOL("Length of Source Line Info");
+ EOL("Length of Source Line Info");
EmitLabel("line_begin", 0);
- Asm->EmitInt16(dwarf::DWARF_VERSION); Asm->EOL("DWARF version number");
+ Asm->EmitInt16(dwarf::DWARF_VERSION); EOL("DWARF version number");
EmitDifference("line_prolog_end", 0, "line_prolog_begin", 0, true);
- Asm->EOL("Prolog Length");
+ EOL("Prolog Length");
EmitLabel("line_prolog_begin", 0);
- Asm->EmitInt8(1); Asm->EOL("Minimum Instruction Length");
-
- Asm->EmitInt8(1); Asm->EOL("Default is_stmt_start flag");
-
- Asm->EmitInt8(MinLineDelta); Asm->EOL("Line Base Value (Special Opcodes)");
-
- Asm->EmitInt8(MaxLineDelta); Asm->EOL("Line Range Value (Special Opcodes)");
-
- Asm->EmitInt8(-MinLineDelta); Asm->EOL("Special Opcode Base");
+ Asm->EmitInt8(1); EOL("Minimum Instruction Length");
+ Asm->EmitInt8(1); EOL("Default is_stmt_start flag");
+ Asm->EmitInt8(MinLineDelta); EOL("Line Base Value (Special Opcodes)");
+ Asm->EmitInt8(MaxLineDelta); EOL("Line Range Value (Special Opcodes)");
+ Asm->EmitInt8(-MinLineDelta); EOL("Special Opcode Base");
// Line number standard opcode encodings argument count
- Asm->EmitInt8(0); Asm->EOL("DW_LNS_copy arg count");
- Asm->EmitInt8(1); Asm->EOL("DW_LNS_advance_pc arg count");
- Asm->EmitInt8(1); Asm->EOL("DW_LNS_advance_line arg count");
- Asm->EmitInt8(1); Asm->EOL("DW_LNS_set_file arg count");
- Asm->EmitInt8(1); Asm->EOL("DW_LNS_set_column arg count");
- Asm->EmitInt8(0); Asm->EOL("DW_LNS_negate_stmt arg count");
- Asm->EmitInt8(0); Asm->EOL("DW_LNS_set_basic_block arg count");
- Asm->EmitInt8(0); Asm->EOL("DW_LNS_const_add_pc arg count");
- Asm->EmitInt8(1); Asm->EOL("DW_LNS_fixed_advance_pc arg count");
+ Asm->EmitInt8(0); EOL("DW_LNS_copy arg count");
+ Asm->EmitInt8(1); EOL("DW_LNS_advance_pc arg count");
+ Asm->EmitInt8(1); EOL("DW_LNS_advance_line arg count");
+ Asm->EmitInt8(1); EOL("DW_LNS_set_file arg count");
+ Asm->EmitInt8(1); EOL("DW_LNS_set_column arg count");
+ Asm->EmitInt8(0); EOL("DW_LNS_negate_stmt arg count");
+ Asm->EmitInt8(0); EOL("DW_LNS_set_basic_block arg count");
+ Asm->EmitInt8(0); EOL("DW_LNS_const_add_pc arg count");
+ Asm->EmitInt8(1); EOL("DW_LNS_fixed_advance_pc arg count");
// Emit directories.
for (unsigned DI = 1, DE = getNumSourceDirectories()+1; DI != DE; ++DI) {
Asm->EmitString(getSourceDirectoryName(DI));
- Asm->EOL("Directory");
+ EOL("Directory");
}
- Asm->EmitInt8(0); Asm->EOL("End of directories");
+ Asm->EmitInt8(0); EOL("End of directories");
// Emit files.
for (unsigned SI = 1, SE = getNumSourceIds()+1; SI != SE; ++SI) {
// Remember source id starts at 1.
std::pair<unsigned, unsigned> Id = getSourceDirectoryAndFileIds(SI);
Asm->EmitString(getSourceFileName(Id.second));
- Asm->EOL("Source");
+ EOL("Source");
EmitULEB128(Id.first, "Directory #");
EmitULEB128(0, "Mod date");
EmitULEB128(0, "File size");
}
- Asm->EmitInt8(0); Asm->EOL("End of files");
+ Asm->EmitInt8(0); EOL("End of files");
EmitLabel("line_prolog_end", 0);
@@ -2589,15 +2585,15 @@ void DwarfDebug::emitDebugLines() {
}
// Define the line address.
- Asm->EmitInt8(0); Asm->EOL("Extended Op");
- Asm->EmitInt8(TD->getPointerSize() + 1); Asm->EOL("Op size");
- Asm->EmitInt8(dwarf::DW_LNE_set_address); Asm->EOL("DW_LNE_set_address");
- EmitReference("label", LabelID); Asm->EOL("Location label");
+ Asm->EmitInt8(0); EOL("Extended Op");
+ Asm->EmitInt8(TD->getPointerSize() + 1); EOL("Op size");
+ Asm->EmitInt8(dwarf::DW_LNE_set_address); EOL("DW_LNE_set_address");
+ EmitReference("label", LabelID); EOL("Location label");
// If change of source, then switch to the new source.
if (Source != LineInfo.getSourceID()) {
Source = LineInfo.getSourceID();
- Asm->EmitInt8(dwarf::DW_LNS_set_file); Asm->EOL("DW_LNS_set_file");
+ Asm->EmitInt8(dwarf::DW_LNS_set_file); EOL("DW_LNS_set_file");
EmitULEB128(Source, "New Source");
}
@@ -2613,17 +2609,17 @@ void DwarfDebug::emitDebugLines() {
// If delta is small enough and in range...
if (Delta >= 0 && Delta < (MaxLineDelta - 1)) {
// ... then use fast opcode.
- Asm->EmitInt8(Delta - MinLineDelta); Asm->EOL("Line Delta");
+ Asm->EmitInt8(Delta - MinLineDelta); EOL("Line Delta");
} else {
// ... otherwise use long hand.
Asm->EmitInt8(dwarf::DW_LNS_advance_line);
- Asm->EOL("DW_LNS_advance_line");
+ EOL("DW_LNS_advance_line");
EmitSLEB128(Offset, "Line Offset");
- Asm->EmitInt8(dwarf::DW_LNS_copy); Asm->EOL("DW_LNS_copy");
+ Asm->EmitInt8(dwarf::DW_LNS_copy); EOL("DW_LNS_copy");
}
} else {
// Copy the previous row (different address or source)
- Asm->EmitInt8(dwarf::DW_LNS_copy); Asm->EOL("DW_LNS_copy");
+ Asm->EmitInt8(dwarf::DW_LNS_copy); EOL("DW_LNS_copy");
}
}
@@ -2658,19 +2654,19 @@ void DwarfDebug::emitCommonDebugFrame() {
EmitLabel("debug_frame_common", 0);
EmitDifference("debug_frame_common_end", 0,
"debug_frame_common_begin", 0, true);
- Asm->EOL("Length of Common Information Entry");
+ EOL("Length of Common Information Entry");
EmitLabel("debug_frame_common_begin", 0);
Asm->EmitInt32((int)dwarf::DW_CIE_ID);
- Asm->EOL("CIE Identifier Tag");
+ EOL("CIE Identifier Tag");
Asm->EmitInt8(dwarf::DW_CIE_VERSION);
- Asm->EOL("CIE Version");
+ EOL("CIE Version");
Asm->EmitString("");
- Asm->EOL("CIE Augmentation");
+ EOL("CIE Augmentation");
EmitULEB128(1, "CIE Code Alignment Factor");
EmitSLEB128(stackGrowth, "CIE Data Alignment Factor");
Asm->EmitInt8(RI->getDwarfRegNum(RI->getRARegister(), false));
- Asm->EOL("CIE RA Column");
+ EOL("CIE RA Column");
std::vector<MachineMove> Moves;
RI->getInitialFrameState(Moves);
@@ -2695,19 +2691,19 @@ DwarfDebug::emitFunctionDebugFrame(const FunctionDebugFrameInfo&DebugFrameInfo){
EmitDifference("debug_frame_end", DebugFrameInfo.Number,
"debug_frame_begin", DebugFrameInfo.Number, true);
- Asm->EOL("Length of Frame Information Entry");
+ EOL("Length of Frame Information Entry");
EmitLabel("debug_frame_begin", DebugFrameInfo.Number);
EmitSectionOffset("debug_frame_common", "section_debug_frame",
0, 0, true, false);
- Asm->EOL("FDE CIE offset");
+ EOL("FDE CIE offset");
EmitReference("func_begin", DebugFrameInfo.Number);
- Asm->EOL("FDE initial location");
+ EOL("FDE initial location");
EmitDifference("func_end", DebugFrameInfo.Number,
"func_begin", DebugFrameInfo.Number);
- Asm->EOL("FDE address range");
+ EOL("FDE address range");
EmitFrameMoves("func_begin", DebugFrameInfo.Number, DebugFrameInfo.Moves,
false);
@@ -2726,19 +2722,19 @@ void DwarfDebug::emitDebugPubNames() {
EmitDifference("pubnames_end", ModuleCU->getID(),
"pubnames_begin", ModuleCU->getID(), true);
- Asm->EOL("Length of Public Names Info");
+ EOL("Length of Public Names Info");
EmitLabel("pubnames_begin", ModuleCU->getID());
- Asm->EmitInt16(dwarf::DWARF_VERSION); Asm->EOL("DWARF Version");
+ Asm->EmitInt16(dwarf::DWARF_VERSION); EOL("DWARF Version");
EmitSectionOffset("info_begin", "section_info",
ModuleCU->getID(), 0, true, false);
- Asm->EOL("Offset of Compilation Unit Info");
+ EOL("Offset of Compilation Unit Info");
EmitDifference("info_end", ModuleCU->getID(), "info_begin", ModuleCU->getID(),
true);
- Asm->EOL("Compilation Unit Length");
+ EOL("Compilation Unit Length");
const StringMap<DIE*> &Globals = ModuleCU->getGlobals();
for (StringMap<DIE*>::const_iterator
@@ -2746,11 +2742,11 @@ void DwarfDebug::emitDebugPubNames() {
const char *Name = GI->getKeyData();
DIE * Entity = GI->second;
- Asm->EmitInt32(Entity->getOffset()); Asm->EOL("DIE offset");
- Asm->EmitString(Name, strlen(Name)); Asm->EOL("External Name");
+ Asm->EmitInt32(Entity->getOffset()); EOL("DIE offset");
+ Asm->EmitString(Name, strlen(Name)); EOL("External Name");
}
- Asm->EmitInt32(0); Asm->EOL("End Mark");
+ Asm->EmitInt32(0); EOL("End Mark");
EmitLabel("pubnames_end", ModuleCU->getID());
Asm->O << '\n';
}
@@ -2761,19 +2757,19 @@ void DwarfDebug::emitDebugPubTypes() {
Asm->getObjFileLowering().getDwarfPubTypesSection());
EmitDifference("pubtypes_end", ModuleCU->getID(),
"pubtypes_begin", ModuleCU->getID(), true);
- Asm->EOL("Length of Public Types Info");
+ EOL("Length of Public Types Info");
EmitLabel("pubtypes_begin", ModuleCU->getID());
- Asm->EmitInt16(dwarf::DWARF_VERSION); Asm->EOL("DWARF Version");
+ Asm->EmitInt16(dwarf::DWARF_VERSION); EOL("DWARF Version");
EmitSectionOffset("info_begin", "section_info",
ModuleCU->getID(), 0, true, false);
- Asm->EOL("Offset of Compilation ModuleCU Info");
+ EOL("Offset of Compilation ModuleCU Info");
EmitDifference("info_end", ModuleCU->getID(), "info_begin", ModuleCU->getID(),
true);
- Asm->EOL("Compilation ModuleCU Length");
+ EOL("Compilation ModuleCU Length");
const StringMap<DIE*> &Globals = ModuleCU->getGlobalTypes();
for (StringMap<DIE*>::const_iterator
@@ -2781,11 +2777,11 @@ void DwarfDebug::emitDebugPubTypes() {
const char *Name = GI->getKeyData();
DIE * Entity = GI->second;
- Asm->EmitInt32(Entity->getOffset()); Asm->EOL("DIE offset");
- Asm->EmitString(Name, strlen(Name)); Asm->EOL("External Name");
+ Asm->EmitInt32(Entity->getOffset()); EOL("DIE offset");
+ Asm->EmitString(Name, strlen(Name)); EOL("External Name");
}
- Asm->EmitInt32(0); Asm->EOL("End Mark");
+ Asm->EmitInt32(0); EOL("End Mark");
EmitLabel("pubtypes_end", ModuleCU->getID());
Asm->O << '\n';
}
@@ -2835,26 +2831,26 @@ void DwarfDebug::EmitDebugARanges() {
CompileUnit *Unit = GetBaseCompileUnit();
// Don't include size of length
- Asm->EmitInt32(0x1c); Asm->EOL("Length of Address Ranges Info");
+ Asm->EmitInt32(0x1c); EOL("Length of Address Ranges Info");
- Asm->EmitInt16(dwarf::DWARF_VERSION); Asm->EOL("Dwarf Version");
+ Asm->EmitInt16(dwarf::DWARF_VERSION); EOL("Dwarf Version");
EmitReference("info_begin", Unit->getID());
- Asm->EOL("Offset of Compilation Unit Info");
+ EOL("Offset of Compilation Unit Info");
- Asm->EmitInt8(TD->getPointerSize()); Asm->EOL("Size of Address");
+ Asm->EmitInt8(TD->getPointerSize()); EOL("Size of Address");
- Asm->EmitInt8(0); Asm->EOL("Size of Segment Descriptor");
+ Asm->EmitInt8(0); EOL("Size of Segment Descriptor");
- Asm->EmitInt16(0); Asm->EOL("Pad (1)");
- Asm->EmitInt16(0); Asm->EOL("Pad (2)");
+ Asm->EmitInt16(0); EOL("Pad (1)");
+ Asm->EmitInt16(0); EOL("Pad (2)");
// Range 1
- EmitReference("text_begin", 0); Asm->EOL("Address");
- EmitDifference("text_end", 0, "text_begin", 0, true); Asm->EOL("Length");
+ EmitReference("text_begin", 0); EOL("Address");
+ EmitDifference("text_end", 0, "text_begin", 0, true); EOL("Length");
- Asm->EmitInt32(0); Asm->EOL("EOM (1)");
- Asm->EmitInt32(0); Asm->EOL("EOM (2)");
+ Asm->EmitInt32(0); EOL("EOM (1)");
+ Asm->EmitInt32(0); EOL("EOM (2)");
#endif
}
@@ -2906,12 +2902,12 @@ void DwarfDebug::emitDebugInlineInfo() {
EmitDifference("debug_inlined_end", 1,
"debug_inlined_begin", 1, true);
- Asm->EOL("Length of Debug Inlined Information Entry");
+ EOL("Length of Debug Inlined Information Entry");
EmitLabel("debug_inlined_begin", 1);
- Asm->EmitInt16(dwarf::DWARF_VERSION); Asm->EOL("Dwarf Version");
- Asm->EmitInt8(TD->getPointerSize()); Asm->EOL("Address Size (in bytes)");
+ Asm->EmitInt16(dwarf::DWARF_VERSION); EOL("Dwarf Version");
+ Asm->EmitInt8(TD->getPointerSize()); EOL("Address Size (in bytes)");
for (SmallVector<MDNode *, 4>::iterator I = InlinedSPNodes.begin(),
E = InlinedSPNodes.end(); I != E; ++I) {
@@ -2930,23 +2926,23 @@ void DwarfDebug::emitDebugInlineInfo() {
EmitSectionOffset("string", "section_str",
StringPool.idFor(getRealLinkageName(LName)), false, true);
- Asm->EOL("MIPS linkage name");
+ EOL("MIPS linkage name");
EmitSectionOffset("string", "section_str",
StringPool.idFor(Name), false, true);
- Asm->EOL("Function name");
+ EOL("Function name");
EmitULEB128(Labels.size(), "Inline count");
for (SmallVector<InlineInfoLabels, 4>::iterator LI = Labels.begin(),
LE = Labels.end(); LI != LE; ++LI) {
DIE *SP = LI->second;
- Asm->EmitInt32(SP->getOffset()); Asm->EOL("DIE offset");
+ Asm->EmitInt32(SP->getOffset()); EOL("DIE offset");
if (TD->getPointerSize() == sizeof(int32_t))
O << MAI->getData32bitsDirective();
else
O << MAI->getData64bitsDirective();
- PrintLabelName("label", LI->first); Asm->EOL("low_pc");
+ PrintLabelName("label", LI->first); EOL("low_pc");
}
}
diff --git a/lib/CodeGen/AsmPrinter/DwarfException.cpp b/lib/CodeGen/AsmPrinter/DwarfException.cpp
index d1ad4d88f1..3cb9d3b511 100644
--- a/lib/CodeGen/AsmPrinter/DwarfException.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfException.cpp
@@ -115,7 +115,7 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
// Define the eh frame length.
EmitDifference("eh_frame_common_end", Index,
"eh_frame_common_begin", Index, true);
- Asm->EOL("Length of Common Information Entry");
+ EOL("Length of Common Information Entry");
// EH frame header.
EmitLabel("eh_frame_common_begin", Index);
@@ -172,13 +172,13 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
Augmentation[0] = 'z';
Asm->EmitString(Augmentation);
- Asm->EOL("CIE Augmentation");
+ EOL("CIE Augmentation");
// Round out reader.
EmitULEB128(1, "CIE Code Alignment Factor");
EmitSLEB128(stackGrowth, "CIE Data Alignment Factor");
Asm->EmitInt8(RI->getDwarfRegNum(RI->getRARegister(), true));
- Asm->EOL("CIE Return Address Column");
+ EOL("CIE Return Address Column");
EmitULEB128(AugmentationSize, "Augmentation Size");
EmitEncodingByte(PerEncoding, "Personality");
@@ -190,7 +190,7 @@ void DwarfException::EmitCIE(const Function *PersonalityFn, unsigned Index) {
Index);
O << MAI->getData32bitsDirective() << *PersonalityRef;
- Asm->EOL("Personality");
+ EOL("Personality");
EmitEncodingByte(LSDAEncoding, "LSDA");
EmitEncodingByte(FDEEncoding, "FDE");
@@ -253,7 +253,7 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
// EH frame header.
EmitDifference("eh_frame_end", EHFrameInfo.Number,
"eh_frame_begin", EHFrameInfo.Number, true);
- Asm->EOL("Length of Frame Information Entry");
+ EOL("Length of Frame Information Entry");
EmitLabel("eh_frame_begin", EHFrameInfo.Number);
@@ -261,13 +261,13 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
EHFrameInfo.Number, EHFrameInfo.PersonalityIndex,
true, true, false);
- Asm->EOL("FDE CIE offset");
+ EOL("FDE CIE offset");
EmitReference("eh_func_begin", EHFrameInfo.Number, true, true);
- Asm->EOL("FDE initial location");
+ EOL("FDE initial location");
EmitDifference("eh_func_end", EHFrameInfo.Number,
"eh_func_begin", EHFrameInfo.Number, true);
- Asm->EOL("FDE address range");
+ EOL("FDE address range");
// If there is a personality and landing pads then point to the language
// specific data area in the exception table.
@@ -291,7 +291,7 @@ void DwarfException::EmitFDE(const FunctionEHFrameInfo &EHFrameInfo) {
}
}
- Asm->EOL("Language Specific Data Area");
+ EOL("Language Specific Data Area");
} else {
EmitULEB128(0, "Augmentation size");
}
@@ -760,7 +760,7 @@ void DwarfException::EmitExceptionTable() {
for (unsigned i = 0; i != SizeAlign; ++i) {
Asm->EmitInt8(0);
- Asm->EOL("Padding");
+ EOL("Padding");
}
EmitLabel("exception", SubprogramCount);
@@ -844,7 +844,7 @@ void DwarfException::EmitExceptionTable() {
// the start of the procedure fragment.
EmitSectionOffset(BeginTag, "eh_func_begin", BeginNumber, SubprogramCount,
true, true);
- Asm->EOL("Region start");
+ EOL("Region start");
if (!S.EndLabel)
EmitDifference("eh_func_end", SubprogramCount, BeginTag, BeginNumber,
@@ -852,7 +852,7 @@ void DwarfException::EmitExceptionTable() {
else
EmitDifference("label", S.EndLabel, BeginTag, BeginNumber, true);
- Asm->EOL("Region length");
+ EOL("Region length");
// Offset of the landing pad, counted in 16-byte bundles relative to the
// @LPStart address.
@@ -862,7 +862,7 @@ void DwarfException::EmitExceptionTable() {
EmitSectionOffset("label", "eh_func_begin", S.PadLabel, SubprogramCount,
true, true);
- Asm->EOL("Landing pad");
+ EOL("Landing pad");
// Offset of the first associated action record, relative to the start of
// the action table. This value is biased by 1 (1 indicates the start of
@@ -895,13 +895,12 @@ void DwarfException::EmitExceptionTable() {
const GlobalVariable *GV = *I;
PrintRelDirective();
- if (GV) {
+ if (GV)
O << *Asm->GetGlobalValueSymbol(GV);
- } else {
+ else
O << "0x0";
- }
- Asm->EOL("TypeInfo");
+ EOL("TypeInfo");
}
// Emit the Exception Specifications.
diff --git a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
index 77a60e70b9..d204bba7e9 100644
--- a/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
@@ -42,6 +42,16 @@ void DwarfPrinter::PrintRelDirective(bool Force32Bit, bool isInSection) const {
O << MAI->getData64bitsDirective();
}
+/// EOL - Print a newline character to asm stream. If a comment is present
+/// then it will be printed first. Comments should not contain '\n'.
+void DwarfPrinter::EOL(const Twine &Comment) const {
+ if (Asm->VerboseAsm && !Comment.isTriviallyEmpty()) {
+ Asm->O.PadToColumn(MAI->getCommentColumn());
+ Asm->O << Asm->MAI->getCommentString() << ' ' << Comment;
+ }
+ Asm->O << '\n';
+}
+
static const char *DecodeDWARFEncoding(unsigned Encoding) {
switch (Encoding) {
case dwarf::DW_EH_PE_absptr: return "absptr";
diff --git a/lib/CodeGen/AsmPrinter/DwarfPrinter.h b/lib/CodeGen/AsmPrinter/DwarfPrinter.h
index 2549692dd7..86fe2abc88 100644
--- a/lib/CodeGen/AsmPrinter/DwarfPrinter.h
+++ b/lib/CodeGen/AsmPrinter/DwarfPrinter.h
@@ -29,6 +29,7 @@ class MCAsmInfo;
class TargetData;
class TargetRegisterInfo;
class MCSymbol;
+class Twine;
class DwarfPrinter {
protected:
@@ -85,6 +86,10 @@ public:
void PrintRelDirective(bool Force32Bit = false,
bool isInSection = false) const;
+ /// EOL - Print a newline character to asm stream. If a comment is present
+ /// then it will be printed first. Comments should not contain '\n'.
+ void EOL(const Twine &Comment) const;
+
/// EmitEncodingByte - Emit a .byte 42 directive that corresponds to an
/// encoding. If verbose assembly output is enabled, we output comments
/// describing the encoding. Desc is a string saying what the encoding is