aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Constants.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-01-04 01:49:26 +0000
committerChris Lattner <sabre@nondot.org>2007-01-04 01:49:26 +0000
commit58513aa1c22a08118734ac799d935ea2910db35a (patch)
treea0ce8a953a13776ed1165e5270a34badaa0041c6 /lib/VMCore/Constants.cpp
parent8688428b0510e5e7dab43379b3d53c9b40dc182d (diff)
Add a new ConstantPacked::getAllOnesValue method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32856 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Constants.cpp')
-rw-r--r--lib/VMCore/Constants.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index 56219e2756..dfdb1f72dc 100644
--- a/lib/VMCore/Constants.cpp
+++ b/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
//===----------------------------------------------------------------------===//