aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Instructions.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-01-31 04:40:28 +0000
committerChris Lattner <sabre@nondot.org>2007-01-31 04:40:28 +0000
commit2b9a5daf7c4dc39b46662a69e95e610e7b2cd4ba (patch)
tree9aa775133e8694e0f2a1d5da1620016b20d3bca8 /lib/VMCore/Instructions.cpp
parentfb11053815ee4b3c6593c12aff06fefea96d7d0a (diff)
downloadexternal_llvm-2b9a5daf7c4dc39b46662a69e95e610e7b2cd4ba.zip
external_llvm-2b9a5daf7c4dc39b46662a69e95e610e7b2cd4ba.tar.gz
external_llvm-2b9a5daf7c4dc39b46662a69e95e610e7b2cd4ba.tar.bz2
Revise APIs for creating constantexpr GEPs to not require the use of vectors.
This allows us to eliminate many temporary vectors, and theirassociated malloc/free pairs. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33692 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r--lib/VMCore/Instructions.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index f996ab8..ccd25de 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -765,12 +765,13 @@ GetElementPtrInst::~GetElementPtrInst() {
// pointer type.
//
const Type* GetElementPtrInst::getIndexedType(const Type *Ptr,
- const std::vector<Value*> &Idx,
+ Value* const *Idxs,
+ unsigned NumIdx,
bool AllowCompositeLeaf) {
if (!isa<PointerType>(Ptr)) return 0; // Type isn't a pointer type!
// Handle the special case of the empty set index set...
- if (Idx.empty())
+ if (NumIdx == 0)
if (AllowCompositeLeaf ||
cast<PointerType>(Ptr)->getElementType()->isFirstClassType())
return cast<PointerType>(Ptr)->getElementType();
@@ -779,12 +780,12 @@ const Type* GetElementPtrInst::getIndexedType(const Type *Ptr,
unsigned CurIdx = 0;
while (const CompositeType *CT = dyn_cast<CompositeType>(Ptr)) {
- if (Idx.size() == CurIdx) {
+ if (NumIdx == CurIdx) {
if (AllowCompositeLeaf || CT->isFirstClassType()) return Ptr;
return 0; // Can't load a whole structure or array!?!?
}
- Value *Index = Idx[CurIdx++];
+ Value *Index = Idxs[CurIdx++];
if (isa<PointerType>(CT) && CurIdx != 1)
return 0; // Can only index into pointer types at the first index!
if (!CT->indexValid(Index)) return 0;
@@ -798,7 +799,7 @@ const Type* GetElementPtrInst::getIndexedType(const Type *Ptr,
Ptr = Ty;
}
}
- return CurIdx == Idx.size() ? Ptr : 0;
+ return CurIdx == NumIdx ? Ptr : 0;
}
const Type* GetElementPtrInst::getIndexedType(const Type *Ptr,