mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-19 13:38:56 +00:00
Implement a getTypeSizeInBits method. This helps in transforms that want
to ensure the bit size of a type is identical before proceeding. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33413 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2c1ce4f28e
commit
7c29243670
@ -221,6 +221,10 @@ public:
|
|||||||
///
|
///
|
||||||
uint64_t getTypeSize(const Type *Ty) const;
|
uint64_t getTypeSize(const Type *Ty) const;
|
||||||
|
|
||||||
|
/// getTypeSizeInBits - Return the number of bytes necessary to hold the
|
||||||
|
/// specified type.
|
||||||
|
uint64_t getTypeSizeInBits(const Type* Ty) const;
|
||||||
|
|
||||||
/// getTypeAlignmentABI - Return the minimum ABI-required alignment for the
|
/// getTypeAlignmentABI - Return the minimum ABI-required alignment for the
|
||||||
/// specified type.
|
/// specified type.
|
||||||
unsigned char getTypeAlignmentABI(const Type *Ty) const;
|
unsigned char getTypeAlignmentABI(const Type *Ty) const;
|
||||||
|
@ -426,6 +426,16 @@ uint64_t TargetData::getTypeSize(const Type *Ty) const {
|
|||||||
return Size;
|
return Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t TargetData::getTypeSizeInBits(const Type *Ty) const {
|
||||||
|
if (Ty->isInteger())
|
||||||
|
return cast<IntegerType>(Ty)->getBitWidth();
|
||||||
|
|
||||||
|
uint64_t Size;
|
||||||
|
unsigned char Align;
|
||||||
|
getTypeInfoABI(Ty, this, Size, Align);
|
||||||
|
return Size * 8;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned char TargetData::getTypeAlignmentABI(const Type *Ty) const {
|
unsigned char TargetData::getTypeAlignmentABI(const Type *Ty) const {
|
||||||
uint64_t Size;
|
uint64_t Size;
|
||||||
unsigned char Align;
|
unsigned char Align;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user