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

Jim Laskey jlaskey at apple.com
Wed Jan 4 17:25:45 PST 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

DAGCombiner.cpp updated: 1.76 -> 1.77
LegalizeDAG.cpp updated: 1.252 -> 1.253
SelectionDAG.cpp updated: 1.233 -> 1.234
---
Log message:

Added initial support for DEBUG_LABEL allowing debug specific labels to be
inserted in the code.


---
Diffs of the changes:  (+57 -31)

 DAGCombiner.cpp  |    3 -
 LegalizeDAG.cpp  |   84 ++++++++++++++++++++++++++++++++++++-------------------
 SelectionDAG.cpp |    1 
 3 files changed, 57 insertions(+), 31 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.76 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.77
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.76	Wed Jan  4 09:04:11 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp	Wed Jan  4 19:25:28 2006
@@ -2117,8 +2117,7 @@
     return DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Chain.getOperand(0),
                                                    N->getOperand(1),
                                                    N->getOperand(2),
-                                                   N->getOperand(3),
-                                                   N->getOperand(4));
+                                                   N->getOperand(3));
   }
   
   return SDOperand();


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.252 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.253
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.252	Wed Jan  4 16:28:25 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Wed Jan  4 19:25:28 2006
@@ -619,20 +619,33 @@
     default: assert(0 && "This action is not supported yet!");
     case TargetLowering::Expand: {
       MachineDebugInfo *DebugInfo = DAG.getMachineDebugInfo();
-      if (TLI.isOperationLegal(ISD::DEBUG_LOC, MVT::Other) && DebugInfo) {
-        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 =
+      bool useDEBUG_LOC = TLI.isOperationLegal(ISD::DEBUG_LOC, MVT::Other);
+      bool useDEBUG_LABEL = TLI.isOperationLegal(ISD::DEBUG_LABEL, MVT::Other);
+      
+      if (DebugInfo && (useDEBUG_LOC || useDEBUG_LABEL)) {
+        const std::string &FName =
           cast<StringSDNode>(Node->getOperand(3))->getValue();
-        const std::string &dirname = 
+        const std::string &DirName = 
           cast<StringSDNode>(Node->getOperand(4))->getValue();
-        unsigned srcfile = DebugInfo->getUniqueSourceID(fname, dirname);
-        Ops.push_back(DAG.getConstant(srcfile, MVT::i32));  // source file id
-        unsigned id = DebugInfo->getNextUniqueID();
-        Ops.push_back(DAG.getConstant(id, MVT::i32));  // label id
-        Result = DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Ops);
+        unsigned SrcFile = DebugInfo->getUniqueSourceID(FName, DirName);
+
+        std::vector<SDOperand> Ops;
+        Ops.push_back(Tmp1);  // chain
+        SDOperand LineOp = Node->getOperand(1);
+        SDOperand ColOp = Node->getOperand(2);
+        
+        if (useDEBUG_LOC) {
+          Ops.push_back(LineOp);  // line #
+          Ops.push_back(ColOp);  // col #
+          Ops.push_back(DAG.getConstant(SrcFile, MVT::i32));  // source file id
+          Result = DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Ops);
+        } else {
+          unsigned Line = dyn_cast<ConstantSDNode>(LineOp)->getValue();
+          unsigned Col = dyn_cast<ConstantSDNode>(ColOp)->getValue();
+          unsigned ID = DebugInfo->RecordLabel(Line, Col, SrcFile);
+          Ops.push_back(DAG.getConstant(ID, MVT::i32));
+          Result = DAG.getNode(ISD::DEBUG_LABEL, MVT::Other, Ops);
+        }
       } else {
         Result = Tmp1;  // chain
       }
@@ -661,27 +674,40 @@
     break;
     
   case ISD::DEBUG_LOC:
-    assert(Node->getNumOperands() == 5 && "Invalid DEBUG_LOC node!");
+    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: {
-        SDOperand Tmp5;
-        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.
-        Tmp5 = LegalizeOp(Node->getOperand(4));  // Legalize the label id.
-        
-        if (Tmp1 != Node->getOperand(0) ||
-            Tmp2 != Node->getOperand(1) ||
-            Tmp3 != Node->getOperand(2) ||
-            Tmp4 != Node->getOperand(3) ||
-            Tmp5 != Node->getOperand(4)) {
-          Result =
-           DAG.getNode(ISD::DEBUG_LOC,MVT::Other, Tmp1, Tmp2, Tmp3, Tmp4, Tmp5);
-        }
+    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::DEBUG_LABEL:
+    assert(Node->getNumOperands() == 2 && "Invalid DEBUG_LABEL node!");
+    switch (TLI.getOperationAction(ISD::DEBUG_LABEL, 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 label id.
+      
+      if (Tmp1 != Node->getOperand(0) ||
+          Tmp2 != Node->getOperand(1)) {
+        Result = DAG.getNode(ISD::DEBUG_LABEL, MVT::Other, Tmp1, Tmp2);
       }
       break;
     }


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.233 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.234
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.233	Thu Dec 29 18:10:38 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Wed Jan  4 19:25:28 2006
@@ -2005,6 +2005,7 @@
   // Debug info
   case ISD::LOCATION: return "location";
   case ISD::DEBUG_LOC: return "debug_loc";
+  case ISD::DEBUG_LABEL: return "debug_label";
 
   case ISD::CONDCODE:
     switch (cast<CondCodeSDNode>(this)->get()) {






More information about the llvm-commits mailing list