[llvm-commits] CVS: llvm/lib/Target/TargetLowering.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sat Jan 15 23:28:24 PST 2005
Changes in directory llvm/lib/Target:
TargetLowering.cpp updated: 1.4 -> 1.5
---
Log message:
Use enums, move virtual dtor out of line.
---
Diffs of the changes: (+14 -8)
Index: llvm/lib/Target/TargetLowering.cpp
diff -u llvm/lib/Target/TargetLowering.cpp:1.4 llvm/lib/Target/TargetLowering.cpp:1.5
--- llvm/lib/Target/TargetLowering.cpp:1.4 Sat Jan 15 19:20:18 2005
+++ llvm/lib/Target/TargetLowering.cpp Sun Jan 16 01:28:11 2005
@@ -20,21 +20,25 @@
: 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 @@
"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 @@
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;
}
+
More information about the llvm-commits
mailing list