Reload patch for PA call rewrite.

John David Anglin dave@hiauly1.hia.nrc.ca
Mon Nov 18 09:18:00 GMT 2002


> On Sun, 2002-11-17 at 15:48, Jeff Law wrote:
> > For the hardware managed BTS machines we should probably disable sibling
> > call optimizations as they'll scrog the BTS.
> 
> I don't see how this would happen.  Sibcall optimization takes
> 
> a:
> 	...
> 	call b
> 	ret
> 
> b:
> 	...
> 	ret
> 
> and turns it into
> 
> a:
> 	...
> 	jmp b
> 
> b:
> 	...
> 	ret
> 
> Afterward, it's as if there was one long function with an unconditional
> jump in the middle.  How does this scrog the BTS?

"jmp b" and "ret" may be the same machine instruction.  The PA
architecture has a collection of branch instructions, but no
iexplicit call or ret instructions.  Thus, the jmp might scrog
the BTS.

The machine definition currently does short sibcalls using a
"B,L target,%r0" where %r0 is the link register.  As register %r0 is
a fixed 0, we are throwing away the link value in the sibcall.  This
instruction probably will not confuse the BTS hardware.  However, for
long sibcalls, we use the "BVE (b)" instruction.  This instruction is
also used for for function returns.  So, the hardware might have
some difficulty determining when to pop the BTS.  Possibly, only a
"BVE (%r2)" will pop the BTS and "BVE (%r1)" won't.  We use the former
for returns and the latter for long sibcalls.  However, I don't have
any information on how the hardware actually BTS works.

Dave
-- 
J. David Anglin                                  dave.anglin@nrc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6605)



More information about the Gcc-patches mailing list