#include "alloc-pool.h"
#include "dominance.h"
-static const char *kind_string[VREL_LAST] =
+static const char *const kind_string[VREL_LAST] =
{ "varying", "undefined", "<", "<=", ">", ">=", "==", "!=", "pe8", "pe16",
"pe32", "pe64" };
}
// This table is used to negate the operands. op1 REL op2 -> !(op1 REL op2).
-relation_kind rr_negate_table[VREL_LAST] = {
+static const unsigned char rr_negate_table[VREL_LAST] = {
VREL_VARYING, VREL_UNDEFINED, VREL_GE, VREL_GT, VREL_LE, VREL_LT, VREL_NE,
VREL_EQ };
relation_kind
relation_negate (relation_kind r)
{
- return rr_negate_table [r];
+ return relation_kind (rr_negate_table [r]);
}
// This table is used to swap the operands. op1 REL op2 -> op2 REL op1.
-relation_kind rr_swap_table[VREL_LAST] = {
+static const unsigned char rr_swap_table[VREL_LAST] = {
VREL_VARYING, VREL_UNDEFINED, VREL_GT, VREL_GE, VREL_LT, VREL_LE, VREL_EQ,
VREL_NE };
relation_kind
relation_swap (relation_kind r)
{
- return rr_swap_table [r];
+ return relation_kind (rr_swap_table [r]);
}
// This table is used to perform an intersection between 2 relations.
-relation_kind rr_intersect_table[VREL_LAST][VREL_LAST] = {
+static const unsigned char rr_intersect_table[VREL_LAST][VREL_LAST] = {
// VREL_VARYING
{ VREL_VARYING, VREL_UNDEFINED, VREL_LT, VREL_LE, VREL_GT, VREL_GE, VREL_EQ,
VREL_NE },
relation_kind
relation_intersect (relation_kind r1, relation_kind r2)
{
- return rr_intersect_table[r1][r2];
+ return relation_kind (rr_intersect_table[r1][r2]);
}
// This table is used to perform a union between 2 relations.
-relation_kind rr_union_table[VREL_LAST][VREL_LAST] = {
+static const unsigned char rr_union_table[VREL_LAST][VREL_LAST] = {
// VREL_VARYING
{ VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING,
VREL_VARYING, VREL_VARYING, VREL_VARYING },
relation_kind
relation_union (relation_kind r1, relation_kind r2)
{
- return rr_union_table[r1][r2];
+ return relation_kind (rr_union_table[r1][r2]);
}
// This table is used to determine transitivity between 2 relations.
// (A relation0 B) and (B relation1 C) implies (A result C)
-relation_kind rr_transitive_table[VREL_LAST][VREL_LAST] = {
+static const unsigned char rr_transitive_table[VREL_LAST][VREL_LAST] = {
// VREL_VARYING
{ VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING, VREL_VARYING,
VREL_VARYING, VREL_VARYING, VREL_VARYING },
relation_kind
relation_transitive (relation_kind r1, relation_kind r2)
{
- return rr_transitive_table[r1][r2];
+ return relation_kind (rr_transitive_table[r1][r2]);
}
// This vector maps a relation to the equivalent tree code.
-tree_code relation_to_code [VREL_LAST] = {
+static const tree_code relation_to_code [VREL_LAST] = {
ERROR_MARK, ERROR_MARK, LT_EXPR, LE_EXPR, GT_EXPR, GE_EXPR, EQ_EXPR,
NE_EXPR };
void
relation_tests ()
{
+ // rr_*_table tables use unsigned char rather than relation_kind.
+ ASSERT_LT (VREL_LAST, UCHAR_MAX);
// Verify commutativity of relation_intersect and relation_union.
for (relation_kind r1 = VREL_VARYING; r1 < VREL_PE8;
r1 = relation_kind (r1 + 1))