diff options
| author | Chris Lattner <sabre@nondot.org> | 2007-01-04 01:49:26 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2007-01-04 01:49:26 +0000 | 
| commit | ecab54cfc0d029bdbaf0ba3098e3ac9f20f0babc (patch) | |
| tree | 8aae9387a782387ca96e06f9cb448a6854c38f11 | |
| parent | 2f0b276731005d99be4163794aad2c30926b7aae (diff) | |
| download | bcm5719-llvm-ecab54cfc0d029bdbaf0ba3098e3ac9f20f0babc.tar.gz bcm5719-llvm-ecab54cfc0d029bdbaf0ba3098e3ac9f20f0babc.zip  | |
Add a new ConstantPacked::getAllOnesValue method
llvm-svn: 32856
| -rw-r--r-- | llvm/include/llvm/Constants.h | 5 | ||||
| -rw-r--r-- | llvm/lib/VMCore/Constants.cpp | 12 | 
2 files changed, 17 insertions, 0 deletions
diff --git a/llvm/include/llvm/Constants.h b/llvm/include/llvm/Constants.h index a6050f44a63..e7552e33e08 100644 --- a/llvm/include/llvm/Constants.h +++ b/llvm/include/llvm/Constants.h @@ -422,6 +422,11 @@ public:      return reinterpret_cast<const PackedType*>(Value::getType());    } +  /// @returns the value for an packed integer constant of the given type that +  /// has all its bits set to true. +  /// @brief Get the all ones value +  static ConstantPacked *getAllOnesValue(const PackedType *Ty); +      /// isNullValue - Return true if this is the value that would be returned by    /// getNullValue.  This always returns false because zero arrays are always    /// created as ConstantAggregateZero objects. diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index 56219e27567..dfdb1f72dcd 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/lib/VMCore/Constants.cpp @@ -146,6 +146,18 @@ ConstantIntegral *ConstantIntegral::getAllOnesValue(const Type *Ty) {    }  } +/// @returns the value for an packed integer constant of the given type that +/// has all its bits set to true. +/// @brief Get the all ones value +ConstantPacked *ConstantPacked::getAllOnesValue(const PackedType *Ty) { +  std::vector<Constant*> Elts; +  Elts.resize(Ty->getNumElements(), +              ConstantIntegral::getAllOnesValue(Ty->getElementType())); +  assert(Elts[0] && "Not a packed integer type!"); +  return cast<ConstantPacked>(ConstantPacked::get(Elts)); +} + +  //===----------------------------------------------------------------------===//  //                            ConstantXXX Classes  //===----------------------------------------------------------------------===//  | 

