summaryrefslogtreecommitdiff
path: root/gcc/genpreds.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2006-10-04 16:41:55 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2006-10-04 16:41:55 +0000
commit5e156a9d1c973b5b20f20cba2743907270acdbd0 (patch)
tree20a2dfcb81e007f92b06951185a8557d56dfb9bb /gcc/genpreds.c
parent1047bab7432374044b6da3b47ebb310bc7f0d1a1 (diff)
downloadgcc-5e156a9d1c973b5b20f20cba2743907270acdbd0.tar.gz
Fix bug in constraint-check generator, reported by Rask Ingemann
Lambertsen: * genpreds.c (add_constraint): Don't remove anything from the expression here. (write_tm_constrs_h): Detect whether "op" argument is used, and mark it ARG_UNUSED if it isn't. (write_insn_const_int_ok_for_constraint): Skip the part of the expression that would test whether "op" (which is not available here) is a CONST_INT. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117433 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genpreds.c')
-rw-r--r--gcc/genpreds.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/genpreds.c b/gcc/genpreds.c
index adc3e48372b..535c9ddde77 100644
--- a/gcc/genpreds.c
+++ b/gcc/genpreds.c
@@ -891,10 +891,6 @@ add_constraint (const char *name, const char *regclass,
have_error = 1;
return;
}
-
- /* Remove the redundant (and (match_code "const_(int|double)")
- from the expression. */
- exp = XEXP (exp, 1);
}
@@ -1078,10 +1074,13 @@ write_tm_constrs_h (void)
bool needs_rval = needs_variable (c->exp, "rval");
bool needs_mode = (needs_variable (c->exp, "mode")
|| needs_hval || needs_lval || needs_rval);
+ bool needs_op = (needs_variable (c->exp, "op")
+ || needs_ival || needs_mode);
printf ("static inline bool\n"
- "satisfies_constraint_%s (rtx op)\n"
- "{\n", c->c_name);
+ "satisfies_constraint_%s (rtx %s)\n"
+ "{\n", c->c_name,
+ needs_op ? "op" : "ARG_UNUSED (op)");
if (needs_mode)
puts ("enum machine_mode mode = GET_MODE (op);");
if (needs_ival)
@@ -1157,7 +1156,10 @@ write_insn_const_int_ok_for_constraint (void)
if (c->is_const_int)
{
printf (" case CONSTRAINT_%s:\n return ", c->c_name);
- write_predicate_expr (c->exp);
+ /* c->exp is guaranteed to be (and (match_code "const_int") (...));
+ we know at this point that we have a const_int, so we need not
+ bother with that part of the test. */
+ write_predicate_expr (XEXP (c->exp, 1));
fputs (";\n\n", stdout);
}