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

Chris Lattner lattner at cs.uiuc.edu
Wed Nov 16 22:41:55 PST 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.208 -> 1.209
---
Log message:

Allow targets to custom legalize leaf nodes like GlobalAddress.


---
Diffs of the changes:  (+13 -1)

 LegalizeDAG.cpp |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletion(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.208 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.209
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.208	Wed Nov 16 23:52:24 2005
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Thu Nov 17 00:41:44 2005
@@ -532,7 +532,19 @@
   case ISD::CONDCODE:
   case ISD::VALUETYPE:
   case ISD::SRCVALUE:
-    assert(isTypeLegal(Node->getValueType(0)) && "This must be legal!");
+    switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) {
+    default: assert(0 && "This action is not supported yet!");
+    case TargetLowering::Custom: {
+      SDOperand Tmp = TLI.LowerOperation(Op, DAG);
+      if (Tmp.Val) {
+        Result = LegalizeOp(Tmp);
+        break;
+      }
+    } // FALLTHROUGH if the target doesn't want to lower this op after all.
+    case TargetLowering::Legal:
+      assert(isTypeLegal(Node->getValueType(0)) && "This must be legal!");
+      break;
+    }
     break;
   case ISD::AssertSext:
   case ISD::AssertZext:






More information about the llvm-commits mailing list