[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp

Chris Lattner sabre at nondot.org
Wed Jan 3 17:49:44 PST 2007



Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.193 -> 1.194
---
Log message:

Add a new ConstantPacked::getAllOnesValue method


---
Diffs of the changes:  (+12 -0)

 Constants.cpp |   12 ++++++++++++
 1 files changed, 12 insertions(+)


Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.193 llvm/lib/VMCore/Constants.cpp:1.194
--- llvm/lib/VMCore/Constants.cpp:1.193	Sat Dec 30 23:26:44 2006
+++ llvm/lib/VMCore/Constants.cpp	Wed Jan  3 19:49:26 2007
@@ -146,6 +146,18 @@
   }
 }
 
+/// @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
 //===----------------------------------------------------------------------===//






More information about the llvm-commits mailing list