Test case for __asm__ problems in i386

Jim Wilson wilson@cygnus.com
Tue May 19 19:49:00 GMT 1998


	Do we really expect people to create a class with everything but
	the register they want to use as an explicit clobber?  Writing
	asms, particularly on the x86 is hard enough already.

There is no argument over whether it should work.  There is only argument
about the difficulty of fixing it.  The reality is that people may have to
use workarounds for years, so we should explain to people now how to
workaround this problem.  Meanwhile, we should try to avoid giving anyone
false hopes about how soon this problem will be fixed.

Note that this is a problem only for targets that define
SMALL_REGISTER_CLASSES.  There isn't really a bug in the asm clobber support.
This is a feature conflict between asm clobbers and SMALL_REGISTER_CLASSES.
If it was just a simple bug it would be easy to fix.  But it isn't a simple
bug, it is a design (or should I say `lack of design'?) problem, and hence
it is much harder to fix than it may appear at first glance.

To fix this, you have to recognize that this is the roughly the same problem
as making reload avoid using the return value register for SMALL_REGISTER_CLASS
machines.  This is the code that uses/sets avoid_return_reg.  This code only
deals with one register, and only tracks that one register from a call to
the immediately following insn that saves the call restult in a pseudo.
To fix the asm clobber problem, we need to generalize this code to handle
all registers across all instructions.  I believe this will be a major change,
and major reload changes are always risky.

There is also the problem that we don't track reload needs at the individual
instruction level.  We only track them at the basic block level.  Fixing this
problem means increasing the number of reload registers we allocate, as we
already do for the return register, just in case there is a constraint/clobber
conflict that may require us to use a different register.  We will have to
do this for an entire block at a time, even if there is only one asm with a
clobber.   On the x86, everytime we need more reload registers, we get worse
code.  It may be that fixing this gives bad enough code that people shouldn't
have used the feature in the first place.

Jim



More information about the Gcc-bugs mailing list