Make DBG_STOPPOINT nodes, and therefore DBG_LABEL labels, get a DebugLoc, so that it
authorChris Lattner <sabre@nondot.org>
Mon, 4 May 2009 22:10:05 +0000 (22:10 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 4 May 2009 22:10:05 +0000 (22:10 +0000)
shows up in -print-machineinstrs.  This doesn't appear to affect anything, but it was
weird for some DBG_LABELs to have DebugLocs but not all of them.

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

include/llvm/CodeGen/SelectionDAG.h
lib/CodeGen/SelectionDAG/SelectionDAG.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp

index 74aa8ff8203defe39ce5c2ecc31016b739215641..35b5cd6b7dd496463dce1acc2ecbc911209f21b4 100644 (file)
@@ -302,8 +302,8 @@ public:
   SDValue getArgFlags(ISD::ArgFlagsTy Flags);
   SDValue getValueType(MVT);
   SDValue getRegister(unsigned Reg, MVT VT);
-  SDValue getDbgStopPoint(SDValue Root, unsigned Line, unsigned Col,
-                          Value *CU);
+  SDValue getDbgStopPoint(DebugLoc DL, SDValue Root, 
+                          unsigned Line, unsigned Col, Value *CU);
   SDValue getLabel(unsigned Opcode, DebugLoc dl, SDValue Root,
                    unsigned LabelID);
 
index b33b4691245801189da07b78836c50f3ac1bdb02..0b27ccf549aa194ed29881e23ab4639781570143 100644 (file)
@@ -1273,11 +1273,12 @@ SDValue SelectionDAG::getRegister(unsigned RegNo, MVT VT) {
   return SDValue(N, 0);
 }
 
-SDValue SelectionDAG::getDbgStopPoint(SDValue Root,
+SDValue SelectionDAG::getDbgStopPoint(DebugLoc DL, SDValue Root,
                                       unsigned Line, unsigned Col,
                                       Value *CU) {
   SDNode *N = NodeAllocator.Allocate<DbgStopPointSDNode>();
   new (N) DbgStopPointSDNode(Root, Line, Col, CU);
+  N->setDebugLoc(DL);
   AllNodes.push_back(N);
   return SDValue(N, 0);
 }
index fc45bbda22b40d5067f25975f19071e92382a487..a91dd8e7156bc2d93ddd4864465ba763914a8cbe 100644 (file)
@@ -3889,15 +3889,16 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
     DbgStopPointInst &SPI = cast<DbgStopPointInst>(I);
     if (DIDescriptor::ValidDebugInfo(SPI.getContext(), OptLevel)) {
       MachineFunction &MF = DAG.getMachineFunction();
+      DICompileUnit CU(cast<GlobalVariable>(SPI.getContext()));
+      DebugLoc Loc = DebugLoc::get(MF.getOrCreateDebugLocID(CU.getGV(),
+                                              SPI.getLine(), SPI.getColumn()));
+      setCurDebugLoc(Loc);
+      
       if (OptLevel == CodeGenOpt::None)
-        DAG.setRoot(DAG.getDbgStopPoint(getRoot(),
+        DAG.setRoot(DAG.getDbgStopPoint(Loc, getRoot(),
                                         SPI.getLine(),
                                         SPI.getColumn(),
                                         SPI.getContext()));
-      DICompileUnit CU(cast<GlobalVariable>(SPI.getContext()));
-      unsigned idx = MF.getOrCreateDebugLocID(CU.getGV(),
-                                              SPI.getLine(), SPI.getColumn());
-      setCurDebugLoc(DebugLoc::get(idx));
     }
     return 0;
   }