summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
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
commit45ca1c019405202a529f5d3b5105566318019ddc (patch)
treeebd8a79f95d4a294b7d4242ad1e5d844e71b6ade /llvm/lib/CodeGen
parentb7025749e1021ef83e3c63e286f9a2b890c792a1 (diff)
downloadbcm5719-llvm-45ca1c019405202a529f5d3b5105566318019ddc.tar.gz
bcm5719-llvm-45ca1c019405202a529f5d3b5105566318019ddc.zip
Allow targets to custom legalize leaf nodes like GlobalAddress.
llvm-svn: 24387
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 6a7a53ea80a..7b453a282b3 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/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:
OpenPOWER on IntegriCloud