Use dwarf writer to decide whether the module has debug info or not.
authorDevang Patel <dpatel@apple.com>
Tue, 13 Jan 2009 21:25:00 +0000 (21:25 +0000)
committerDevang Patel <dpatel@apple.com>
Tue, 13 Jan 2009 21:25:00 +0000 (21:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62184 91177308-0d34-0410-b5e6-96231b3b80d8

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

index c2ad3a6483652012196f60f23c1b4e3b0811727b..24b0f97dfcebe5c43db9dfe292fb0af0c6fbd8f9 100644 (file)
@@ -93,6 +93,9 @@ public:
   /// getRecordSourceLineCount - Count source lines.
   unsigned getRecordSourceLineCount();
 
+  /// hasDebugInfo - Return true if debug info intrinsics are seen in 
+  /// this module.
+  bool hasDebugInfo();
 };
 
 
index 88c96baea88054150cf0c694c35ee722c386f2ad..d79e6aa77831cb3c5fabcb20728a7ee099eaa213 100644 (file)
@@ -4984,3 +4984,9 @@ unsigned DwarfWriter::RecordRegionEnd(GlobalVariable *V) {
 unsigned DwarfWriter::getRecordSourceLineCount() {
   return DD->getRecordSourceLineCount();
 }
+
+/// hasDebugInfo - Return true if debug info intrinsics are seen in 
+/// this module.
+bool DwarfWriter::hasDebugInfo() {
+  return DD && DD->ShouldEmitDwarf();
+}
index 324b07025e041e552ac3aead9e1d7d9c1786c104..65a3e07b044137640b520c113a31d879abe9a10c 100644 (file)
@@ -23,6 +23,7 @@
 #include "llvm/CodeGen/MachineConstantPool.h"
 #include "llvm/CodeGen/MachineFrameInfo.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
+#include "llvm/CodeGen/DwarfWriter.h"
 #include "llvm/CodeGen/PseudoSourceValue.h"
 #include "llvm/Target/TargetRegisterInfo.h"
 #include "llvm/Target/TargetData.h"
@@ -2040,8 +2041,8 @@ bool SelectionDAG::isVerifiedDebugInfoDesc(SDValue Op) const {
   if (GA->getOffset() != 0) return false;
   GlobalVariable *GV = dyn_cast<GlobalVariable>(GA->getGlobal());
   if (!GV) return false;
-  MachineModuleInfo *MMI = getMachineModuleInfo();
-  return MMI && MMI->hasDebugInfo() && MMI->isVerified(GV);
+  DwarfWriter *DW = getDwarfWriter();
+  return DW && DW->hasDebugInfo();
 }