aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2012-01-25 01:53:58 +0000
committerChris Lattner <sabre@nondot.org>2012-01-25 01:53:58 +0000
commit82385c9a40de1c81ee0e92891bc59a3e68b03a2f (patch)
tree3232177241086295758c31ae67b647b24510c42e /include/llvm
parentdc81eae9d276b83b5d5e2f9b53ddbd5267cfcb8e (diff)
downloadexternal_llvm-82385c9a40de1c81ee0e92891bc59a3e68b03a2f.zip
external_llvm-82385c9a40de1c81ee0e92891bc59a3e68b03a2f.tar.gz
external_llvm-82385c9a40de1c81ee0e92891bc59a3e68b03a2f.tar.bz2
Introduce a new ConstantVector::getSplat constructor function to
simplify a really common case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148901 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Constants.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h
index d3fd766..1823f1d 100644
--- a/include/llvm/Constants.h
+++ b/include/llvm/Constants.h
@@ -489,6 +489,10 @@ public:
// ConstantVector accessors
static Constant *get(ArrayRef<Constant*> V);
+ /// getSplat - Return a ConstantVector with the specified constant in each
+ /// element.
+ static Constant *getSplat(unsigned NumElts, Constant *Elt);
+
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Constant);
@@ -757,6 +761,11 @@ public:
static Constant *get(LLVMContext &Context, ArrayRef<float> Elts);
static Constant *get(LLVMContext &Context, ArrayRef<double> Elts);
+ /// getSplat - Return a ConstantVector with the specified constant in each
+ /// element. The specified constant has to be a of a compatible type (i8/i16/
+ /// i32/i64/float/double) and must be a ConstantFP or ConstantInt.
+ static Constant *getSplat(unsigned NumElts, Constant *Elt);
+
/// getType - Specialize the getType() method to always return a VectorType,
/// which reduces the amount of casting needed in parts of the compiler.
///