mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Handle targets where alignment can be bigger than the size of the data.
Contributed by Vladimir Prus! llvm-svn: 14534
This commit is contained in:
parent
1794ab7d26
commit
3fd0ea69f6
@ -168,19 +168,19 @@ static inline void getTypeInfo(const Type *Ty, const TargetData *TD,
|
||||
Size = TD->getPointerSize(); Alignment = TD->getPointerAlignment();
|
||||
return;
|
||||
case Type::ArrayTyID: {
|
||||
const ArrayType *ATy = (const ArrayType *)Ty;
|
||||
const ArrayType *ATy = cast<ArrayType>(Ty);
|
||||
unsigned AlignedSize = (Size + Alignment - 1)/Alignment*Alignment;
|
||||
getTypeInfo(ATy->getElementType(), TD, Size, Alignment);
|
||||
Size *= ATy->getNumElements();
|
||||
Size = AlignedSize*ATy->getNumElements();
|
||||
return;
|
||||
}
|
||||
case Type::StructTyID: {
|
||||
// Get the layout annotation... which is lazily created on demand.
|
||||
const StructLayout *Layout = TD->getStructLayout((const StructType*)Ty);
|
||||
const StructLayout *Layout = TD->getStructLayout(cast<StructType>(Ty));
|
||||
Size = Layout->StructSize; Alignment = Layout->StructAlignment;
|
||||
return;
|
||||
}
|
||||
|
||||
case Type::TypeTyID:
|
||||
default:
|
||||
assert(0 && "Bad type for getTypeInfo!!!");
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user