local-alloc update

Jeffrey A Law law@cygnus.com
Thu Dec 3 10:53:00 GMT 1998


I ran into some cases where the heuristic to widen the lifetime of a qty to
make it conflict with nearby qtys (to avoid generation of false dependencies)
was too aggressive and hurt code performance.  This patch tunes the heuristic
a little to avoid the problems.



        * local-alloc.c (block_alloc): Slightly retune heuristic to widen
        qty lifetimes.

Index: local-alloc.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/local-alloc.c,v
retrieving revision 1.90
diff -c -3 -p -r1.90 local-alloc.c
*** local-alloc.c	1998/12/01 18:13:25	1.90
--- local-alloc.c	1998/12/03 18:44:07
*************** block_alloc (b)
*** 1410,1417 ****
  	     discourage the register allocator from creating false
  	     dependencies.
   
! 	     The adjustment by the value +-3 indicates precisely that
! 	     this qty conflicts with qtys in the instructions immediately
  	     before and after the lifetime of this qty.
  
  	     Experiments have shown that higher values tend to hurt
--- 1410,1417 ----
  	     discourage the register allocator from creating false
  	     dependencies.
   
! 	     The adjustment value is choosen to indicate that this qty
! 	     conflicts with all the qtys in the instructions immediately
  	     before and after the lifetime of this qty.
  
  	     Experiments have shown that higher values tend to hurt
*************** block_alloc (b)
*** 1419,1426 ****
  
  	     If allocation using the extended lifetime fails we will try
  	     again with the qty's unadjusted lifetime.  */
! 	  int fake_birth = MAX (0, qty_birth[q] - 3);
! 	  int fake_death = MIN (insn_number * 2 + 1, qty_death[q] + 3);
  #endif
  
  	  if (N_REG_CLASSES > 1)
--- 1419,1427 ----
  
  	     If allocation using the extended lifetime fails we will try
  	     again with the qty's unadjusted lifetime.  */
! 	  int fake_birth = MAX (0, qty_birth[q] - 2 + qty_birth[q] % 2);
! 	  int fake_death = MIN (insn_number * 2 + 1,
! 				qty_death[q] + 2 - qty_death[q] % 2);
  #endif
  
  	  if (N_REG_CLASSES > 1)



More information about the Gcc-patches mailing list