[llvm-commits] CVS: llvm/include/llvm/Constants.h Instructions.h
Chris Lattner
sabre at nondot.org
Tue Jan 30 20:39:45 PST 2007
Changes in directory llvm/include/llvm:
Constants.h updated: 1.121 -> 1.122
Instructions.h updated: 1.50 -> 1.51
---
Log message:
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.
---
Diffs of the changes: (+24 -6)
Constants.h | 16 ++++++++++++----
Instructions.h | 14 ++++++++++++--
2 files changed, 24 insertions(+), 6 deletions(-)
Index: llvm/include/llvm/Constants.h
diff -u llvm/include/llvm/Constants.h:1.121 llvm/include/llvm/Constants.h:1.122
--- llvm/include/llvm/Constants.h:1.121 Sat Jan 20 18:29:25 2007
+++ llvm/include/llvm/Constants.h Tue Jan 30 22:39:29 2007
@@ -447,7 +447,7 @@
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 @@
/// 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);
Index: llvm/include/llvm/Instructions.h
diff -u llvm/include/llvm/Instructions.h:1.50 llvm/include/llvm/Instructions.h:1.51
--- llvm/include/llvm/Instructions.h:1.50 Sun Jan 14 13:41:24 2007
+++ llvm/include/llvm/Instructions.h Tue Jan 30 22:39:29 2007
@@ -348,7 +348,11 @@
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 @@
/// 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);
More information about the llvm-commits
mailing list