implement the new GEP instruction ctors.
authorChris Lattner <sabre@nondot.org>
Wed, 31 Jan 2007 19:47:18 +0000 (19:47 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 31 Jan 2007 19:47:18 +0000 (19:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33708 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Instructions.h
lib/VMCore/Instructions.cpp

index 99ed63ba6d378bdc9a434ffa02ca4ff6a2854133..7812cdb59139c86a2c1d2d990271641949151de4 100644 (file)
@@ -336,7 +336,7 @@ class GetElementPtrInst : public Instruction {
     for (unsigned i = 0, E = NumOperands; i != E; ++i)
       OL[i].init(GEPIOL[i], this);
   }
-  void init(Value *Ptr, const std::vector<Value*> &Idx);
+  void init(Value *Ptr, Value* const *Idx, unsigned NumIdx);
   void init(Value *Ptr, Value *Idx0, Value *Idx1);
   void init(Value *Ptr, Value *Idx);
 public:
index ccd25de022fc71ae9d1907c8c59e16974f4d0724..d830dfd685faecc0824f9653e89a3a3177a6fbd3 100644 (file)
@@ -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,