[llvm-commits] [llvm] r94253 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/CodeGen/AsmPrinter/DwarfException.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.cpp lib/CodeGen/AsmPrinter/DwarfPrinter.h

Chris Lattner sabre at nondot.org
Fri Jan 22 15:47:11 PST 2010


Author: lattner
Date: Fri Jan 22 17:47:11 2010
New Revision: 94253

URL: http://llvm.org/viewvc/llvm-project?rev=94253&view=rev
Log:
move "EOL" from asmprinter to dwarfprinter.  It should eventually
be completely eliminated, but today is not that day.

Modified:
    llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h

Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=94253&r1=94252&r2=94253&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Fri Jan 22 17:47:11 2010
@@ -249,10 +249,6 @@
     // 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 EOL(const Twine &Comment) const;
-
     /// EmitInt8 - Emit a byte directive and value.
     ///
     void EmitInt8(int Value) const;

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=94253&r1=94252&r2=94253&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Fri Jan 22 17:47:11 2010
@@ -659,16 +659,6 @@
 // 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 {

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=94253&r1=94252&r2=94253&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Jan 22 17:47:11 2010
@@ -2383,7 +2383,7 @@
       break;
     }
 
-    Asm->EOL(dwarf::AttributeString(Attr));
+    EOL(dwarf::AttributeString(Attr));
   }
 
   // Emit the DIE children if any.
@@ -2393,7 +2393,7 @@
     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 @@
     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::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 @@
 
   // 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 @@
       }
 
       // 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 @@
         // 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 @@
   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 @@
 
   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 @@
 
   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 @@
     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 @@
                           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 @@
     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 @@
   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 @@
 
   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 @@
       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");
     }
   }
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp?rev=94253&r1=94252&r2=94253&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfException.cpp Fri Jan 22 17:47:11 2010
@@ -115,7 +115,7 @@
   // 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 @@
     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 @@
                                        Index);
 
     O << MAI->getData32bitsDirective() << *PersonalityRef;
-    Asm->EOL("Personality");
+    EOL("Personality");
 
     EmitEncodingByte(LSDAEncoding, "LSDA");
     EmitEncodingByte(FDEEncoding, "FDE");
@@ -253,7 +253,7 @@
     // 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 @@
                       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 @@
         }
       }
 
-      Asm->EOL("Language Specific Data Area");
+      EOL("Language Specific Data Area");
     } else {
       EmitULEB128(0, "Augmentation size");
     }
@@ -760,7 +760,7 @@
 
   for (unsigned i = 0; i != SizeAlign; ++i) {
     Asm->EmitInt8(0);
-    Asm->EOL("Padding");
+    EOL("Padding");
   }
 
   EmitLabel("exception", SubprogramCount);
@@ -844,7 +844,7 @@
       // 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 @@
       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 @@
         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 @@
     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.

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp?rev=94253&r1=94252&r2=94253&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp Fri Jan 22 17:47:11 2010
@@ -42,6 +42,16 @@
     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";

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h?rev=94253&r1=94252&r2=94253&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfPrinter.h Fri Jan 22 17:47:11 2010
@@ -29,6 +29,7 @@
 class TargetData;
 class TargetRegisterInfo;
 class MCSymbol;
+class Twine;
 
 class DwarfPrinter {
 protected:
@@ -85,6 +86,10 @@
   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





More information about the llvm-commits mailing list