[m68k] Fix and improve ColdFire function prologue/epilogue generation

Gunther Nikl gni@gecko.de
Wed Sep 3 16:10:00 GMT 2003


On Wed, Sep 03, 2003 at 01:28:58PM +0200, Bernardo Innocenti wrote:
> Richard Henderson wrote:
> >I would think you'd have two goals in designing a stack
> >frame layout for 68k.  (1) preserve the historical 
> >fp_n = *(fp_(n+1)) style linkage, to allow historical
> >stack walking code to continue to work, and (2a) minimize
> >number of instructions (2b) minimize instruction size.
> >
> >I'd think you'd have only two cases there:
> >
> >  frame_pointer_needed:
> >
> >	link %fp,-(frame_size + saved_regs_size)
> >	movem (mask-without-fp), -saved_regs_size(%fp)
> >
> >	I guess on coldfire you have to compute that offset
> >	into a call-clobbered address register first.
> >
> >  !frame_pointer_needed:
> >
> >	suba	(frame_size + saved_regs_size), %sp
> >	movem	(%sp), (mask-with-a6-if-needed)

  Is %a6 %fp here?

> >	I also guess you might need to offset %sp by 
> >	current_function_pretend_args_size or something,
> >	but I'd expect that to be zero most of the time.
> 
> I think we'd still have an additional case where m68k and
> ColdFire would differ: when frame_size is zero, m68k targets
> don't need to pre-decrement SP because they can let movem do
> it as a side-effect of the post-increment.

  AFAICT, merging frame_size and saved_regs_size is only possible if
  frame_size is > 8 and its < (32k - saved_regs_size). Only then there
  is no space difference for !frame_pointer_needed. I haven't looked
  at the FP case yet.

  Gunther



More information about the Gcc-patches mailing list