aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Constants.cpp
diff options
context:
space:
mode:
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
//===----------------------------------------------------------------------===//