From 0c8fbe33a4bdf7c60e0cfd5a9c86499c817d9f1a Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 17 Nov 2005 06:41:44 +0000 Subject: [PATCH] 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 --- lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 6a7a53ea80a..7b453a282b3 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: