| Index: src/IceTypes.cpp
|
| diff --git a/src/IceTypes.cpp b/src/IceTypes.cpp
|
| index 2099cb904de76ccc74fa8df0c8047d0c9043169e..08b001200e05db88b934bb532c9bcf2cefe4d1ef 100644
|
| --- a/src/IceTypes.cpp
|
| +++ b/src/IceTypes.cpp
|
| @@ -30,7 +30,7 @@ const char *TargetArchName[] = {
|
|
|
| // Define a temporary set of enum values based on ICETYPE_TABLE
|
| enum {
|
| -#define X(tag, size, align, elts, elty, str) _table_tag_##tag,
|
| +#define X(tag, size, sizeLog2, align, elts, elty, str) _table_tag_##tag,
|
| ICETYPE_TABLE
|
| #undef X
|
| _enum_table_tag_Names
|
| @@ -44,7 +44,7 @@ enum {
|
| _enum_props_table_tag_Names
|
| };
|
| // Assert that tags in ICETYPE_TABLE are also in ICETYPE_PROPS_TABLE.
|
| -#define X(tag, size, align, elts, elty, str) \
|
| +#define X(tag, size, sizeLog2, align, elts, elty, str) \
|
| static_assert( \
|
| (unsigned)_table_tag_##tag == (unsigned)_props_table_tag_##tag, \
|
| "Inconsistency between ICETYPE_PROPS_TABLE and ICETYPE_TABLE");
|
| @@ -63,7 +63,7 @@ ICETYPE_PROPS_TABLE
|
|
|
| // Define constants for each element size in ICETYPE_TABLE.
|
| enum {
|
| -#define X(tag, size, align, elts, elty, str) _table_elts_##tag = elts,
|
| +#define X(tag, size, sizeLog2, align, elts, elty, str) _table_elts_##tag = elts,
|
| ICETYPE_TABLE
|
| #undef X
|
| _enum_table_elts_Elements = 0
|
| @@ -84,6 +84,7 @@ ICETYPE_PROPS_TABLE
|
|
|
| struct TypeAttributeFields {
|
| size_t TypeWidthInBytes;
|
| + size_t TypeWidthInBytesLog2;
|
| size_t TypeAlignInBytes;
|
| size_t TypeNumElements;
|
| Type TypeElementType;
|
| @@ -91,8 +92,8 @@ struct TypeAttributeFields {
|
| };
|
|
|
| const struct TypeAttributeFields TypeAttributes[] = {
|
| -#define X(tag, size, align, elts, elty, str) \
|
| - { size, align, elts, elty, str } \
|
| +#define X(tag, size, sizeLog2, align, elts, elty, str) \
|
| + { size, sizeLog2, align, elts, elty, str } \
|
| ,
|
| ICETYPE_TABLE
|
| #undef X
|
| @@ -140,6 +141,14 @@ size_t typeWidthInBytes(Type Ty) {
|
| return 0;
|
| }
|
|
|
| +size_t typeWidthInBytesLog2(Type Ty) {
|
| + size_t Index = static_cast<size_t>(Ty);
|
| + if (Index < IceType_NUM)
|
| + return TypeAttributes[Index].TypeWidthInBytesLog2;
|
| + llvm_unreachable("Invalid type for typeWidthInBytesLog2()");
|
| + return 0;
|
| +}
|
| +
|
| size_t typeAlignInBytes(Type Ty) {
|
| size_t Index = static_cast<size_t>(Ty);
|
| if (Index < IceType_NUM)
|
|
|