diff options
author | Chris Lattner <sabre@nondot.org> | 2007-01-31 19:47:18 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-01-31 19:47:18 +0000 |
commit | 79807c3dfeec2128739a1faac88ebe25e1a05520 (patch) | |
tree | 00df712e7ba24e1b2f0e4d078b5f3286541b476c /llvm/lib/VMCore/Instructions.cpp | |
parent | 7169bd87844db1be6ff89abba9245447c90e3b32 (diff) | |
download | bcm5719-llvm-79807c3dfeec2128739a1faac88ebe25e1a05520.tar.gz bcm5719-llvm-79807c3dfeec2128739a1faac88ebe25e1a05520.zip |
implement the new GEP instruction ctors.
llvm-svn: 33708
Diffstat (limited to 'llvm/lib/VMCore/Instructions.cpp')
-rw-r--r-- | llvm/lib/VMCore/Instructions.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/llvm/lib/VMCore/Instructions.cpp b/llvm/lib/VMCore/Instructions.cpp index ccd25de022f..d830dfd685f 100644 --- a/llvm/lib/VMCore/Instructions.cpp +++ b/llvm/lib/VMCore/Instructions.cpp @@ -684,12 +684,12 @@ static inline const Type *checkType(const Type *Ty) { return Ty; } -void GetElementPtrInst::init(Value *Ptr, const std::vector<Value*> &Idx) { - NumOperands = 1+Idx.size(); +void GetElementPtrInst::init(Value *Ptr, Value* const *Idx, unsigned NumIdx) { + NumOperands = 1+NumIdx; Use *OL = OperandList = new Use[NumOperands]; OL[0].init(Ptr, this); - for (unsigned i = 0, e = Idx.size(); i != e; ++i) + for (unsigned i = 0; i != NumIdx; ++i) OL[i+1].init(Idx[i], this); } @@ -713,7 +713,7 @@ GetElementPtrInst::GetElementPtrInst(Value *Ptr, const std::vector<Value*> &Idx, : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(), Idx, true))), GetElementPtr, 0, 0, Name, InBe) { - init(Ptr, Idx); + init(Ptr, &Idx[0], Idx.size()); } GetElementPtrInst::GetElementPtrInst(Value *Ptr, const std::vector<Value*> &Idx, @@ -721,7 +721,25 @@ GetElementPtrInst::GetElementPtrInst(Value *Ptr, const std::vector<Value*> &Idx, : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(), Idx, true))), GetElementPtr, 0, 0, Name, IAE) { - init(Ptr, Idx); + init(Ptr, &Idx[0], Idx.size()); +} + +GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value* const *Idx, + unsigned NumIdx, + const std::string &Name, Instruction *InBe) +: Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(), + Idx, true))), + GetElementPtr, 0, 0, Name, InBe) { + init(Ptr, Idx, NumIdx); +} + +GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value* const *Idx, + unsigned NumIdx, + const std::string &Name, BasicBlock *IAE) +: Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(), + Idx, true))), + GetElementPtr, 0, 0, Name, IAE) { + init(Ptr, Idx, NumIdx); } GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx, |