limiting call clobbered registers for library functions

Joern Rennecke
Mon Feb 2 23:15:00 GMT 2015

On 2 February 2015 at 21:54, Paul Shortis <> wrote:
> I could have avoided the expander and used a single instruction pattern for
> a)b)c) if if could have found a way to have alternative dependent clobbers
> in an instruction pattern. I investigated attributes but couldn't see how I
> would be able to achieve what I needed. Also tried clobber (match_dup 2) but
> when one of the alternatives has a constant for operands[2] the clobber is
> accepted silently by the .md compiler but doesn't actually clobber the
> non-constant alternatives.

You can clobber one or more match_scratch with suitable constraint alternatives
and let the register allocator / reload reserve the hard registers.
Well, not really for cc, you'll just have to say you clobber it, and
split away the
unused clobber post-reload.
That will not really give you less source code, but more uniform patterns
prior to register allocation.  That gives the rtl optimizers a better
handle on the code.
The effect is even more pronounced when you replace all hard register usage with
pseudo register usage and appropriate constraints.

More information about the Gcc mailing list