On 2/7/25 12:18 PM, Richard Sandiford wrote:
FWIW, here's a very rough initial version of the kind of thing
I was thinking about. Hopefully the hook documentation describes
the approach. It's deliberately (overly?) flexible.
I've included an aarch64 version that (a) models the fact that the
first caller-save can also allocate the frame more-or-less for free,
and (b) once we've saved an odd number of GPRs, saving one more is
essentialy free. I also hacked up an x86 version locally to model
the allocation benefits of using caller-saved registers. It seemed
to fix the povray example above.
This still needs a lot of clean-up and testing, but I thought I might
as well send what I have before leaving for the weekend. Does it look
reasonable in principle?
Richard, thank you for continuing work on this problem. These hooks and
their implementation have much more sense to me. Although it is
difficult to predict that it will solve all existing related PRs. You
definitely get my approval of your hooks if you will manage not to have
new GCC testsuite failures with these hooks on x86-64, aarch64, and ppc64.