[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp SelectionDAG.cpp SelectionDAGISel.cpp

Jim Laskey jlaskey at apple.com
Fri Dec 16 14:45:43 PST 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.228 -> 1.229
SelectionDAG.cpp updated: 1.224 -> 1.225
SelectionDAGISel.cpp updated: 1.116 -> 1.117
---
Log message:

Added source file/line correspondence for dwarf (PowerPC only at this point.)


---
Diffs of the changes:  (+36 -4)

 LegalizeDAG.cpp      |   37 ++++++++++++++++++++++++++++++++++---
 SelectionDAG.cpp     |    1 +
 SelectionDAGISel.cpp |    2 +-
 3 files changed, 36 insertions(+), 4 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.228 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.229
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.228	Mon Dec 12 21:03:23 2005
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Fri Dec 16 16:45:28 2005
@@ -611,9 +611,18 @@
     switch (TLI.getOperationAction(ISD::LOCATION, MVT::Other)) {
     case TargetLowering::Promote:
     default: assert(0 && "This action is not supported yet!");
-    case TargetLowering::Expand:
-      // If the target doesn't support line numbers, ignore this node.
-      Result = Tmp1;
+    case TargetLowering::Expand: {
+        MachineDebugInfo &DebugInfo = DAG.getMachineFunction().getDebugInfo();
+        std::vector<SDOperand> Ops;
+        Ops.push_back(Tmp1);  // chain
+        Ops.push_back(Node->getOperand(1));  // line #
+        Ops.push_back(Node->getOperand(2));  // col #
+        const std::string &fname = cast<StringSDNode>(Node->getOperand(3))->getValue();
+        const std::string &dirname=cast<StringSDNode>(Node->getOperand(4))->getValue();
+        unsigned id = DebugInfo.RecordSource(fname, dirname);
+        Ops.push_back(DAG.getConstant(id, MVT::i32));  // source file id
+        Result = DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Ops);
+      }
       break;
     case TargetLowering::Legal:
       if (Tmp1 != Node->getOperand(0) ||
@@ -635,6 +644,28 @@
       break;
     }
     break;
+    
+  case ISD::DEBUG_LOC:
+    assert(Node->getNumOperands() == 4 && "Invalid DEBUG_LOC node!");
+    switch (TLI.getOperationAction(ISD::DEBUG_LOC, MVT::Other)) {
+    case TargetLowering::Promote:
+    case TargetLowering::Expand:
+    default: assert(0 && "This action is not supported yet!");
+    case TargetLowering::Legal:
+      Tmp1 = LegalizeOp(Node->getOperand(0));  // Legalize the chain.
+      Tmp2 = LegalizeOp(Node->getOperand(1));  // Legalize the line #.
+      Tmp3 = LegalizeOp(Node->getOperand(2));  // Legalize the col #.
+      Tmp4 = LegalizeOp(Node->getOperand(3));  // Legalize the source file id.
+      
+      if (Tmp1 != Node->getOperand(0) ||
+          Tmp2 != Node->getOperand(1) ||
+          Tmp3 != Node->getOperand(2) ||
+          Tmp4 != Node->getOperand(3)) {
+        Result = DAG.getNode(ISD::DEBUG_LOC,MVT::Other, Tmp1, Tmp2, Tmp3, Tmp4);
+      }
+      break;
+    }
+    break;    
 
   case ISD::Constant:
     // We know we don't need to expand constants here, constants only have one


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.224 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.225
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.224	Fri Dec  9 18:37:58 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Fri Dec 16 16:45:28 2005
@@ -1961,6 +1961,7 @@
 
   // Debug info
   case ISD::LOCATION: return "location";
+  case ISD::DEBUG_LOC: return "debug_loc";
 
   case ISD::CONDCODE:
     switch (cast<CondCodeSDNode>(this)->get()) {


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.116 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.117
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.116	Tue Dec 13 11:40:33 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Fri Dec 16 16:45:28 2005
@@ -918,8 +918,8 @@
       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))));
+          Ops.push_back(DAG.getString(getStringValue(CS->getOperand(4))));
         }
       }
     }






More information about the llvm-commits mailing list