[adtools] Re: baserel_restore bug

  • From: Gunther Nikl <gni@xxxxxxxx>
  • To: adtools@xxxxxxxxxxxxx
  • Date: Wed, 10 Aug 2005 10:47:21 +0200

On Tue, Aug 09, 2005 at 07:50:35PM +0200, Andrija Antonijevic wrote:
> On 4-Aug-2005, Gunther Nikl wrote:
> 
> >I noticed that "baserel_restore" doesn't work whth -mno-sched-prolog. In
> >that case TARGET_ASM_FUNCTION_END_PROLOGUE isn't called. The fix would
> >be to emit the call as RTL and remove TARGET_ASM_FUNCTION_END_PROLOGUE.
> 
> When I was assisting Thomas a bit with the baserel generation code, there 
> was some sort of a problem when doing this in the prologue. AFAIR, I added 
> the code to emit a call to baserel_get_addr and it would work without 
> optimization, but when -O2 used it would produce an internal compiler error 
> ("instruction was deleted from prologue/epilogue" or something like that) 
> and Thomas found a solution to this using TARGET_ASM_FUNCTION_END_PROLOGUE.

  I got the same abort when I tried to emit additional loads in the prologue.
  With -mno-sched-prolog the code worked. Adding

     emit_insn (gen_rtx_USE (VOIDmode, insn));

  with "insn" being the generated instruction the abort() can be avoided.
  With the same trick for the register you can avoid MEM_VOLATILE_P in
  the epilogue.

> Nowhere did the documentation say that it won't be called when 
> -mno-sched-prolog is used :I I'm not sure I understand why would 
> -mno-sched-prolog cause it not to be called - not scheduling the
> prologue doesn't mean that some parts of it should be omitted...

  Maybe its a bug that TARGET_ASM_FUNCTION_END_PROLOGUE isn't called without
  prologue scheduling. However, not using TARGET_ASM_FUNCTION_END_PROLOGUE
  requires less changes which is a good thing :)

  BTW, moving the first BASEREL hunk in rs6000_stack_info() after the
  setting of info_ptr->calls_p allows to remove the modification of
  "/* Determine if we need to save the link register.  */" if the baserel
  code hunk sets info_ptr->calls_p itself. Oh and the else case isn't
  required since rs6000_stack_info() does this at function entry:

    /* Zero all fields portably.  */
    info = zero_info;

  Gunther
______________________________________________________________________________
Amiga Development tools ML - //www.freelists.org/list/adtools
Homepage...................: http://www.sourceforge.net/projects/adtools
Listserver help............: mailto:adtools-request@xxxxxxxxxxxxx?Subject=HELP

Other related posts: