"cc" clobber

Richard Henderson rth@redhat.com
Mon Feb 1 20:40:00 GMT 2016


On 02/02/2016 01:58 AM, Ulrich Weigand wrote:
> I think on many targets a clobber "cc" works because the backend
> actually defines a register named "cc" to correspond to the flags.
> Therefore the normal handling of clobbering named hard registers
> catches this case as well.

Yes.  C.f. Sparc ADDITIONAL_REGISTER_NAMES.

> This doesn't work on i386 because there the flags register is called
> "flags" in the back end.

Once upon a time i386 used cc0.  A survey of existing asm showed that almost no 
one clobbered "cc", and that in the process of changing i386 from cc0 to an 
explicit flags register we would break almost everything that used asm.

The only solution that scaled was to force a clobber of the flags register.

That was 1999.  I think you'll buy nothing but pain in trying to change this now.


r~



More information about the Gcc mailing list