limiting call clobbered registers for library functions

Paul Shortis pshortis@dataworx.com.au
Thu Jan 29 10:09:00 GMT 2015


I've ported GCC to a small 16 bit CPU that has single bit shifts. 
So I've handled variable / multi-bit shifts using a mix of inline 
shifts and calls to assembler support functions.

The calls to the asm library functions clobber only one (by 
const) or two (variable) registers but of course calling these 
functions causes all of the standard call clobbered registers to 
be considered clobbered, thus wasting lots of candidate registers 
for use in expressions surrounding these shifts and causing 
unnecessary register saves in the surrounding function 
prologue/epilogue.

I've scrutinized and cloned the actions of other ports that do 
the same, however I'm unable to convince the various passes that 
only r1 and r2 can be clobbered by these library calls.

Is anyone able to point me in the proper direction for a solution 
to this problem ?

Thanks, Paul.





More information about the Gcc mailing list