[llvm-commits] CVS: llvm/lib/VMCore/Instructions.cpp
Chris Lattner
sabre at nondot.org
Wed Jan 31 11:47:38 PST 2007
Changes in directory llvm/lib/VMCore:
Instructions.cpp updated: 1.67 -> 1.68
---
Log message:
implement the new GEP instruction ctors.
---
Diffs of the changes: (+23 -5)
Instructions.cpp | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
Index: llvm/lib/VMCore/Instructions.cpp
diff -u llvm/lib/VMCore/Instructions.cpp:1.67 llvm/lib/VMCore/Instructions.cpp:1.68
--- llvm/lib/VMCore/Instructions.cpp:1.67 Tue Jan 30 22:40:28 2007
+++ llvm/lib/VMCore/Instructions.cpp Wed Jan 31 13:47:18 2007
@@ -684,12 +684,12 @@
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 @@
: 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 @@
: 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,
More information about the llvm-commits
mailing list