aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/TargetLowering.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-16 07:28:11 +0000
committerChris Lattner <sabre@nondot.org>2005-01-16 07:28:11 +0000
commitcba82f9339566cef76ecb062980e40913e6ccc23 (patch)
treed6816fe77e5d8c9099847ff36bd9720d99a1a612 /lib/CodeGen/SelectionDAG/TargetLowering.cpp
parent7e5ee4097940d9e3b49b858ffbb3e52b0953fde0 (diff)
Use enums, move virtual dtor out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19610 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/TargetLowering.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 3d28fd85f6..b4d4a170b3 100644
--- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -20,21 +20,25 @@ TargetLowering::TargetLowering(TargetMachine &tm)
: TM(tm), TD(TM.getTargetData()), ValueTypeActions(0) {
assert(ISD::BUILTIN_OP_END <= 128 &&
"Fixed size array in TargetLowering is not large enough!");
+ // All operations default to being supported.
+ memset(OpActions, 0, sizeof(OpActions));
IsLittleEndian = TD.isLittleEndian();
PointerTy = getValueType(TD.getIntPtrType());
- memset(UnsupportedOps, 0, 128*sizeof(short));
memset(RegClassForVT, 0,MVT::LAST_VALUETYPE*sizeof(TargetRegisterClass*));
}
+TargetLowering::~TargetLowering() {}
+
/// setValueTypeAction - Set the action for a particular value type. This
/// assumes an action has not already been set for this value type.
-static void SetValueTypeAction(MVT::ValueType VT, unsigned Action,
+static void SetValueTypeAction(MVT::ValueType VT,
+ TargetLowering::LegalizeAction Action,
TargetLowering &TLI,
MVT::ValueType *TransformToType,
unsigned &ValueTypeActions) {
ValueTypeActions |= Action << (VT*2);
- if (Action == 1 /*promote*/) {
+ if (Action == TargetLowering::Promote) {
MVT::ValueType PromoteTo;
if (VT == MVT::f32)
PromoteTo = MVT::f64;
@@ -53,7 +57,7 @@ static void SetValueTypeAction(MVT::ValueType VT, unsigned Action,
"Can only promote from int->int or fp->fp!");
assert(VT < PromoteTo && "Must promote to a larger type!");
TransformToType[VT] = PromoteTo;
- } else if (Action == 2) {
+ } else if (Action == TargetLowering::Expand) {
assert(MVT::isInteger(VT) && VT > MVT::i8 &&
"Cannot expand this type: target must support SOME integer reg!");
// Expand to the next smaller integer type!
@@ -87,22 +91,24 @@ void TargetLowering::computeRegisterProperties() {
for (unsigned IntReg = MVT::i1; IntReg <= MVT::i128; ++IntReg)
// If we are expanding this type, expand it!
if (getNumElements((MVT::ValueType)IntReg) != 1)
- SetValueTypeAction((MVT::ValueType)IntReg, 2, *this, TransformToType,
+ SetValueTypeAction((MVT::ValueType)IntReg, Expand, *this, TransformToType,
ValueTypeActions);
else if (!hasNativeSupportFor((MVT::ValueType)IntReg))
// Otherwise, if we don't have native support, we must promote to a
// larger type.
- SetValueTypeAction((MVT::ValueType)IntReg, 1, *this, TransformToType,
- ValueTypeActions);
+ SetValueTypeAction((MVT::ValueType)IntReg, Promote, *this,
+ TransformToType, ValueTypeActions);
else
TransformToType[(MVT::ValueType)IntReg] = (MVT::ValueType)IntReg;
// If the target does not have native support for F32, promote it to F64.
if (!hasNativeSupportFor(MVT::f32))
- SetValueTypeAction(MVT::f32, 1, *this, TransformToType, ValueTypeActions);
+ SetValueTypeAction(MVT::f32, Promote, *this,
+ TransformToType, ValueTypeActions);
else
TransformToType[MVT::f32] = MVT::f32;
assert(hasNativeSupportFor(MVT::f64) && "Target does not support FP?");
TransformToType[MVT::f64] = MVT::f64;
}
+