aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Instructions.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-01-31 19:47:18 +0000
committerChris Lattner <sabre@nondot.org>2007-01-31 19:47:18 +0000
commit6ffbe17b3c7934dd97bbbd97c77526727b7ac5d7 (patch)
tree3bf42b223afbdcea7f4a17aeee005d3e13e838b3 /lib/VMCore/Instructions.cpp
parenta9b8b8d62c67e96bc4dc2ed25298c539102f8638 (diff)
downloadexternal_llvm-6ffbe17b3c7934dd97bbbd97c77526727b7ac5d7.zip
external_llvm-6ffbe17b3c7934dd97bbbd97c77526727b7ac5d7.tar.gz
external_llvm-6ffbe17b3c7934dd97bbbd97c77526727b7ac5d7.tar.bz2
implement the new GEP instruction ctors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33708 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r--lib/VMCore/Instructions.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index ccd25de..d830dfd 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/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,