summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-01-31 04:39:29 +0000
committerChris Lattner <sabre@nondot.org>2007-01-31 04:39:29 +0000
commit64488b1cc31baebbaa02f289033ec61b562a33fa (patch)
treedab96cbe7995411468779ff9d76e6af691670042
parent345877e77c91a2cd18a4b20bc104c249156d3f83 (diff)
downloadbcm5719-llvm-64488b1cc31baebbaa02f289033ec61b562a33fa.tar.gz
bcm5719-llvm-64488b1cc31baebbaa02f289033ec61b562a33fa.zip
Revise APIs for creating constantexpr GEPs to not require the use of
vectors. This allows us to eliminate many temporary vectors, and their associated malloc/free pairs. llvm-svn: 33691
-rw-r--r--llvm/include/llvm/Constants.h16
-rw-r--r--llvm/include/llvm/Instructions.h14
2 files changed, 24 insertions, 6 deletions
diff --git a/llvm/include/llvm/Constants.h b/llvm/include/llvm/Constants.h
index c92229e8793..e502a71f539 100644
--- a/llvm/include/llvm/Constants.h
+++ b/llvm/include/llvm/Constants.h
@@ -447,7 +447,7 @@ protected:
static Constant *getSelectTy(const Type *Ty,
Constant *C1, Constant *C2, Constant *C3);
static Constant *getGetElementPtrTy(const Type *Ty, Constant *C,
- const std::vector<Value*> &IdxList);
+ Value* const *Idxs, unsigned NumIdxs);
static Constant *getExtractElementTy(const Type *Ty, Constant *Val,
Constant *Idx);
static Constant *getInsertElementTy(const Type *Ty, Constant *Val,
@@ -577,10 +577,18 @@ public:
/// all elements must be Constant's.
///
static Constant *getGetElementPtr(Constant *C,
- const std::vector<Constant*> &IdxList);
+ Constant* const *IdxList, unsigned NumIdx);
static Constant *getGetElementPtr(Constant *C,
- const std::vector<Value*> &IdxList);
-
+ Value* const *IdxList, unsigned NumIdx);
+ static Constant *getGetElementPtr(Constant *C,
+ const std::vector<Constant*> &IdxList) {
+ return getGetElementPtr(C, &IdxList[0], IdxList.size());
+ }
+ static Constant *getGetElementPtr(Constant *C,
+ const std::vector<Value*> &IdxList) {
+ return getGetElementPtr(C, &IdxList[0], IdxList.size());
+ }
+
static Constant *getExtractElement(Constant *Vec, Constant *Idx);
static Constant *getInsertElement(Constant *Vec, Constant *Elt,Constant *Idx);
static Constant *getShuffleVector(Constant *V1, Constant *V2, Constant *Mask);
diff --git a/llvm/include/llvm/Instructions.h b/llvm/include/llvm/Instructions.h
index 3a88b990749..99ed63ba6d3 100644
--- a/llvm/include/llvm/Instructions.h
+++ b/llvm/include/llvm/Instructions.h
@@ -348,7 +348,11 @@ public:
const std::string &Name = "", Instruction *InsertBefore =0);
GetElementPtrInst(Value *Ptr, const std::vector<Value*> &Idx,
const std::string &Name, BasicBlock *InsertAtEnd);
-
+ GetElementPtrInst(Value *Ptr, Value* const *Idx, unsigned NumIdx,
+ const std::string &Name = "", Instruction *InsertBefore =0);
+ GetElementPtrInst(Value *Ptr, Value* const *Idx, unsigned NumIdx,
+ const std::string &Name, BasicBlock *InsertAtEnd);
+
/// Constructors - These two constructors are convenience methods because one
/// and two index getelementptr instructions are so common.
GetElementPtrInst(Value *Ptr, Value *Idx,
@@ -375,8 +379,14 @@ public:
/// pointer type.
///
static const Type *getIndexedType(const Type *Ptr,
- const std::vector<Value*> &Indices,
+ Value* const *Idx, unsigned NumIdx,
bool AllowStructLeaf = false);
+
+ static const Type *getIndexedType(const Type *Ptr,
+ const std::vector<Value*> &Indices,
+ bool AllowStructLeaf = false) {
+ return getIndexedType(Ptr, &Indices[0], Indices.size(), AllowStructLeaf);
+ }
static const Type *getIndexedType(const Type *Ptr, Value *Idx0, Value *Idx1,
bool AllowStructLeaf = false);
static const Type *getIndexedType(const Type *Ptr, Value *Idx);
OpenPOWER on IntegriCloud