minor cleanups. Add provisions for a new standard BLOCKINFO_BLOCK
[oota-llvm.git] / include / llvm / Constants.h
index 7e9f5d07475874a84415de2aa12d47e85e7b672d..2bec1d42ab63b47c59e640758edb74f780288959 100644 (file)
@@ -52,6 +52,9 @@ public:
   inline const APInt& getValue() const {
     return Val;
   }
+  
+  /// getBitWidth - Return the bitwidth of this constant.
+  unsigned getBitWidth() const { return Val.getBitWidth(); }
 
   /// Return the constant as a 64-bit unsigned integer value after it
   /// has been zero extended as appropriate for the type of this constant. Note
@@ -179,15 +182,15 @@ public:
   /// value.
   /// @returns true iff this constant is greater or equal to the given number.
   /// @brief Determine if the value is greater or equal to the given number.
-  bool greaterOrEqual(uint64_t Num) {
-    return Val.getActiveBits() > 64 || Val.getZExtValue() > Num;
+  bool uge(uint64_t Num) {
+    return Val.getActiveBits() > 64 || Val.getZExtValue() >= Num;
   }
 
   /// @returns the 64-bit value of this constant if its active bits number is 
   /// not greater than 64, otherwise, just return the given uint64_t number.
   /// @brief Get the constant's value if possible.
-  uint64_t getLimitedValue(uint64_t Limit) {
-    return (Val.getActiveBits() > 64) ? Limit : Val.getZExtValue();
+  uint64_t getLimitedValue(uint64_t Limit = ~0ULL) const {
+    return Val.getLimitedValue(Limit);
   }
 
   /// @returns the value for an integer constant of the given type that has all
@@ -198,7 +201,7 @@ public:
   /// @brief Methods to support type inquiry through isa, cast, and dyn_cast.
   static inline bool classof(const ConstantInt *) { return true; }
   static bool classof(const Value *V) {
-    return V->getValueType() == ConstantIntVal;
+    return V->getValueID() == ConstantIntVal;
   }
   static void ResetTrueFalse() { TheTrueVal = TheFalseVal = 0; }
 private:
@@ -236,7 +239,7 @@ public:
   /// Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const ConstantFP *) { return true; }
   static bool classof(const Value *V) {
-    return V->getValueType() == ConstantFPVal;
+    return V->getValueID() == ConstantFPVal;
   }
 };
 
@@ -264,7 +267,7 @@ public:
   ///
   static bool classof(const ConstantAggregateZero *) { return true; }
   static bool classof(const Value *V) {
-    return V->getValueType() == ConstantAggregateZeroVal;
+    return V->getValueID() == ConstantAggregateZeroVal;
   }
 };
 
@@ -328,7 +331,7 @@ public:
   /// Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const ConstantArray *) { return true; }
   static bool classof(const Value *V) {
-    return V->getValueType() == ConstantArrayVal;
+    return V->getValueID() == ConstantArrayVal;
   }
 };
 
@@ -373,7 +376,7 @@ public:
   /// Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const ConstantStruct *) { return true; }
   static bool classof(const Value *V) {
-    return V->getValueType() == ConstantStructVal;
+    return V->getValueID() == ConstantStructVal;
   }
 };
 
@@ -425,7 +428,7 @@ public:
   /// Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const ConstantVector *) { return true; }
   static bool classof(const Value *V) {
-    return V->getValueType() == ConstantVectorVal;
+    return V->getValueID() == ConstantVectorVal;
   }
 };
 
@@ -461,7 +464,7 @@ public:
   /// Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const ConstantPointerNull *) { return true; }
   static bool classof(const Value *V) {
-    return V->getValueType() == ConstantPointerNullVal;
+    return V->getValueID() == ConstantPointerNullVal;
   }
 };
 
@@ -670,7 +673,7 @@ public:
   /// Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const ConstantExpr *) { return true; }
   static inline bool classof(const Value *V) {
-    return V->getValueType() == ConstantExprVal;
+    return V->getValueID() == ConstantExprVal;
   }
 };
 
@@ -701,7 +704,7 @@ public:
   /// Methods for support type inquiry through isa, cast, and dyn_cast:
   static inline bool classof(const UndefValue *) { return true; }
   static bool classof(const Value *V) {
-    return V->getValueType() == UndefValueVal;
+    return V->getValueID() == UndefValueVal;
   }
 };