Chromium Code Reviews| Index: src/IceTypes.cpp |
| diff --git a/src/IceTypes.cpp b/src/IceTypes.cpp |
| index 21157d09dbc8b9676b42ca846c8816fc60ce7251..245146bbce2996a04b6f15c8953497314a87c33d 100644 |
| --- a/src/IceTypes.cpp |
| +++ b/src/IceTypes.cpp |
| @@ -33,7 +33,8 @@ void __attribute__((unused)) xIceTypeMacroIntegrityCheck() { |
| }; |
| // Define a temporary set of enum values based on ICETYPE_PROPS_TABLE |
| enum { |
| -#define X(tag, IsVec, IsInt, IsFloat, IsIntArith) _props_table_tag_##tag, |
| +#define X(tag, IsVec, IsInt, IsFloat, IsIntArith, CompareResult) \ |
| + _props_table_tag_##tag, |
| ICETYPE_PROPS_TABLE |
| #undef X |
| _enum_props_table_tag_Names |
| @@ -44,7 +45,7 @@ void __attribute__((unused)) xIceTypeMacroIntegrityCheck() { |
| ICETYPE_TABLE; |
| #undef X |
| // Assert that tags in ICETYPE_PROPS_TABLE is in ICETYPE_TABLE. |
| -#define X(tag, IsVec, IsInt, IsFloat, IsIntArith) \ |
| +#define X(tag, IsVec, IsInt, IsFloat, IsIntArith, ComareResult) \ |
|
jvoung (off chromium)
2014/09/04 21:14:39
CompareResult
Karl
2014/09/05 15:31:10
Done.
|
| STATIC_ASSERT((unsigned)_table_tag_##tag == (unsigned)_props_table_tag_##tag); |
| ICETYPE_PROPS_TABLE; |
| #undef X |
| @@ -61,13 +62,13 @@ void __attribute__((unused)) xIceTypeMacroIntegrityCheck() { |
| }; |
| // Define constants for boolean flag if vector in ICETYPE_PROPS_TABLE. |
| enum { |
| -#define X(tag, IsVec, IsInt, IsFloat, IsIntArith) \ |
| - _props_table_IsVec_##tag = IsVec, |
| +#define X(tag, IsVec, IsInt, IsFloat, IsIntArith, CompareResult) \ |
| + _props_table_IsVec_##tag = IsVec, |
| ICETYPE_PROPS_TABLE |
| #undef X |
| }; |
| // Verify that the number of vector elements is consistent with IsVec. |
| -#define X(tag, IsVec, IsInt, IsFloat, IsIntArith) \ |
| +#define X(tag, IsVec, IsInt, IsFloat, IsIntArith, CompareResult) \ |
| STATIC_ASSERT((_table_elts_##tag > 1) == _props_table_IsVec_##tag); |
| ICETYPE_PROPS_TABLE; |
| #undef X |
| @@ -98,13 +99,14 @@ struct TypePropertyFields { |
| bool TypeIsFloatingType; |
| bool TypeIsScalarFloatingType; |
| bool TypeIsVectorFloatingType; |
| + Type CompareResultType; |
| }; |
| const TypePropertyFields TypePropertiesTable[] = { |
| -#define X(tag, IsVec, IsInt, IsFloat, IsIntArith) \ |
| +#define X(tag, IsVec, IsInt, IsFloat, IsIntArith, CompareResult) \ |
| { \ |
| IsVec, IsInt, IsInt && !IsVec, IsInt && IsVec, IsIntArith, IsFloat, \ |
| - IsFloat && !IsVec, IsFloat && IsVec \ |
| + IsFloat && !IsVec, IsFloat && IsVec, CompareResult \ |
| } \ |
| , |
| ICETYPE_PROPS_TABLE |
| @@ -209,6 +211,14 @@ bool isVectorFloatingType(Type Ty) { |
| return false; |
| } |
| +Type getCompareResultType(Type Ty) { |
| + size_t Index = static_cast<size_t>(Ty); |
| + if (Index < IceType_NUM) |
| + return TypePropertiesTable[Index].CompareResultType; |
| + llvm_unreachable("Invalid type for getCompareResultType"); |
| + return IceType_void; |
| +} |
| + |
| // ======================== Dump routines ======================== // |
| const char *typeString(Type Ty) { |