Emit debug into for data-only files for Linux PPC.
authorDale Johannesen <dalej@apple.com>
Wed, 9 Jul 2008 21:24:07 +0000 (21:24 +0000)
committerDale Johannesen <dalej@apple.com>
Wed, 9 Jul 2008 21:24:07 +0000 (21:24 +0000)
I cannot test this target, let me know if it breaks!

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

lib/Target/PowerPC/PPCAsmPrinter.cpp

index 98b4b4a560dc25c4ea0d2befaee66ff9682a6d67..b7b2a95149539dd8678947c50cf8ac51e40af3b6 100644 (file)
@@ -293,10 +293,11 @@ namespace {
   struct VISIBILITY_HIDDEN LinuxAsmPrinter : public PPCAsmPrinter {
 
     DwarfWriter DW;
+    MachineModuleInfo *MMI;
 
     LinuxAsmPrinter(std::ostream &O, PPCTargetMachine &TM,
                     const TargetAsmInfo *T)
-      : PPCAsmPrinter(O, TM, T), DW(O, this, T) {
+      : PPCAsmPrinter(O, TM, T), DW(O, this, T), MMI(0) {
     }
 
     virtual const char *getPassName() const {
@@ -631,13 +632,19 @@ bool LinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
 bool LinuxAsmPrinter::doInitialization(Module &M) {
   bool Result = AsmPrinter::doInitialization(M);
   
+  // Emit initial debug information.
+  DW.BeginModule(&M);
+
+  // AsmPrinter::doInitialization should have done this analysis.
+  MMI = getAnalysisToUpdate<MachineModuleInfo>();
+  assert(MMI);
+  DW.SetModuleInfo(MMI);
+
   // GNU as handles section names wrapped in quotes
   Mang->setUseQuotes(true);
 
   SwitchToTextSection(TAI->getTextSection());
   
-  // Emit initial debug information.
-  DW.BeginModule(&M);
   return Result;
 }