aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-11-17 06:41:44 +0000
committerChris Lattner <sabre@nondot.org>2005-11-17 06:41:44 +0000
commit0c8fbe33a4bdf7c60e0cfd5a9c86499c817d9f1a (patch)
treee494f62cda20eb2816ec42381288a6a81a6b6e65
parent2823b3e70ee7a5ed7482c45c503659a16a879a61 (diff)
Allow targets to custom legalize leaf nodes like GlobalAddress.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24387 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 6a7a53ea80..7b453a282b 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -532,7 +532,19 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
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: