Add an accessor method to DwarfWriter to tell of debugging info should be emitted.
authorBill Wendling <isanbard@gmail.com>
Fri, 20 Feb 2009 00:44:43 +0000 (00:44 +0000)
committerBill Wendling <isanbard@gmail.com>
Fri, 20 Feb 2009 00:44:43 +0000 (00:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65092 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/DwarfWriter.h
lib/CodeGen/AsmPrinter/DwarfWriter.cpp
utils/TableGen/AsmWriterEmitter.cpp

index 58a2fa742373a5456620921456357ef203492d1d..dc844e1fbf057bda2bc4e4dd889308549cc6f225 100644 (file)
@@ -101,6 +101,9 @@ public:
   ///
   void RecordVariable(GlobalVariable *GV, unsigned FrameIndex);
 
+  /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
+  /// be emitted.
+  bool ShouldEmitDwarfDebug() const;
 };
 
 
index 6a29121acc845bdff1d1ef0ac350daa91eb47d0a..356f5a89c010fe53d1401a4bf578fde6073e6d54 100644 (file)
@@ -1331,9 +1331,10 @@ class DwarfDebug : public Dwarf {
 
 public:
 
-  /// ShouldEmitDwarf - Returns true if Dwarf declarations should be made.
+  /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
+  /// be emitted.
   ///
-  bool ShouldEmitDwarf() const { return shouldEmit; }
+  bool ShouldEmitDwarfDebug() const { return shouldEmit; }
 
   /// AssignAbbrevNumber - Define a unique number for the abbreviation.
   ///
@@ -2963,7 +2964,7 @@ public:
   /// EndModule - Emit all Dwarf sections that should come after the content.
   ///
   void EndModule() {
-    if (!ShouldEmitDwarf()) return;
+    if (!ShouldEmitDwarfDebug()) return;
 
     // Standard sections final addresses.
     Asm->SwitchToSection(TAI->getTextSection());
@@ -3021,7 +3022,7 @@ public:
   void BeginFunction(MachineFunction *MF) {
     this->MF = MF;
 
-    if (!ShouldEmitDwarf()) return;
+    if (!ShouldEmitDwarfDebug()) return;
 
     // Begin accumulating function debug information.
     MMI->BeginFunction(MF);
@@ -3040,7 +3041,7 @@ public:
   /// EndFunction - Gather and emit post-function debug information.
   ///
   void EndFunction(MachineFunction *MF) {
-    if (!ShouldEmitDwarf()) return;
+    if (!ShouldEmitDwarfDebug()) return;
 
     // Define end label for subprogram.
     EmitLabel("func_end", SubprogramCount);
@@ -4329,3 +4330,8 @@ void DwarfWriter::RecordVariable(GlobalVariable *GV, unsigned FrameIndex) {
   DD->RecordVariable(GV, FrameIndex);
 }
 
+/// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should
+/// be emitted.
+bool DwarfWriter::ShouldEmitDwarfDebug() const {
+  return DD->ShouldEmitDwarfDebug();
+}
index 4f810c1303c37aa7d95fa81f65a2f821e7ec873e..4736cca77bd28810bf1f4541498e0cb1446a433b 100644 (file)
@@ -640,7 +640,8 @@ void AsmWriterEmitter::run(std::ostream &O) {
   }
   O << "\";\n\n";
 
-  O << "  if (TAI->doesSupportDebugInformation()) {\n"
+  O << "  if (TAI->doesSupportDebugInformation() &&\n"
+    << "      DW->ShouldEmitDwarfDebug()) {\n"
     << "    const MachineFunction *MF = MI->getParent()->getParent();\n"
     << "    DebugLoc CurDL = MI->getDebugLoc();\n\n"
     << "    if (!CurDL.isUnknown()) {\n"