diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2014-06-11 16:58:25 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2014-06-11 16:58:25 +0000 |
commit | 9e6b7874141cf74a8eb0786d7265296f671feac4 (patch) | |
tree | b562e6d821aa93c3b271699d3affa97e50a6417c | |
parent | 16a26e426bf720dcc95a89b6657fd7b09dda8d6c (diff) | |
download | gcc-9e6b7874141cf74a8eb0786d7265296f671feac4.zip gcc-9e6b7874141cf74a8eb0786d7265296f671feac4.tar.gz gcc-9e6b7874141cf74a8eb0786d7265296f671feac4.tar.bz2 |
genpreds.c (write_constraint_satisfied_p_1): Replace with...
gcc/
* genpreds.c (write_constraint_satisfied_p_1): Replace with...
(write_constraint_satisfied_p_array): ...this new function.
(write_tm_preds_h): Replace write_constraint_satisfied_p_1 with
an array.
(write_insn_preds_c): Update accordingly.
From-SVN: r211470
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/genpreds.c | 37 |
2 files changed, 21 insertions, 24 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0c2e7b4..b8c5b38 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2014-06-11 Richard Sandiford <rdsandiford@googlemail.com> + * genpreds.c (write_constraint_satisfied_p_1): Replace with... + (write_constraint_satisfied_p_array): ...this new function. + (write_tm_preds_h): Replace write_constraint_satisfied_p_1 with + an array. + (write_insn_preds_c): Update accordingly. + +2014-06-11 Richard Sandiford <rdsandiford@googlemail.com> + * genpreds.c (write_lookup_constraint): Rename to... (write_lookup_constraint_1): ...this. (write_lookup_constraint_array): New function. diff --git a/gcc/genpreds.c b/gcc/genpreds.c index 3f52b87..e5ffb38 100644 --- a/gcc/genpreds.c +++ b/gcc/genpreds.c @@ -1166,29 +1166,19 @@ write_tm_constrs_h (void) a CONSTRAINT_xxx constant to one of the predicate functions generated above. */ static void -write_constraint_satisfied_p_1 (void) +write_constraint_satisfied_p_array (void) { - struct constraint_data *c; - if (satisfied_start == num_constraints) return; - puts ("bool\n" - "constraint_satisfied_p_1 (rtx op, enum constraint_num c)\n" - "{\n" - " switch (c)\n" - " {"); - - FOR_ALL_CONSTRAINTS (c) - if (!c->is_register) - printf (" case CONSTRAINT_%s: " - "return satisfies_constraint_%s (op);\n", - c->c_name, c->c_name); - - puts (" default: break;\n" - " }\n" - " return false;\n" - "}\n"); + printf ("bool (*constraint_satisfied_p_array[]) (rtx) = {\n "); + for (unsigned int i = satisfied_start; i < num_constraints; ++i) + { + if (i != satisfied_start) + printf (",\n "); + printf ("satisfies_constraint_%s", enum_order[i]->c_name); + } + printf ("\n};\n\n"); } /* Write out the function which computes whether a given value matches @@ -1293,16 +1283,15 @@ write_tm_preds_h (void) " return false;\n" "}\n"); else - printf ("extern bool constraint_satisfied_p_1 (rtx," - " enum constraint_num);\n" + printf ("extern bool (*constraint_satisfied_p_array[]) (rtx);\n" "\n" "/* Return true if X satisfies constraint C. */\n" "\n" "static inline bool\n" "constraint_satisfied_p (rtx x, enum constraint_num c)\n" "{\n" - " return c >= CONSTRAINT_%s" - " && constraint_satisfied_p_1 (x, c);\n" + " int i = (int) c - (int) CONSTRAINT_%s;\n" + " return i >= 0 && constraint_satisfied_p_array[i] (x);\n" "}\n" "\n", enum_order[satisfied_start]->name); @@ -1425,7 +1414,7 @@ write_insn_preds_c (void) write_lookup_constraint_array (); if (have_register_constraints) write_reg_class_for_constraint_1 (); - write_constraint_satisfied_p_1 (); + write_constraint_satisfied_p_array (); if (have_const_int_constraints) write_insn_const_int_ok_for_constraint (); |