mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6535 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2e33430a0d
commit
4954f04914
@ -195,10 +195,10 @@ uint64_t TargetData::getIndexedOffset(const Type *ptrTy,
|
|||||||
// Get the array index and the size of each array element.
|
// Get the array index and the size of each array element.
|
||||||
// Both must be known constants, or the index shd be 0; else this fails.
|
// Both must be known constants, or the index shd be 0; else this fails.
|
||||||
int64_t arrayIdx = cast<ConstantSInt>(Idx[CurIDX])->getValue();
|
int64_t arrayIdx = cast<ConstantSInt>(Idx[CurIDX])->getValue();
|
||||||
Result += arrayIdx == 0? 0
|
Result += arrayIdx * (int64_t)getTypeSize(Ty);
|
||||||
: (uint64_t) (arrayIdx * (int64_t) getTypeSize(Ty));
|
|
||||||
|
|
||||||
} else if (const StructType *STy = dyn_cast<const StructType>(Ty)) {
|
} else {
|
||||||
|
const StructType *STy = cast<StructType>(Ty);
|
||||||
assert(Idx[CurIDX]->getType() == Type::UByteTy && "Illegal struct idx");
|
assert(Idx[CurIDX]->getType() == Type::UByteTy && "Illegal struct idx");
|
||||||
unsigned FieldNo = cast<ConstantUInt>(Idx[CurIDX])->getValue();
|
unsigned FieldNo = cast<ConstantUInt>(Idx[CurIDX])->getValue();
|
||||||
|
|
||||||
@ -211,9 +211,6 @@ uint64_t TargetData::getIndexedOffset(const Type *ptrTy,
|
|||||||
|
|
||||||
// Update Ty to refer to current element
|
// Update Ty to refer to current element
|
||||||
Ty = STy->getElementTypes()[FieldNo];
|
Ty = STy->getElementTypes()[FieldNo];
|
||||||
} else {
|
|
||||||
assert(0 && "Indexing type that is not struct or array?");
|
|
||||||
return 0; // Load directly through ptr
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user