inline processDebugLoc and simplify it.
authorChris Lattner <sabre@nondot.org>
Sun, 4 Apr 2010 18:18:51 +0000 (18:18 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 4 Apr 2010 18:18:51 +0000 (18:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100339 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/AsmPrinter.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp

index 89917f28a66f8eadce055e8060666ef6dcd4a451..3ac229fe3880b5ebb40b4db26627bdc9b37c8a7d 100644 (file)
@@ -339,11 +339,7 @@ namespace llvm {
     /// EmitInlineAsm - Emit a blob of inline asm to the output streamer.
     void EmitInlineAsm(StringRef Str) const;
 
-    /// processDebugLoc - Processes the debug information of each machine
-    /// instruction's DebugLoc. 
-    void processDebugLoc(const MachineInstr *MI, bool BeforePrintingInsn);
-    
-    /// EmitInlineAsm - This method formats and emits the specified machine
+     /// EmitInlineAsm - This method formats and emits the specified machine
     /// instruction that is an inline asm.
     void EmitInlineAsm(const MachineInstr *MI) const;
 
index fe7db8e862b1f0f2a2e59bc4c6ab123bc633a4c2..2f80e80f4d261944cd496ea9b4e4ccf56d8a8d7a 100644 (file)
@@ -416,6 +416,9 @@ void AsmPrinter::EmitFunctionBody() {
   // Emit target-specific gunk before the function body.
   EmitFunctionBodyStart();
   
+  bool ShouldPrintDebugScopes =
+    DW && MAI->doesSupportDebugInformation() &&DW->ShouldEmitDwarfDebug();
+  
   // Print out code for the function.
   bool HasAnyRealCode = false;
   for (MachineFunction::const_iterator I = MF->begin(), E = MF->end();
@@ -430,8 +433,8 @@ void AsmPrinter::EmitFunctionBody() {
       
       ++EmittedInsts;
       
-      // FIXME: Clean up processDebugLoc.
-      processDebugLoc(II, true);
+      if (ShouldPrintDebugScopes)
+        DW->BeginScope(II);
       
       if (VerboseAsm)
         EmitComments(*II, OutStreamer.GetCommentOS());
@@ -456,8 +459,8 @@ void AsmPrinter::EmitFunctionBody() {
         break;
       }
       
-      // FIXME: Clean up processDebugLoc.
-      processDebugLoc(II, false);
+      if (ShouldPrintDebugScopes)
+        DW->EndScope(II);
     }
   }
   
@@ -1376,21 +1379,6 @@ void AsmPrinter::PrintSpecial(const MachineInstr *MI, raw_ostream &OS,
   }    
 }
 
-/// processDebugLoc - Processes the debug information of each machine
-/// instruction's DebugLoc.
-void AsmPrinter::processDebugLoc(const MachineInstr *MI, 
-                                 bool BeforePrintingInsn) {
-  if (!DW || !MAI->doesSupportDebugInformation() || !DW->ShouldEmitDwarfDebug())
-    return;
-
-  if (!BeforePrintingInsn)
-    // After printing instruction
-    DW->EndScope(MI);
-  else
-    DW->BeginScope(MI);
-}
-
-
 /// EmitInlineAsm - This method formats and emits the specified machine
 /// instruction that is an inline asm.
 void AsmPrinter::EmitInlineAsm(const MachineInstr *MI) const {