summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-01-29 06:26:56 +0000
committerChris Lattner <sabre@nondot.org>2006-01-29 06:26:56 +0000
commit758b0ac54bb5a062806a713968419ebb59bb6a40 (patch)
tree20019986709578dd6053cd74d05199d0a6d1d7b3 /llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
parent61c9a8e942ae46ad09980bd491750e22f6965aa3 (diff)
downloadbcm5719-llvm-758b0ac54bb5a062806a713968419ebb59bb6a40.tar.gz
bcm5719-llvm-758b0ac54bb5a062806a713968419ebb59bb6a40.zip
Legalize ConstantFP into TargetConstantFP when the target allows. Implement
custom expansion of ConstantFP nodes. llvm-svn: 25772
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index f89b237c053..89d764cc6cd 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -272,6 +272,8 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
case ISD::BasicBlock:
case ISD::TargetFrameIndex:
case ISD::TargetConstant:
+ case ISD::TargetConstantFP:
+ case ISD::TargetConstantVec:
case ISD::TargetConstantPool:
case ISD::TargetGlobalAddress:
case ISD::TargetExternalSymbol:
@@ -481,7 +483,22 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
break;
}
- if (!isLegal) {
+ // If this is a legal constant, turn it into a TargetConstantFP node.
+ if (isLegal) {
+ Result = DAG.getTargetConstantFP(CFP->getValue(), CFP->getValueType(0));
+ break;
+ }
+
+ switch (TLI.getOperationAction(ISD::ConstantFP, CFP->getValueType(0))) {
+ default: assert(0 && "This action is not supported yet!");
+ case TargetLowering::Custom:
+ Tmp3 = TLI.LowerOperation(Result, DAG);
+ if (Tmp3.Val) {
+ Result = Tmp3;
+ break;
+ }
+ // FALLTHROUGH
+ case TargetLowering::Expand:
// Otherwise we need to spill the constant to memory.
bool Extend = false;
OpenPOWER on IntegriCloud