Add icmp and fcmp instructions to Subzero bitcode reader.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3894
R=jvoung@chromium.org, stichnot@chromium.org
Review URL: https://codereview.chromium.org/543793003
diff --git a/src/IceTypes.cpp b/src/IceTypes.cpp
index 21157d0..3a5b80a 100644
--- a/src/IceTypes.cpp
+++ b/src/IceTypes.cpp
@@ -33,7 +33,8 @@
};
// 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 @@
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, CompareResult) \
STATIC_ASSERT((unsigned)_table_tag_##tag == (unsigned)_props_table_tag_##tag);
ICETYPE_PROPS_TABLE;
#undef X
@@ -61,13 +62,13 @@
};
// 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 @@
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 @@
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) {