[llvm-commits] CVS: llvm/lib/Target/TargetData.cpp
Chris Lattner
sabre at nondot.org
Sat Feb 10 11:33:35 PST 2007
Changes in directory llvm/lib/Target:
TargetData.cpp updated: 1.85 -> 1.86
---
Log message:
Change TargetData::getIndexedOffset interface to not require indices
in a vector.
---
Diffs of the changes: (+8 -8)
TargetData.cpp | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
Index: llvm/lib/Target/TargetData.cpp
diff -u llvm/lib/Target/TargetData.cpp:1.85 llvm/lib/Target/TargetData.cpp:1.86
--- llvm/lib/Target/TargetData.cpp:1.85 Mon Feb 5 17:51:43 2007
+++ llvm/lib/Target/TargetData.cpp Sat Feb 10 13:33:15 2007
@@ -452,18 +452,18 @@
}
-uint64_t TargetData::getIndexedOffset(const Type *ptrTy,
- const std::vector<Value*> &Idx) const {
+uint64_t TargetData::getIndexedOffset(const Type *ptrTy, Value* const* Indices,
+ unsigned NumIndices) const {
const Type *Ty = ptrTy;
assert(isa<PointerType>(Ty) && "Illegal argument for getIndexedOffset()");
uint64_t Result = 0;
- generic_gep_type_iterator<std::vector<Value*>::const_iterator>
- TI = gep_type_begin(ptrTy, Idx.begin(), Idx.end());
- for (unsigned CurIDX = 0; CurIDX != Idx.size(); ++CurIDX, ++TI) {
+ generic_gep_type_iterator<Value* const*>
+ TI = gep_type_begin(ptrTy, Indices, Indices+NumIndices);
+ for (unsigned CurIDX = 0; CurIDX != NumIndices; ++CurIDX, ++TI) {
if (const StructType *STy = dyn_cast<StructType>(*TI)) {
- assert(Idx[CurIDX]->getType() == Type::Int32Ty && "Illegal struct idx");
- unsigned FieldNo = cast<ConstantInt>(Idx[CurIDX])->getZExtValue();
+ assert(Indices[CurIDX]->getType() == Type::Int32Ty &&"Illegal struct idx");
+ unsigned FieldNo = cast<ConstantInt>(Indices[CurIDX])->getZExtValue();
// Get structure layout information...
const StructLayout *Layout = getStructLayout(STy);
@@ -479,7 +479,7 @@
Ty = cast<SequentialType>(Ty)->getElementType();
// Get the array index and the size of each array element.
- int64_t arrayIdx = cast<ConstantInt>(Idx[CurIDX])->getSExtValue();
+ int64_t arrayIdx = cast<ConstantInt>(Indices[CurIDX])->getSExtValue();
Result += arrayIdx * (int64_t)getTypeSize(Ty);
}
}
More information about the llvm-commits
mailing list