summaryrefslogtreecommitdiff
path: root/gcc/genconditions.c
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@redhat.com>2005-03-04 11:10:35 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2005-03-04 11:10:35 +0000
commit7445392c29b2b16391e41bee61cfbe32d492ddf5 (patch)
tree023da1eca2bd7656ce3641b1d6d446908d801399 /gcc/genconditions.c
parent935167332d4ee2b0bb173e40a6cf36db53b67d16 (diff)
* rtl.h (copy_rtx_ptr_loc, print_rtx_ptr_loc, join_c_conditions)
(print_c_condition): Declare. * read-rtl.c (ptr_loc): New structure. (ptr_locs, ptr_loc_obstack, joined_conditions) (joined_conditions_obstack): New variables. (leading_ptr_hash, leading_ptr_eq_p, set_rtx_ptr_loc) (get_rtx_ptr_loc, copy_rtx_ptr_loc, print_rtx_ptr_loc) (join_c_conditions, print_c_condition): New functions. (apply_macro_to_string): Associate the new string with the same source location as the old one. (add_condition_to_string): Use join_c_conditions. (read_string): Use set_rtx_ptr_loc to record a filename and line number for the string. (read_rtx): Initialize the new variables above. * genattrtab.c (write_test_expr, write_attr_value): Use print_c_condition. * genconditions.c (write_header): Don't define MAYBE_EVAL. Move its comment above the GCC_VERSION check. (write_one_condition): Use print_rtx_ptr_loc and print_c_condition. Inline the definition of MAYBE_EVAL. * genemit.c (gen_expand, gen_split): Use print_rtx_ptr_loc. * genoutput.c (process_template): Likewise. * genpreds.c (write_predicate_subfunction): Likewise. (write_predicate_expr): Use print_c_condition. * genrecog.c (write_cond): Likewise. * gensupport.c (process_rtx): Use join_c_conditions to join the conditions of a define_insn_and_split. Record a source location for the string after the "&&". (alter_test_for_insn): Use join_c_conditions. From-SVN: r95883
Diffstat (limited to 'gcc/genconditions.c')
-rw-r--r--gcc/genconditions.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/gcc/genconditions.c b/gcc/genconditions.c
index b9ef6ab087d..4630f156373 100644
--- a/gcc/genconditions.c
+++ b/gcc/genconditions.c
@@ -86,6 +86,10 @@ write_header (void)
puts ("\
#include \"system.h\"\n\
+/* If we don't have __builtin_constant_p, or it's not acceptable in array\n\
+ initializers, fall back to assuming that all conditions potentially\n\
+ vary at run time. It works in 3.0.1 and later; 3.0 only when not\n\
+ optimizing. */\n\
#if GCC_VERSION < 3001\n\
#include \"dummy-conditions.c\"\n\
#else\n\
@@ -122,19 +126,15 @@ write_header (void)
extern rtx insn;\n\
extern rtx ins1;\n\
extern rtx operands[];\n");
-
- puts ("\
-/* If we don't have __builtin_constant_p, or it's not acceptable in\n\
- array initializers, fall back (by using dummy-conditions.c above)\n\
- to assuming that all conditions potentially vary at run time. It\n\
- works in 3.0.1 and later; 3.0 only when not optimizing. */\n\
-#define MAYBE_EVAL(expr) (__builtin_constant_p(expr) ? (int) (expr) : -1)\n");
}
/* Write out one entry in the conditions table, using the data pointed
to by SLOT. Each entry looks like this:
- { "! optimize_size && ! TARGET_READ_MODIFY_WRITE",
- MAYBE_EVAL (! optimize_size && ! TARGET_READ_MODIFY_WRITE) }, */
+
+ { "! optimize_size && ! TARGET_READ_MODIFY_WRITE",
+ __builtin_constant_p (! optimize_size && ! TARGET_READ_MODIFY_WRITE)
+ ? (int) (! optimize_size && ! TARGET_READ_MODIFY_WRITE)
+ : -1) }, */
static int
write_one_condition (void **slot, void * ARG_UNUSED (dummy))
@@ -142,6 +142,7 @@ write_one_condition (void **slot, void * ARG_UNUSED (dummy))
const struct c_test *test = * (const struct c_test **) slot;
const char *p;
+ print_rtx_ptr_loc (test->expr);
fputs (" { \"", stdout);
for (p = test->expr; *p; p++)
{
@@ -153,7 +154,11 @@ write_one_condition (void **slot, void * ARG_UNUSED (dummy))
putchar (*p);
}
- printf ("\",\n MAYBE_EVAL (%s) },\n", test->expr);
+ printf ("\",\n __builtin_constant_p ");
+ print_c_condition (test->expr);
+ printf ("\n ? (int) ");
+ print_c_condition (test->expr);
+ printf ("\n : -1 },\n");
return 1;
}