[llvm-commits] CVS: llvm/include/llvm/Constants.h

Reid Spencer reid at x10sys.com
Thu Jan 11 20:25:30 PST 2007



Changes in directory llvm/include/llvm:

Constants.h updated: 1.116 -> 1.117
---
Log message:

Implement review feedback for the ConstantBool->ConstantInt merge. Chris
recommended that getBoolValue be replaced with getZExtValue and that
get(bool) be replaced by get(const Type*, uint64_t). This implements
those changes.


---
Diffs of the changes:  (+3 -26)

 Constants.h |   29 +++--------------------------
 1 files changed, 3 insertions(+), 26 deletions(-)


Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.116 llvm/include/llvm/Constants.h:1.117
--- llvm/include/llvm/Constants.h:1.116	Thu Jan 11 12:21:28 2007
+++ llvm/include/llvm/Constants.h	Thu Jan 11 22:24:45 2007
@@ -85,10 +85,6 @@
     return F = new ConstantInt(false);
   }
 
-  /// @brief Static factory method for getting a ConstantInt instance which
-  /// stands for a bool value.
-  static ConstantInt *get(bool Value) { return Value ? getTrue() : getFalse();}
-
   /// Return a ConstantInt with the specified value for the specified type. The
   /// value V will be canonicalized to a uint64_t but accessing it with either
   /// getSExtValue() or getZExtValue() (ConstantInt) will yield the correct
@@ -96,22 +92,6 @@
   /// @brief Get a ConstantInt for a specific value.
   static ConstantInt *get(const Type *Ty, int64_t V);
 
-  /// Returns the opposite value of this ConstantInt. 
-  /// @brief Get inverse value.
-  inline ConstantInt *inverted() const {
-    static ConstantInt *CI = 0;
-    if (CI) return CI; 
-    return CI = new ConstantInt(getType(), 
-                                Val ^ (getType() == Type::Int1Ty ? 1 : -1));
-  }
-
-  /// @returns the value of this ConstantInt only if it's a boolean type.
-  /// @brief return the boolean value of this constant.
-  inline bool getBoolValue() const { 
-    assert(getType() == Type::Int1Ty && "Should be a boolean constant!");
-    return static_cast<bool>(getZExtValue()); 
-  }
-
   /// This static method returns true if the type Ty is big enough to 
   /// represent the value V. This can be used to avoid having the get method 
   /// assert when V is larger than Ty can represent. Note that there are two
@@ -136,8 +116,7 @@
   /// to true.
   /// @returns true iff this constant's bits are all set to true.
   /// @brief Determine if the value is all ones.
-  virtual bool isAllOnesValue() const { 
-    if (getType() == Type::Int1Ty) return getBoolValue() == true;
+  bool isAllOnesValue() const { 
     return getSExtValue() == -1; 
   }
 
@@ -146,8 +125,7 @@
   /// @returns true iff this is the largest value that may be represented 
   /// by this type.
   /// @brief Determine if the value is maximal.
-  virtual bool isMaxValue(bool isSigned) const {
-    if (getType() == Type::Int1Ty) return getBoolValue() == true;
+  bool isMaxValue(bool isSigned) const {
     if (isSigned) {
       int64_t V = getSExtValue();
       if (V < 0) return false;    // Be careful about wrap-around on 'long's
@@ -162,8 +140,7 @@
   /// @returns true if this is the smallest value that may be represented by 
   /// this type.
   /// @brief Determine if the value is minimal.
-  virtual bool isMinValue(bool isSigned) const {
-    if (getType() == Type::Int1Ty) return getBoolValue() == false;
+  bool isMinValue(bool isSigned) const {
     if (isSigned) {
       int64_t V = getSExtValue();
       if (V > 0) return false;    // Be careful about wrap-around on 'long's






More information about the llvm-commits mailing list