[PATCH] Generate switch statements in genpreds.c
Richard Earnshaw
Richard.Earnshaw@buzzard.freeserve.co.uk
Thu Jun 29 01:13:00 GMT 2006
> 2006-06-27 Roger Sayle <roger@eyesopen.com>
> * genpreds.c (generate_switch_p): New function.
> (add_mode_tests): Push the new mode test down inside an AND expr
> if this allows the switch-suitable MATCH_CODE to be near the root.
> (write_match_code_switch): New function to write a MATCH_CODE as
> a switch statement.
> (write_predicate_stmts): New function to write a predicate RTX
> expression as a sequence of statements.
> (write_one_predicate_function): Use write_predicate_stmts.
> (write_tm_constrs_h): Likewise.
Unfortunately, on an ARM-eabi cross:
(define_predicate "di_operand"
(ior (match_code "const_int,const_double")
(and (match_code "reg,subreg,mem")
(match_operand 0 "nonimmediate_di_operand"))))
is now compiled to:
di_operand (rtx op, enum machine_mode mode ATTRIBUTE_UNUSED)
{
switch (GET_CODE (op))
{
case CONST_INT:
case CONST_DOUBLE:
return true;
default:
break;
}
switch (GET_CODE (op))
{
case REG:
case SUBREG:
case MEM:
return false;
default:
break;
}
return true;
}
Which is not a correct expansion of the logic of the predicate... What
happened to the call to nonimmediate_di_operand? And why does it return
true if op is not one of CONST_INT, CONST_DOUBLE, REG, SUBREG or MEM?
R.
More information about the Gcc-patches
mailing list