Index: src/IceTypes.cpp |
diff --git a/src/IceTypes.cpp b/src/IceTypes.cpp |
index 515be2d667aee80b3d70d6e295704958bec07961..5fb57565a7a2fe94155954972b5905f04e481084 100644 |
--- a/src/IceTypes.cpp |
+++ b/src/IceTypes.cpp |
@@ -24,9 +24,10 @@ const struct { |
size_t TypeNumElements; |
Type TypeElementType; |
const char *DisplayString; |
+ uint32_t TypeFlags; |
} TypeAttributes[] = { |
-#define X(tag, size, align, elts, elty, str) \ |
- { size, align, elts, elty, str } \ |
+#define X(tag, size, align, elts, elty, str, flags) \ |
+ { size, align, elts, elty, str, flags } \ |
, |
ICETYPE_TABLE |
#undef X |
@@ -81,9 +82,23 @@ Type typeElementType(Type Ty) { |
return ElementType; |
} |
+bool isIntegerType(Type Ty) { |
+ size_t Index = static_cast<size_t>(Ty); |
+ if (Index < TypeAttributesSize) |
+ return TypeAttributes[Index].TypeFlags == TypeFlagIsInteger; |
+ llvm_unreachable("Invalid type for typeIsInteger()"); |
+} |
+ |
+bool isFloatingType(Type Ty) { |
+ size_t Index = static_cast<size_t>(Ty); |
+ if (Index < TypeAttributesSize) |
+ return TypeAttributes[Index].TypeFlags == TypeFlagIsFloating; |
+ llvm_unreachable("Invalid type for typeIsFloating()"); |
+} |
+ |
// ======================== Dump routines ======================== // |
-template <> Ostream &operator<<(Ostream &Str, const Type &Ty) { |
+Ostream &operator<<(Ostream &Str, const Type &Ty) { |
size_t Index = static_cast<size_t>(Ty); |
if (Index < TypeAttributesSize) { |
Str << TypeAttributes[Index].DisplayString; |