mirror of git://gcc.gnu.org/git/gcc.git
md.texi: Describe the use of match_tests in attribute tests.
gcc/ * doc/md.texi: Describe the use of match_tests in attribute tests. * rtl.def (MATCH_TEST): Update commentary. * genattrtab.c (attr_copy_rtx, check_attr_test, clear_struct_flag) (write_test_expr, walk_attr_value): Handle MATCH_TEST. From-SVN: r178388
This commit is contained in:
parent
091ace5877
commit
0c0d395770
|
@ -1,3 +1,10 @@
|
||||||
|
2011-08-31 Richard Sandiford <rdsandiford@googlemail.com>
|
||||||
|
|
||||||
|
* doc/md.texi: Describe the use of match_tests in attribute tests.
|
||||||
|
* rtl.def (MATCH_TEST): Update commentary.
|
||||||
|
* genattrtab.c (attr_copy_rtx, check_attr_test, clear_struct_flag)
|
||||||
|
(write_test_expr, walk_attr_value): Handle MATCH_TEST.
|
||||||
|
|
||||||
2011-08-31 Richard Sandiford <rdsandiford@googlemail.com>
|
2011-08-31 Richard Sandiford <rdsandiford@googlemail.com>
|
||||||
|
|
||||||
* genattrtab.c (attr_rtx_1): Hash SYMBOL_REFs.
|
* genattrtab.c (attr_rtx_1): Hash SYMBOL_REFs.
|
||||||
|
|
|
@ -7045,6 +7045,30 @@ string).
|
||||||
|
|
||||||
The @var{constraints} operand is ignored and should be the null string.
|
The @var{constraints} operand is ignored and should be the null string.
|
||||||
|
|
||||||
|
@cindex @code{match_test} and attributes
|
||||||
|
@item (match_test @var{c-expr})
|
||||||
|
The test is true if C expression @var{c-expr} is true. In non-constant
|
||||||
|
attributes, @var{c-expr} has access to the following variables:
|
||||||
|
|
||||||
|
@table @var
|
||||||
|
@item insn
|
||||||
|
The rtl instruction under test.
|
||||||
|
@item which_alternative
|
||||||
|
The @code{define_insn} alternative that @var{insn} matches.
|
||||||
|
@xref{Output Statement}.
|
||||||
|
@item operands
|
||||||
|
An array of @var{insn}'s rtl operands.
|
||||||
|
@end table
|
||||||
|
|
||||||
|
@var{c-expr} behaves like the condition in a C @code{if} statement,
|
||||||
|
so there is no need to explicitly convert the expression into a boolean
|
||||||
|
0 or 1 value. For example, the following two tests are equivalent:
|
||||||
|
|
||||||
|
@smallexample
|
||||||
|
(match_test "x & 2")
|
||||||
|
(match_test "(x & 2) != 0")
|
||||||
|
@end smallexample
|
||||||
|
|
||||||
@cindex @code{le} and attributes
|
@cindex @code{le} and attributes
|
||||||
@cindex @code{leu} and attributes
|
@cindex @code{leu} and attributes
|
||||||
@cindex @code{lt} and attributes
|
@cindex @code{lt} and attributes
|
||||||
|
|
|
@ -658,6 +658,7 @@ attr_copy_rtx (rtx orig)
|
||||||
case CONST_DOUBLE:
|
case CONST_DOUBLE:
|
||||||
case CONST_VECTOR:
|
case CONST_VECTOR:
|
||||||
case SYMBOL_REF:
|
case SYMBOL_REF:
|
||||||
|
case MATCH_TEST:
|
||||||
case CODE_LABEL:
|
case CODE_LABEL:
|
||||||
case PC:
|
case PC:
|
||||||
case CC0:
|
case CC0:
|
||||||
|
@ -841,6 +842,11 @@ check_attr_test (rtx exp, int is_const, int lineno)
|
||||||
XEXP (exp, 0) = check_attr_test (XEXP (exp, 0), is_const, lineno);
|
XEXP (exp, 0) = check_attr_test (XEXP (exp, 0), is_const, lineno);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MATCH_TEST:
|
||||||
|
exp = attr_rtx (MATCH_TEST, XSTR (exp, 0));
|
||||||
|
ATTR_IND_SIMPLIFIED_P (exp) = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
case MATCH_OPERAND:
|
case MATCH_OPERAND:
|
||||||
if (is_const)
|
if (is_const)
|
||||||
fatal ("RTL operator \"%s\" not valid in constant attribute test",
|
fatal ("RTL operator \"%s\" not valid in constant attribute test",
|
||||||
|
@ -2907,6 +2913,7 @@ clear_struct_flag (rtx x)
|
||||||
case CONST_INT:
|
case CONST_INT:
|
||||||
case CONST_DOUBLE:
|
case CONST_DOUBLE:
|
||||||
case CONST_VECTOR:
|
case CONST_VECTOR:
|
||||||
|
case MATCH_TEST:
|
||||||
case SYMBOL_REF:
|
case SYMBOL_REF:
|
||||||
case CODE_LABEL:
|
case CODE_LABEL:
|
||||||
case PC:
|
case PC:
|
||||||
|
@ -3571,6 +3578,12 @@ write_test_expr (rtx exp, unsigned int attrs_cached, int flags)
|
||||||
printf (HOST_WIDE_INT_PRINT_DEC, XWINT (exp, 0));
|
printf (HOST_WIDE_INT_PRINT_DEC, XWINT (exp, 0));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MATCH_TEST:
|
||||||
|
print_c_condition (XSTR (exp, 0));
|
||||||
|
if (flags & FLG_BITWISE)
|
||||||
|
printf (" != 0");
|
||||||
|
break;
|
||||||
|
|
||||||
/* A random C expression. */
|
/* A random C expression. */
|
||||||
case SYMBOL_REF:
|
case SYMBOL_REF:
|
||||||
print_c_condition (XSTR (exp, 0));
|
print_c_condition (XSTR (exp, 0));
|
||||||
|
@ -3765,6 +3778,7 @@ walk_attr_value (rtx exp)
|
||||||
must_extract = 1;
|
must_extract = 1;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case MATCH_TEST:
|
||||||
case EQ_ATTR_ALT:
|
case EQ_ATTR_ALT:
|
||||||
must_extract = must_constrain = 1;
|
must_extract = must_constrain = 1;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -819,9 +819,8 @@ DEF_RTL_EXPR(MATCH_PAR_DUP, "match_par_dup", "iE", RTX_MATCH)
|
||||||
the result of the one before it. */
|
the result of the one before it. */
|
||||||
DEF_RTL_EXPR(MATCH_CODE, "match_code", "ss", RTX_MATCH)
|
DEF_RTL_EXPR(MATCH_CODE, "match_code", "ss", RTX_MATCH)
|
||||||
|
|
||||||
/* Appears only in define_predicate/define_special_predicate
|
/* Used to inject a C conditional expression into an .md file. It can
|
||||||
expressions. The argument is a C expression to be injected at this
|
appear in a predicate definition or an attribute expression. */
|
||||||
point in the predicate formula. */
|
|
||||||
DEF_RTL_EXPR(MATCH_TEST, "match_test", "s", RTX_MATCH)
|
DEF_RTL_EXPR(MATCH_TEST, "match_test", "s", RTX_MATCH)
|
||||||
|
|
||||||
/* Insn (and related) definitions. */
|
/* Insn (and related) definitions. */
|
||||||
|
|
Loading…
Reference in New Issue