asm clobbers, !SMALL_REGISTER_CLASSES patch.

Jeffrey A Law law@cygnus.com
Sat Feb 14 00:32:00 GMT 1998


  In message < 199802130931.UAA18941@discus.anu.edu.au >you write:
  > On PPC, of course, this is not a problem; generally, if you can't fix
  > a clobber of a register in a class of its own, eventually gcc will
  > abort anyway :-(.  The only small register classes contain cr0, lr, ctr,
  > and mq, and they all have this same problem (although I can't find an
  > example for ctr, because I can't get gcc to use it at all... this is
  > probably a bug).
Yes, but your patch can/will end up breaking other ports, possibly
more so than they currently break.

And consider a port where a general register happens to be in a class
by itself -- for various reasons this happens on other ports.

  > > 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 th
  > is
  > > earlier.
  > 
  > I don't understand this.  Does this mean that
  > 
  > int something, dummy2;
  > asm ("foo" : "+l"(something) );
  > asm ("bar" : "=&l"(dummy2) );
I don't think so, but I'm not familiar with the ppc to know what
"l" is (a register?  A register letter?"



The problem is you can't have registers which are in a class by
themselves appear explicitly in RTL and via a a reference to their
register class.

So, for example, say we have class R1_REGS, which contains register
r1, and that we use letter 'a' in constraints to specify R1_REGS.

Now, assume we have this pattern:

(define_insn "pic_load_label"
  [(set (match_operand:SI 0 "register_operand" "=a")
        (match_operand:SI 1 "pic_label_operand" ""))]

Note that is specifies R1_REGS for operand 0 via the "=a" constraint.

If we write an asm which explicitly uses r1 in a function which also
has uses pattern, then the compiler can/will abort during reload
if it has to spill the register.


jeff




More information about the Gcc mailing list