asm clobbers, !SMALL_REGISTER_CLASSES patch.

Jeffrey A Law law@cygnus.com
Fri Feb 13 02:28:00 GMT 1998


  In message < 9802130410.AA27074@rios1.watson.ibm.com > David Edelsohn wrote:
  >         * stmt.c (expand_asm_operands): When an asm statement
  >         clobbers a register that is in a class of its own, and there
  >         is space remaining for an extra output, turn the clobber into
  >         an output to a dummy pseudo.  At present, don't do this if
  >         there are constraints that have alternatives.
  > 
  > 	This is a good effort and I am glad that you are continuing to
  > pursue this needed feature, but I am curious why you are choosing to
  > implement it this way instead of as a match_scratch of the appropriate
  > register class?  I think that the correct solution is to turn the clobber
  > of a named register into the equivalent that GCC uses internally for
  > machine description files: match_scratch.  This patch probably works to
  > some extent, but it simply lies to GCC by transforming the clobber -- and
  > lying to GCC always causes problems in the long run.
David's approach sounds cleaner, but I haven't thought too much about
where to "hook in" and do this.

Also, with your patch you could end up introducing new aborts.

Basically, if you had two asms which clobbered "r1" (assume that it is
in a class by itself) and you were only able to "fix" one of them
with your trick, then you can lose.

Basically you end up with r1 appearing explicitly in the unfixed asm, and
appearing via a pseudo which must be allocated to r1 in the fixed asm.
At some point this will cause reload to abort -- it might take a million
lines of code to trigger it, but it will eventually bite you.

If you fix one, you need to fix them all.

Note the same applies to David's approach.  In fact, we may have a fundamental
problem -- if the register appeared as an explicit inout/output to one
asm, but was turned into a max_scratch for another asm because it was a 
clobber, then we run into the same problem.  So it seems that we have to
fix the inputs, outputs, and clobbers.  Yuck.  Sorry I didn't think of this
earlier.

jeff




More information about the Gcc mailing list