Don't lump the filename and working dir together
authorChris Lattner <sabre@nondot.org>
Tue, 13 Dec 2005 17:40:33 +0000 (17:40 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 13 Dec 2005 17:40:33 +0000 (17:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24697 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index 2807abef7c9a0fc2a9b7bed71a1fc9e3592e26a5..20335fbaa47ce26c33c873acf8af0a27e5c79be1 100644 (file)
@@ -895,23 +895,13 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
                             getValue(I.getOperand(2))));
     return 0;
     
-  case Intrinsic::dbg_stoppoint:
-    {
+  case Intrinsic::dbg_stoppoint: {
     if (TLI.getTargetMachine().getIntrinsicLowering().EmitDebugFunctions())
       return "llvm_debugger_stop";
     
     std::string fname = "<unknown>";
     std::vector<SDOperand> Ops;
 
-    // Pull the filename out of the the compilation unit.
-    const GlobalVariable *cunit = dyn_cast<GlobalVariable>(I.getOperand(4));
-    if (cunit && cunit->hasInitializer()) {
-      ConstantStruct *CS = dyn_cast<ConstantStruct>(cunit->getInitializer());
-      if (CS->getNumOperands() > 0) {
-          std::string dirname = getStringValue(CS->getOperand(4));
-          fname = dirname + "/" + getStringValue(CS->getOperand(3));
-        }
-      }
     // Input Chain
     Ops.push_back(getRoot());
     
@@ -921,10 +911,21 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
     // column
     Ops.push_back(getValue(I.getOperand(3)));
 
-    // filename
-    Ops.push_back(DAG.getString(fname));
-    Ops.push_back(DAG.getString(""));
-    DAG.setRoot(DAG.getNode(ISD::LOCATION, MVT::Other, Ops));
+    // filename/working dir
+    // Pull the filename out of the the compilation unit.
+    const GlobalVariable *cunit = dyn_cast<GlobalVariable>(I.getOperand(4));
+    if (cunit && cunit->hasInitializer()) {
+      if (ConstantStruct *CS = 
+            dyn_cast<ConstantStruct>(cunit->getInitializer())) {
+        if (CS->getNumOperands() > 0) {
+          Ops.push_back(DAG.getString(getStringValue(CS->getOperand(4))));
+          Ops.push_back(DAG.getString(getStringValue(CS->getOperand(3))));
+        }
+      }
+    }
+    
+    if (Ops.size() == 5)  // Found filename/workingdir.
+      DAG.setRoot(DAG.getNode(ISD::LOCATION, MVT::Other, Ops));
     setValue(&I, DAG.getNode(ISD::UNDEF, TLI.getValueType(I.getType())));
     return 0;
   }