public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Current limitations of define_subst
@ 2021-03-25 15:29 Colin McEwan
  2021-03-26 18:09 ` Richard Sandiford
  0 siblings, 1 reply; 2+ messages in thread
From: Colin McEwan @ 2021-03-25 15:29 UTC (permalink / raw)
  To: gcc

Hi all,

I was wondering if anyone understands the rationale behind the current
limitations on (define_subst), ie. working only on (define_insn) and
(define_expand).

A lot of md cleanup, as well as extra patterns for combiner use, could be
enabled by supporting (define_split) / (define_insn_and_split) /
(define_peephole2) so I've had a very brief look at adding support for
these constructs, and from what I see there are only a few barriers
standing in the way.

1. attributes are used to store iterator state. This is fine for insns and
expands,, but splits and peephole2- do not have attributes. Some alternate
storage could be used, or attributes could added for splits and peephole2s.

2. splits and peephole2s will have two RTL patterns which the transform
might be intended to apply to. Adding an attribute to (define_subst) to
flag whether it applies to 'old', 'new' or both RTL patterns in the
definition seems a reasonable change to support this.

Does anyone have any insight into anything else that would stop this from
working?

Thanks!
-- 
Colin

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Current limitations of define_subst
  2021-03-25 15:29 Current limitations of define_subst Colin McEwan
@ 2021-03-26 18:09 ` Richard Sandiford
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Sandiford @ 2021-03-26 18:09 UTC (permalink / raw)
  To: Colin McEwan via Gcc; +Cc: Colin McEwan

Colin McEwan via Gcc <gcc@gcc.gnu.org> writes:
> Hi all,
>
> I was wondering if anyone understands the rationale behind the current
> limitations on (define_subst), ie. working only on (define_insn) and
> (define_expand).
>
> A lot of md cleanup, as well as extra patterns for combiner use, could be
> enabled by supporting (define_split) / (define_insn_and_split) /
> (define_peephole2) so I've had a very brief look at adding support for
> these constructs, and from what I see there are only a few barriers
> standing in the way.
>
> 1. attributes are used to store iterator state. This is fine for insns and
> expands,, but splits and peephole2- do not have attributes. Some alternate
> storage could be used, or attributes could added for splits and peephole2s.
>
> 2. splits and peephole2s will have two RTL patterns which the transform
> might be intended to apply to. Adding an attribute to (define_subst) to
> flag whether it applies to 'old', 'new' or both RTL patterns in the
> definition seems a reasonable change to support this.
>
> Does anyone have any insight into anything else that would stop this from
> working?

Thanks for looking at this.  Extending define_subst to support other
constructs sounds useful.

Normally the define_subst is triggered by the use of special string
attributes, but define_splits don't have the names or (like you say)
attributes in which these special attribute would typically be used.
Is the idea to apply the define_subst to all define_splits whose
patterns match?  Or would there be some other trigger for using
the define_subst?

Apart from that, I don't think there's any fundamental reason why
define_subst hasn't been made to work with other constructs.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-26 18:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-25 15:29 Current limitations of define_subst Colin McEwan
2021-03-26 18:09 ` Richard Sandiford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).