remove the raw_ostream from various dwarf printing things.
authorChris Lattner <sabre@nondot.org>
Sun, 4 Apr 2010 07:48:20 +0000 (07:48 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 4 Apr 2010 07:48:20 +0000 (07:48 +0000)
The only thing left is LEB printing, which uses EmitRawText
for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100325 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/DwarfWriter.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.h
lib/CodeGen/AsmPrinter/DwarfException.cpp
lib/CodeGen/AsmPrinter/DwarfException.h
lib/CodeGen/AsmPrinter/DwarfPrinter.cpp
lib/CodeGen/AsmPrinter/DwarfPrinter.h
lib/CodeGen/AsmPrinter/DwarfWriter.cpp

index 494400ee2c985f7d1af6cbc94b95a455dfd38ac1..89874f8920509809a22e669030de3d3c907b5d06 100644 (file)
@@ -68,8 +68,7 @@ public:
   
   /// BeginModule - Emit all Dwarf sections that should come prior to the
   /// content.
-  void BeginModule(Module *M, MachineModuleInfo *MMI, raw_ostream &OS,
-                   AsmPrinter *A, const MCAsmInfo *T);
+  void BeginModule(Module *M, AsmPrinter *A);
   
   /// EndModule - Emit all Dwarf sections that should come after the content.
   ///
index 3252a42cc934ee4ad1658d18d282eabbd0651491..dea96bd479f3e19c8d8a1b6192f7cfc7fdcf2fd3 100644 (file)
@@ -137,7 +137,7 @@ bool AsmPrinter::doInitialization(Module &M) {
 
   DW = getAnalysisIfAvailable<DwarfWriter>();
   if (DW)
-    DW->BeginModule(&M, MMI, O, this, MAI);
+    DW->BeginModule(&M, this);
 
   return false;
 }
index 9084456c8f4d346e13afaefe2ef6378a06168feb..07b35e2ba387064dc33c837f6af3795ff8394061 100644 (file)
@@ -298,8 +298,8 @@ DbgScope::~DbgScope() {
 
 } // end llvm namespace
 
-DwarfDebug::DwarfDebug(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T)
-  : DwarfPrinter(OS, A, T), ModuleCU(0),
+DwarfDebug::DwarfDebug(AsmPrinter *A)
+  : DwarfPrinter(A), ModuleCU(0),
     AbbreviationsSet(InitAbbreviationsSetSize), Abbreviations(),
     DIEBlocks(), SectionSourceLines(), didInitial(false), shouldEmit(false),
     CurrentFnDbgScope(0), DebugTimer(0) {
@@ -1780,7 +1780,7 @@ void DwarfDebug::constructSubprogramDIE(MDNode *N) {
 /// beginModule - Emit all Dwarf sections that should come prior to the
 /// content. Create global DIEs and emit initial debug info sections.
 /// This is inovked by the target AsmPrinter.
-void DwarfDebug::beginModule(Module *M, MachineModuleInfo *mmi) {
+void DwarfDebug::beginModule(Module *M) {
   this->M = M;
 
   if (!MAI->doesSupportDebugInformation())
@@ -1809,7 +1809,7 @@ void DwarfDebug::beginModule(Module *M, MachineModuleInfo *mmi) {
          E = DbgFinder.global_variable_end(); I != E; ++I)
     constructGlobalVariableDIE(*I);
 
-  MMI = mmi;
+  MMI = Asm->MMI;
   shouldEmit = true;
   MMI->setDebugInfoAvailability(true);
 
index 03d9d9935f2f033ecd49c8819b8e6b64b5d8c9e9..5dabd8e48a36df7feb2f3275a93e1f45094b38c3 100644 (file)
@@ -487,8 +487,8 @@ class DwarfDebug : public DwarfPrinter {
 
   /// GetOrCreateSourceID - Look up the source id with the given directory and
   /// source file names. If none currently exists, create a new id and insert it
-  /// in the SourceIds map. This can update DirectoryNames and SourceFileNames maps
-  /// as well.
+  /// in the SourceIds map. This can update DirectoryNames and SourceFileNames
+  /// maps as well.
   unsigned GetOrCreateSourceID(StringRef DirName, StringRef FileName);
 
   void constructCompileUnit(MDNode *N);
@@ -507,7 +507,7 @@ public:
   //===--------------------------------------------------------------------===//
   // Main entry points.
   //
-  DwarfDebug(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T);
+  DwarfDebug(AsmPrinter *A);
   virtual ~DwarfDebug();
 
   /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
@@ -516,7 +516,7 @@ public:
 
   /// beginModule - Emit all Dwarf sections that should come prior to the
   /// content.
-  void beginModule(Module *M, MachineModuleInfo *MMI);
+  void beginModule(Module *M);
 
   /// endModule - Emit all Dwarf sections that should come after the content.
   ///
index 8b616b012614d2d952e6ddae9bcf135025c747ee..bf89cd6da18a08357a70d7cdbee1dcf8ec2a05c1 100644 (file)
@@ -37,9 +37,8 @@
 #include "llvm/ADT/Twine.h"
 using namespace llvm;
 
-DwarfException::DwarfException(raw_ostream &OS, AsmPrinter *A,
-                               const MCAsmInfo *T)
-  : DwarfPrinter(OS, A, T), shouldEmitTable(false),shouldEmitMoves(false),
+DwarfException::DwarfException(AsmPrinter *A)
+  : DwarfPrinter(A), shouldEmitTable(false), shouldEmitMoves(false),
     shouldEmitTableModule(false), shouldEmitMovesModule(false),
     ExceptionTimer(0) {
   if (TimePassesIsEnabled)
index 4bc4a458c04e191cfcc800035fb089b229f216e7..85bf581990573a0083be1347425a5588b5415235 100644 (file)
@@ -166,14 +166,14 @@ public:
   //===--------------------------------------------------------------------===//
   // Main entry points.
   //
-  DwarfException(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T);
+  DwarfException(AsmPrinter *A);
   virtual ~DwarfException();
 
   /// BeginModule - Emit all exception information that should come prior to the
   /// content.
-  void BeginModule(Module *m, MachineModuleInfo *mmi) {
+  void BeginModule(Module *m) {
     this->M = m;
-    this->MMI = mmi;
+    this->MMI = Asm->MMI;
   }
 
   /// EndModule - Emit all exception information that should come after the
index 9de17883420bbc8fa361c58f6ddf1379adfcf30e..4106c7ae75afe35a95a862ce86edfa45856a3422 100644 (file)
@@ -31,8 +31,8 @@
 #include "llvm/ADT/SmallString.h"
 using namespace llvm;
 
-DwarfPrinter::DwarfPrinter(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T)
-: O(OS), Asm(A), MAI(T), TD(Asm->TM.getTargetData()),
+DwarfPrinter::DwarfPrinter(AsmPrinter *A)
+: Asm(A), MAI(A->MAI), TD(Asm->TM.getTargetData()),
   RI(Asm->TM.getRegisterInfo()), M(NULL), MF(NULL), MMI(NULL),
   SubprogramCount(0) {}
 
@@ -139,8 +139,7 @@ void DwarfPrinter::EmitSLEB128(int Value, const char *Desc) const {
     
   if (MAI->hasLEB128()) {
     // FIXME: MCize.
-    O << "\t.sleb128\t" << Value;
-    Asm->OutStreamer.AddBlankLine();
+    Asm->OutStreamer.EmitRawText("\t.sleb128\t" + Twine(Value));
     return;
   }
 
@@ -165,8 +164,7 @@ void DwarfPrinter::EmitULEB128(unsigned Value, const char *Desc,
  
   if (MAI->hasLEB128() && PadTo == 0) {
     // FIXME: MCize.
-    O << "\t.uleb128\t" << Value;
-    Asm->OutStreamer.AddBlankLine();
+    Asm->OutStreamer.EmitRawText("\t.uleb128\t" + Twine(Value));
     return;
   }
   
index 0b94645a8c7b335e69fa42f3147ca85da438f5fa..04355e0f86fdc25774a8efe943ee1ea996c6af92 100644 (file)
@@ -39,9 +39,6 @@ protected:
   // Core attributes used by the DWARF printer.
   //
 
-  /// O - Stream to .s file.
-  raw_ostream &O;
-
   /// Asm - Target of Dwarf emission.
   AsmPrinter *Asm;
 
@@ -66,7 +63,7 @@ protected:
   /// SubprogramCount - The running count of functions being compiled.
   unsigned SubprogramCount;
 
-  DwarfPrinter(raw_ostream &OS, AsmPrinter *A, const MCAsmInfo *T);
+  DwarfPrinter(AsmPrinter *A);
 public:
   
   //===------------------------------------------------------------------===//
index a2d7ab1224ee5e34240724278ab9a44995b3d213..7aa928170cc34560c1184e0c017b68fb4f67d1da 100644 (file)
@@ -36,14 +36,11 @@ DwarfWriter::~DwarfWriter() {
 
 /// BeginModule - Emit all Dwarf sections that should come prior to the
 /// content.
-void DwarfWriter::BeginModule(Module *M,
-                              MachineModuleInfo *MMI,
-                              raw_ostream &OS, AsmPrinter *A,
-                              const MCAsmInfo *T) {
-  DE = new DwarfException(OS, A, T);
-  DD = new DwarfDebug(OS, A, T);
-  DE->BeginModule(M, MMI);
-  DD->beginModule(M, MMI);
+void DwarfWriter::BeginModule(Module *M, AsmPrinter *A) {
+  DE = new DwarfException(A);
+  DD = new DwarfDebug(A);
+  DE->BeginModule(M);
+  DD->beginModule(M);
 }
 
 /// EndModule - Emit all Dwarf sections that should come after the content.