Use the attribute enums to query if a function has an attribute.
[oota-llvm.git] / include / llvm / Support / IntegersSubset.h
index 4d76fab2d0941a4dcc959b8074e165488aeb7d2d..bb9e76925ed55b6f6ae5e6ec6100a2d63bd04a81 100644 (file)
@@ -182,12 +182,7 @@ protected:
     IntType Low;
     IntType High;
     bool IsEmpty : 1;
-    enum Type {
-      SINGLE_NUMBER,
-      RANGE,
-      UNKNOWN
-    };
-    Type RangeType;
+    bool IsSingleNumber : 1;
 
 public:
     typedef IntRange<IntType> self;
@@ -196,30 +191,15 @@ public:
     IntRange() : IsEmpty(true) {}
     IntRange(const self &RHS) :
       Low(RHS.Low), High(RHS.High),
-      IsEmpty(RHS.IsEmpty), RangeType(RHS.RangeType) {}
+      IsEmpty(RHS.IsEmpty), IsSingleNumber(RHS.IsSingleNumber) {}
     IntRange(const IntType &C) :
-      Low(C), High(C), IsEmpty(false), RangeType(SINGLE_NUMBER) {}
+      Low(C), High(C), IsEmpty(false), IsSingleNumber(true) {}
 
     IntRange(const IntType &L, const IntType &H) : Low(L), High(H),
-      IsEmpty(false), RangeType(UNKNOWN) {}
+      IsEmpty(false), IsSingleNumber(Low == High) {}
 
     bool isEmpty() const { return IsEmpty; }
-    bool isSingleNumber() const {
-      switch (RangeType) {
-      case SINGLE_NUMBER:
-        return true;
-      case RANGE:
-        return false;
-      case UNKNOWN:
-        if (Low == High) {
-          const_cast<Type&>(RangeType) = SINGLE_NUMBER;
-          return true;
-        }
-        const_cast<Type&>(RangeType) = RANGE;
-        return false;
-      }
-      llvm_unreachable("Unknown state?!");
-    }
+    bool isSingleNumber() const { return IsSingleNumber; }
 
     const IntType& getLow() const {
       assert(!IsEmpty && "Range is empty.");
@@ -233,13 +213,13 @@ public:
     bool operator<(const self &RHS) const {
       assert(!IsEmpty && "Left range is empty.");
       assert(!RHS.IsEmpty && "Right range is empty.");
-      if (Low < RHS.Low)
-        return true;
       if (Low == RHS.Low) {
         if (High > RHS.High)
           return true;
         return false;
       }
+      if (Low < RHS.Low)
+        return true;
       return false;
     }
 
@@ -532,7 +512,7 @@ public:
          e = Src.end(); i != e; ++i) {
       const Range &R = *i;
       std::vector<Constant*> r;
-      if (!R.isSingleNumber()) {
+      if (R.isSingleNumber()) {
         r.reserve(2);
         // FIXME: Since currently we have ConstantInt based numbers
         // use hack-conversion of IntItem to ConstantInt