From c1513d24eab4b193c951f3cad450ef344e88e0a6 Mon Sep 17 00:00:00 2001 From: Scott Michel Date: Wed, 8 Aug 2007 23:23:31 +0000 Subject: [PATCH] If a target really needs to custom lower constants, it should be allowed to do so. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40955 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 274535633ce..5c8c9e3e33d 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -965,13 +965,21 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { } break; - case ISD::Constant: + case ISD::Constant: { + ConstantSDNode *CN = cast(Node); + unsigned opAction = + TLI.getOperationAction(ISD::Constant, CN->getValueType(0)); + // We know we don't need to expand constants here, constants only have one // value and we check that it is fine above. - // FIXME: Maybe we should handle things like targets that don't support full - // 32-bit immediates? + if (opAction == TargetLowering::Custom) { + Tmp1 = TLI.LowerOperation(Result, DAG); + if (Tmp1.Val) + Result = Tmp1; + } break; + } case ISD::ConstantFP: { // Spill FP immediates to the constant pool if the target cannot directly // codegen them. Targets often have some immediate values that can be