On Thu, 16 Oct 2014, Sebastian Pop wrote:
> Richard Biener wrote:
> > To give you an example how it looks like, the following code is
> > generated for
> >
> > /* fold_negate_exprs convert - (~A) to A + 1. */
> > (simplify
> > (negate (bit_not @0))
> > (if (INTEGRAL_TYPE_P (type))
> > (plus @0 { build_int_cst (TREE_TYPE (@0), 1); } )))
> >
> > tree
> > generic_simplify (enum tree_code code, tree type ATTRIBUTE_UNUSED, tree op0)
>
> I wonder why ATTRIBUTE_UNUSED is generated for used parameters.
I've added them for the initial patch set because without any patterns
defined (just 1/n and 2/n) only one of the parameters will be used.
Consider them removed again once we have enough patterns to make
bootstrap happy after that.
> > {
> > if ((op0 && TREE_SIDE_EFFECTS (op0)))
> > return NULL_TREE;
> > switch (code)
> > {
> > ...
> > case NEGATE_EXPR:
> > {
> > switch (TREE_CODE (op0))
> > {
> > case BIT_NOT_EXPR:
> > {
> > tree o20 = TREE_OPERAND (op0, 0);
> > {
> > /* #line 136
> > "/space/rguenther/src/svn/match-and-simplify/gcc/match.pd" */
> > tree captures[2] ATTRIBUTE_UNUSED = {};
>
> Same here.
> Also, why do we allocate two elements when only captures[0] is used?
Good question - I'll have a look.
Thanks,
Richard.
> > captures[0] = o20;
> > /* #line 135
> > "/space/rguenther/src/svn/match-and-simplify/gcc/match.pd" */
> > if (INTEGRAL_TYPE_P (type))
> > {
> > if (dump_file && (dump_flags & TDF_DETAILS)) fprintf
> > (dump_file, "Applying pattern match.pd:136, %s:%d\n", __FILE__, __LINE__);
> > tree res_op0;
> > res_op0 = captures[0];
> > tree res_op1;
> > res_op1 = build_int_cst (TREE_TYPE (captures[0]), 1);
> > return fold_build2 (PLUS_EXPR, type, res_op0,
> > res_op1);
> > }
> > }
> > break;
> > }
> > ...
>
>
--
Richard Biener <[email protected]>
SUSE / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imend"orffer