| Index: src/IceTypes.cpp
|
| diff --git a/src/IceTypes.cpp b/src/IceTypes.cpp
|
| index 84cf410fe8c6aaf182d5d282095a4b7229593c11..515be2d667aee80b3d70d6e295704958bec07961 100644
|
| --- a/src/IceTypes.cpp
|
| +++ b/src/IceTypes.cpp
|
| @@ -21,10 +21,12 @@ namespace {
|
| const struct {
|
| size_t TypeWidthInBytes;
|
| size_t TypeAlignInBytes;
|
| + size_t TypeNumElements;
|
| + Type TypeElementType;
|
| const char *DisplayString;
|
| } TypeAttributes[] = {
|
| -#define X(tag, size, align, str) \
|
| - { size, align, str } \
|
| +#define X(tag, size, align, elts, elty, str) \
|
| + { size, align, elts, elty, str } \
|
| ,
|
| ICETYPE_TABLE
|
| #undef X
|
| @@ -57,6 +59,28 @@ size_t typeAlignInBytes(Type Ty) {
|
| return Align;
|
| }
|
|
|
| +size_t typeNumElements(Type Ty) {
|
| + size_t NumElements = 0;
|
| + size_t Index = static_cast<size_t>(Ty);
|
| + if (Index < TypeAttributesSize) {
|
| + NumElements = TypeAttributes[Index].TypeNumElements;
|
| + } else {
|
| + llvm_unreachable("Invalid type for typeNumElements()");
|
| + }
|
| + return NumElements;
|
| +}
|
| +
|
| +Type typeElementType(Type Ty) {
|
| + Type ElementType = IceType_void;
|
| + size_t Index = static_cast<size_t>(Ty);
|
| + if (Index < TypeAttributesSize) {
|
| + ElementType = TypeAttributes[Index].TypeElementType;
|
| + } else {
|
| + llvm_unreachable("Invalid type for typeElementType()");
|
| + }
|
| + return ElementType;
|
| +}
|
| +
|
| // ======================== Dump routines ======================== //
|
|
|
| template <> Ostream &operator<<(Ostream &Str, const Type &Ty) {
|
|
|