This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix x86-64 bootstrap problem


Hi,
the patch for fast prologues caused bootstrap problem when the
fast_prologue decision changes during the single iteration of reload
becuase reload has emit some instructions and made function body longer.

Bootstrapped/regtested x86-64. OK?

Honza

Fri Mar 21 20:46:11 CET 2003  Jan Hubicka  <jh at suse dot cz>
	* i386.c  (ix86_compute_frame_layout): Recompute fast prologues
	only when amount of saved regs changed.
	(ix86_init_machine_status): Initialize use_fast_prologue_epilgoue_nregs.
	* i386.h (machine_function): New fields use_fast_prologue_epilgoue_nregs.
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.550
diff -c -3 -p -r1.550 i386.c
*** config/i386/i386.c	19 Mar 2003 12:51:27 -0000	1.550
--- config/i386/i386.c	21 Mar 2003 19:40:07 -0000
*************** ix86_compute_frame_layout (frame)
*** 4914,4923 ****
    frame->nregs = ix86_nsaved_regs ();
    total_size = size;
  
!   if (!optimize_size && !reload_completed)
      {
        int count = frame->nregs;
  
        /* The fast prologue uses move instead of push to save registers.  This
           is significantly longer, but also executes faster as modern hardware
           can execute the moves in parallel, but can't do that for push/pop.
--- 4914,4929 ----
    frame->nregs = ix86_nsaved_regs ();
    total_size = size;
  
!   /* During reload iteration the amount of registers saved can change.  Recomute the
!      value as needed.  Do not recompute when amount of registers didn't change as
!      reload does mutiple calls to the function and does not expect the decision to
!      change within single iteration. */
!   if (!optimize_size
!       && cfun->machine->use_fast_prologue_epilogue_nregs != frame->nregs)
      {
        int count = frame->nregs;
  
+       cfun->machine->use_fast_prologue_epilogue_nregs = count;
        /* The fast prologue uses move instead of push to save registers.  This
           is significantly longer, but also executes faster as modern hardware
           can execute the moves in parallel, but can't do that for push/pop.
*************** ix86_expand_call (retval, fnaddr, callar
*** 11784,11790 ****
  static struct machine_function *
  ix86_init_machine_status ()
  {
!   return ggc_alloc_cleared (sizeof (struct machine_function));
  }
  
  /* Return a MEM corresponding to a stack slot with mode MODE.
--- 11790,11799 ----
  static struct machine_function *
  ix86_init_machine_status ()
  {
!   struct machine_function *f;
! 
!   f = ggc_alloc_cleared (sizeof (struct machine_function));
!   f->use_fast_prologue_epilogue_nregs = -1;
  }
  
  /* Return a MEM corresponding to a stack slot with mode MODE.
Index: config/i386/i386.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v
retrieving revision 1.329
diff -c -3 -p -r1.329 i386.h
*** config/i386/i386.h	19 Mar 2003 12:51:28 -0000	1.329
--- config/i386/i386.h	21 Mar 2003 19:40:07 -0000
*************** struct machine_function GTY(())
*** 3223,3228 ****
--- 3223,3231 ----
    /* Set by ix86_compute_frame_layout and used by prologue/epilogue expander to
       determine the style used.  */
    int use_fast_prologue_epilogue;
+   /* Number of saved registers USE_FAST_PROLOGUE_EPILOGUE has been computed
+      for.  */
+   int use_fast_prologue_epilogue_nregs;
  };
  
  #define ix86_stack_locals (cfun->machine->stack_locals)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]