-
- return (getTypeSizeInBits(Ty)+7)/8;
-}
-
-/// getTypeAllocSize - Return the offset in bytes between successive objects
-/// of the specified type, including alignment padding. This is the amount
-/// that alloca reserves for this type. For example, returns 12 or 16 for
-/// x86_fp80, depending on alignment.
-uint64_t TargetData::getTypeAllocSize(const Type* Ty) const {
- // Arrays and vectors are allocated as sequences of elements.
- // Note that this means that things like vectors-of-i1 are not bit-packed
- // in memory (except on a hypothetical bit-addressable machine). If
- // someone builds hardware with native vector-of-i1 stores and the idiom
- // of bitcasting vectors to integers in order to bitpack them for storage
- // isn't sufficient, TargetData may need new "size" concept.
- if (const ArrayType *ATy = dyn_cast<ArrayType>(Ty))
- return getTypeAllocSize(ATy->getElementType()) * ATy->getNumElements();
- if (const VectorType *VTy = dyn_cast<VectorType>(Ty))
- return getTypeAllocSize(VTy->getElementType()) * VTy->getNumElements();
-
- // Round up to the next alignment boundary.
- return RoundUpAlignment(getTypeStoreSize(Ty), getABITypeAlignment(Ty));