- const StructLayout *Layout = getStructLayout(cast<StructType>(Ty));
- return Layout->getSizeInBytes();
- }
- case Type::IntegerTyID: {
- unsigned BitWidth = cast<IntegerType>(Ty)->getBitWidth();
- if (BitWidth <= 8) {
- return 1;
- } else if (BitWidth <= 16) {
- return 2;
- } else if (BitWidth <= 32) {
- return 4;
- } else if (BitWidth <= 64) {
- return 8;
- } else {
- // The size of this > 64 bit type is chosen as a multiple of the
- // preferred alignment of the largest "native" size the target supports.
- // We first obtain the the alignment info for this type and then compute
- // the next largest multiple of that size.
- uint64_t size = getAlignmentInfo(INTEGER_ALIGN, BitWidth, false) * 8;
- return (((BitWidth / (size)) + (BitWidth % size != 0)) * size) / 8;
- }
- break;
- }
+ return getStructLayout(cast<StructType>(Ty))->getSizeInBits();
+ case Type::IntegerTyID:
+ return cast<IntegerType>(Ty)->getBitWidth();