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

Andrew Lenharth alenhar2 at cs.uiuc.edu
Sat Dec 24 17:07:49 PST 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.248 -> 1.249
---
Log message:

allow custom lowering to return null for legal results

---
Diffs of the changes:  (+15 -17)

 LegalizeDAG.cpp |   32 +++++++++++++++-----------------
 1 files changed, 15 insertions(+), 17 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.248 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.249
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.248	Sat Dec 24 17:42:32 2005
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Sat Dec 24 19:07:37 2005
@@ -1956,11 +1956,6 @@
       break;
     }
     switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) {
-    case TargetLowering::Legal:
-      if (Tmp1 != Node->getOperand(0) ||
-	  Tmp2 != Node->getOperand(1))
-	Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1,Tmp2);
-      break;
     case TargetLowering::Custom: {
       Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1, Tmp2);
       SDOperand Tmp = TLI.LowerOperation(Result, DAG);
@@ -1968,9 +1963,13 @@
 	Tmp = LegalizeOp(Tmp);  // Relegalize input.
 	AddLegalizedOperand(Op, Tmp);
 	return Tmp;
-      }
-      break;
+      } //else it was considered legal and we fall through
     }
+    case TargetLowering::Legal:
+      if (Tmp1 != Node->getOperand(0) ||
+	  Tmp2 != Node->getOperand(1))
+	Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1,Tmp2);
+      break;
     default:
       assert(0 && "Operation not supported");
     }
@@ -2007,14 +2006,6 @@
     Tmp1 = LegalizeOp(Node->getOperand(0));   // LHS
     Tmp2 = LegalizeOp(Node->getOperand(1));   // RHS
     switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) {
-    case TargetLowering::Legal:
-      if (Tmp1 != Node->getOperand(0) ||
-          Tmp2 != Node->getOperand(1))
-        Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1,
-                             Tmp2);
-      break;
-    case TargetLowering::Promote:
-      assert(0 && "Cannot promote handle this yet!");
     case TargetLowering::Custom: {
       Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1, Tmp2);
       SDOperand Tmp = TLI.LowerOperation(Result, DAG);
@@ -2022,9 +2013,16 @@
 	Tmp = LegalizeOp(Tmp);  // Relegalize input.
 	AddLegalizedOperand(Op, Tmp);
 	return Tmp;
-      }
-      break;
+      } //else it was considered legal and we fall through
     }
+    case TargetLowering::Legal:
+      if (Tmp1 != Node->getOperand(0) ||
+          Tmp2 != Node->getOperand(1))
+        Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1,
+                             Tmp2);
+      break;
+    case TargetLowering::Promote:
+      assert(0 && "Cannot promote handle this yet!");
     case TargetLowering::Expand:
       if (MVT::isInteger(Node->getValueType(0))) {
         MVT::ValueType VT = Node->getValueType(0);






More information about the llvm-commits mailing list