Use enums, move virtual dtor out of line.
authorChris Lattner <sabre@nondot.org>
Sun, 16 Jan 2005 07:28:11 +0000 (07:28 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 16 Jan 2005 07:28:11 +0000 (07:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19610 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/TargetLowering.cpp

index 3d28fd85f6d639211aa2005a50c088bb420acff4..b4d4a170b368d102683f6dff8b7a5d4121309fd7 100644 (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;
 }
+