On Thu, Aug 23, 2012 at 10:46 PM, Georg-Johann Lay <a...@gjlay.de> wrote:

> For the hook in question, it would be the same effort as far as
> the hook is concerned:  Ir really makes no difference if you
>
> - Pass X to the hook and return true or false
>
> - Pass X to the hook and return X or NULL_RTX.
>
> However, the latter interface is much more general and powerful and
> allows to change X -- or simply leave it alone like in
> legitimize_address (target_legitimize_combine or so).

I did some experiments with your proposal, but it is not as simple as
it is written above. We use existing insn as a testing place, where we
stuff various combinations and call recog. After all processing, we
have to restore insn to its original state and singal
recog_for_combine caller that we recognized the combination, but with
optional clobbers. So, calling sites only expect the
confirmation/rejection of the proposed patterns, and in case of
confirmation, recog_for_combine is allowed to decorate the pattern
with optional clobbers.

Your proposal that recog_for_combine changes the pattern is not what
callers expect from this function. Probably, there are better places
to implement target-dependent transformations, and leave
recog_for_combine just the task to confirm that them combined pattern
is OK.

Uros.

Reply via email to