summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/Constants.cpp12
1 files changed, 12 insertions, 0 deletions
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
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud