[match-and-simplify] support operator list
Richard Biener
richard.guenther@gmail.com
Tue Nov 4 14:32:00 GMT 2014
On Mon, Nov 3, 2014 at 1:56 PM, Prathamesh Kulkarni
<bilbotheelffriend@gmail.com> wrote:
> (had sent it earlier by private mail).
>
> The attached patch supports operator-list and it's use in for.
> For now, operator-list is rejected in expression.
Ok.
> This patch also allows user-defined operator to be used as operator-list
> (user-defined ops are really temporary or "scoped" operator-lists).
> (for op (plus minus)
> op2 (op...)
> (simplify
> ...))
>
> Should that be supported or rejected ?
I've made it supported, but not in the way you implemented it. Instead
I am only expanding operator lists. Thus
(for op (plus minus)
(for op2 (minus op)
...
will iterate (op, op2) (plus, minus) (minus, minus) (plus, plus) (minus, minus).
I think that makes more sense(?) but it's maybe too confusing as well so
eventually we should reject this.
I've adapted the patch slightly, using safe_splice, adding a comment and
avoiding a long line.
I've also used an example operator list in match-builtin.pd instead where
it shows the obvious improvement we're going to implement.
Committed.
Thanks,
Richard.
2014-11-04 Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
* genmatch.c (user_id): Add new member is_oper_list.
(user_id::user_id): Add new default argument.
(parser::parse_operator_list): New function.
(parser::parse_for): Allow operator-list.
(parser::parse_pattern): Call parser::parse_operator_list.
(parser::parse_operation): Reject operator-list.
* match-builtin.pd: Define operator lists POWs, CBRTs and SQRTs.
(gmail is too stupid to attach stuff it seems)
> * genmatch.c
> (user_id): Add new member is_oper_list.
> (user_id::user_id): Add new default argument.
> (parser::parse_operator_list): New function.
> (parser::parse_for): Allow operator-list.
> (parser::parse_pattern): Call parser::parse_operator_list.
> (parser::parse_operation): Reject operator-list.
>
> * match-comparison.pd
> Define operator-lists eq_ops and cc and use them in patterns.
>
> Thanks,
> Prathamesh
More information about the Gcc-patches
mailing list