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
This commit is contained in:
Chris Lattner 2005-01-16 07:28:11 +00:00
parent 7e5ee40979
commit cba82f9339

View File

@ -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;
}