Propagate debug loc info through prologue/epilogue.
[oota-llvm.git] / lib / CodeGen / SelectionDAG / SelectionDAGPrinter.cpp
index 03b78c33efb4c25988ad9440626cb21ee0bf68cd..004cb247b1fecad38b2666e8f548d76f6f28b132 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
+#include "ScheduleDAGSDNodes.h"
 #include "llvm/Constants.h"
 #include "llvm/Function.h"
 #include "llvm/Assembly/Writer.h"
 #include "llvm/CodeGen/SelectionDAG.h"
-#include "llvm/CodeGen/ScheduleDAGSDNodes.h"
 #include "llvm/CodeGen/MachineConstantPool.h"
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
 #include "llvm/CodeGen/PseudoSourceValue.h"
+#include "llvm/Analysis/DebugInfo.h"
 #include "llvm/Target/TargetRegisterInfo.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Support/Debug.h"
@@ -177,7 +178,8 @@ std::string DOTGraphTraits<SelectionDAG*>::getNodeLabel(const SDNode *Node,
       Op += " #" + utostr(R->getReg());
     }
   } else if (const DbgStopPointSDNode *D = dyn_cast<DbgStopPointSDNode>(Node)) {
-    Op += ": " + D->getCompileUnit()->getFileName();
+    DICompileUnit CU(cast<GlobalVariable>(D->getCompileUnit()));
+    Op += ": " + CU.getFilename();
     Op += ":" + utostr(D->getLine());
     if (D->getColumn() != 0)
       Op += ":" + utostr(D->getColumn());
@@ -202,12 +204,10 @@ std::string DOTGraphTraits<SelectionDAG*>::getNodeLabel(const SDNode *Node,
     Op += '<';
     if (!V) {
       Op += "(unknown)";
-    } else if (isa<PseudoSourceValue>(V)) {
+    } else if (const PseudoSourceValue *PSV = dyn_cast<PseudoSourceValue>(V)) {
       // PseudoSourceValues don't have names, so use their print method.
-      {
-        raw_string_ostream OSS(Op);
-        OSS << *M->MO.getValue();
-      }
+      raw_string_ostream OSS(Op);
+      PSV->print(OSS);
     } else {
       Op += V->getName();
     }