diff options
author | Nate Begeman <natebegeman@mac.com> | 2008-02-14 08:57:00 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2008-02-14 08:57:00 +0000 |
commit | e179584f9b740cf3a36bde70f8cab40de59b8081 (patch) | |
tree | 154abecd7804f8cb2ee74ced19f41990f9725832 /lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | |
parent | 6e9bceea976a993dbc6a543c2135980df7616b97 (diff) |
Change how FP immediates are handled.
1) ConstantFP is now expand by default
2) ConstantFP is not turned into TargetConstantFP during Legalize
if it is legal.
This allows ConstantFP to be handled like Constant, allowing for
targets that can encode FP immediates as MachineOperands.
As a bonus, fix up Itanium FP constants, which now correctly match,
and match more constants! Hooray.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47121 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 2b8d47bf25..f0f3d1ca7b 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -1155,24 +1155,10 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { // leave these constants as ConstantFP nodes for the target to deal with. ConstantFPSDNode *CFP = cast<ConstantFPSDNode>(Node); - // Check to see if this FP immediate is already legal. - bool isLegal = false; - for (TargetLowering::legal_fpimm_iterator I = TLI.legal_fpimm_begin(), - E = TLI.legal_fpimm_end(); I != E; ++I) - if (CFP->isExactlyValue(*I)) { - isLegal = true; - break; - } - - // If this is a legal constant, turn it into a TargetConstantFP node. - if (isLegal) { - Result = DAG.getTargetConstantFP(CFP->getValueAPF(), - CFP->getValueType(0)); - break; - } - switch (TLI.getOperationAction(ISD::ConstantFP, CFP->getValueType(0))) { default: assert(0 && "This action is not supported yet!"); + case TargetLowering::Legal: + break; case TargetLowering::Custom: Tmp3 = TLI.LowerOperation(Result, DAG); if (Tmp3.Val) { @@ -1180,9 +1166,22 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { break; } // FALLTHROUGH - case TargetLowering::Expand: + case TargetLowering::Expand: { + // Check to see if this FP immediate is already legal. + bool isLegal = false; + for (TargetLowering::legal_fpimm_iterator I = TLI.legal_fpimm_begin(), + E = TLI.legal_fpimm_end(); I != E; ++I) { + if (CFP->isExactlyValue(*I)) { + isLegal = true; + break; + } + } + // If this is a legal constant, turn it into a TargetConstantFP node. + if (isLegal) + break; Result = ExpandConstantFP(CFP, true, DAG, TLI); } + } break; } case ISD::TokenFactor: |