diff options
author | Chris Lattner <sabre@nondot.org> | 2007-02-19 07:23:24 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-02-19 07:23:24 +0000 |
commit | df7490a27323f194b63db75c0b16708fc7c6cfbe (patch) | |
tree | a253aad3efcb7dc9c78288f5b3b7fe3594a856b0 /include | |
parent | 64113a5b961808a796999a378e6587e3f79b2634 (diff) | |
download | external_llvm-df7490a27323f194b63db75c0b16708fc7c6cfbe.zip external_llvm-df7490a27323f194b63db75c0b16708fc7c6cfbe.tar.gz external_llvm-df7490a27323f194b63db75c0b16708fc7c6cfbe.tar.bz2 |
add alternate version of constant ctors that don't take a vector. For now
this offers no performance advantage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34415 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Constants.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index e01e2a2..58def86 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -248,6 +248,11 @@ protected: public: /// get() - Static factory methods - Return objects of the specified value static Constant *get(const ArrayType *T, const std::vector<Constant*> &); + static Constant *get(const ArrayType *T, + Constant*const*Vals, unsigned NumVals) { + // FIXME: make this the primary ctor method. + return get(T, std::vector<Constant*>(Vals, Vals+NumVals)); + } /// This method constructs a ConstantArray and initializes it with a text /// string. The default behavior (AddNull==true) causes a null terminator to @@ -308,8 +313,13 @@ public: /// get() - Static factory methods - Return objects of the specified value /// static Constant *get(const StructType *T, const std::vector<Constant*> &V); - static Constant *get(const std::vector<Constant*> &V, bool packed = false); - + static Constant *get(const std::vector<Constant*> &V, bool Packed = false); + static Constant *get(Constant*const* Vals, unsigned NumVals, + bool Packed = false) { + // FIXME: make this the primary ctor method. + return get(std::vector<Constant*>(Vals, Vals+NumVals), Packed); + } + /// getType() specialization - Reduce amount of casting... /// inline const StructType *getType() const { @@ -347,7 +357,11 @@ public: /// get() - Static factory methods - Return objects of the specified value static Constant *get(const VectorType *T, const std::vector<Constant*> &); static Constant *get(const std::vector<Constant*> &V); - + static Constant *get(Constant*const* Vals, unsigned NumVals) { + // FIXME: make this the primary ctor method. + return get(std::vector<Constant*>(Vals, Vals+NumVals)); + } + /// getType - Specialize the getType() method to always return an VectorType, /// which reduces the amount of casting needed in parts of the compiler. /// @@ -578,6 +592,8 @@ public: Constant* const *IdxList, unsigned NumIdx); static Constant *getGetElementPtr(Constant *C, Value* const *IdxList, unsigned NumIdx); + + // FIXME: Remove these. static Constant *getGetElementPtr(Constant *C, const std::vector<Constant*> &IdxList) { return getGetElementPtr(C, &IdxList[0], IdxList.size()); |