Make ConstantFP legalize into TargetConstantFP like other leaf nodes do. Allow

targets to register custom legalizers for ConstantFP in case there isn't a
fixed list of constants that can be generated.  On some architectures (ia64?)
all fp immediates are legal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25769 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2006-01-29 06:24:40 +00:00
parent 2128a2f76c
commit ac0d723825
3 changed files with 16 additions and 6 deletions

View File

@@ -71,9 +71,11 @@ namespace ISD {
// leaf node. All operands are either Constant or ConstantFP nodes.
ConstantVec,
// TargetConstant - Like Constant, but the DAG does not do any folding or
// simplification of the constant. This is used by the DAG->DAG selector.
// TargetConstant* - Like Constant*, but the DAG does not do any folding or
// simplification of the constant.
TargetConstant,
TargetConstantFP,
TargetConstantVec,
// TargetGlobalAddress - Like GlobalAddress, but the DAG does no folding or
// anything else with this node, and this is valid in the target-specific
@@ -997,8 +999,9 @@ class ConstantFPSDNode : public SDNode {
double Value;
protected:
friend class SelectionDAG;
ConstantFPSDNode(double val, MVT::ValueType VT)
: SDNode(ISD::ConstantFP, VT), Value(val) {
ConstantFPSDNode(bool isTarget, double val, MVT::ValueType VT)
: SDNode(isTarget ? ISD::TargetConstantFP : ISD::ConstantFP, VT),
Value(val) {
}
public:
@@ -1012,7 +1015,8 @@ public:
static bool classof(const ConstantFPSDNode *) { return true; }
static bool classof(const SDNode *N) {
return N->getOpcode() == ISD::ConstantFP;
return N->getOpcode() == ISD::ConstantFP ||
N->getOpcode() == ISD::TargetConstantFP;
}
};