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]

reg-stack cleanup



Hi,
while debugging the reg-stack crash I've sent post about to gcc-bugs,
I've spotted following hack dealing with dead blocks.  I believe now, when
CFG is ready and we can easilly delete deat blocks, it is better to kill
them and add sanity checking that my code to walk tree really walks everything.

Bootstrapped/regtested i586

Honza

Wed Aug  1 20:59:37 CEST 2001  Jan Hubicka  <jh@suse.cz>
	* reg-stack.c (reg_to_stack): Call cleanup_cfg when not optimizing.
	(convert_regs): Check that there are not unvisited blocks; do not
	attempt to convert them.

Index: reg-stack.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/reg-stack.c,v
retrieving revision 1.85
diff -c -3 -p -r1.85 reg-stack.c
*** reg-stack.c	2001/07/31 13:43:22	1.85
--- reg-stack.c	2001/08/01 18:59:29
*************** reg_to_stack (first, file)
*** 442,450 ****
      return;
  
    /* Ok, floating point instructions exist.  If not optimizing, 
!      build the CFG and run life analysis.  */
    if (!optimize)
!     find_basic_blocks (first, max_reg_num (), file);
    count_or_remove_death_notes (NULL, 1);
    life_analysis (first, file, PROP_DEATH_NOTES);
    mark_dfs_back_edges ();
--- 442,453 ----
      return;
  
    /* Ok, floating point instructions exist.  If not optimizing, 
!      build the CFG, kill all dead blocks and run life analysis.  */
    if (!optimize)
!     {
!       find_basic_blocks (first, max_reg_num (), file);
!       cleanup_cfg (0);
!     }
    count_or_remove_death_notes (NULL, 1);
    life_analysis (first, file, PROP_DEATH_NOTES);
    mark_dfs_back_edges ();
*************** convert_regs (file)
*** 2823,2847 ****
    for (e = ENTRY_BLOCK_PTR->succ; e ; e = e->succ_next)
      inserted |= convert_regs_2 (file, e->dest);
    
!   /* ??? Process all unreachable blocks.  Though there's no excuse 
!      for keeping these even when not optimizing.  */
    for (i = 0; i < n_basic_blocks; ++i)
      {
        basic_block b = BASIC_BLOCK (i);
        block_info bi = BLOCK_INFO (b);
  
        if (! bi->done)
! 	{
! 	  int reg;
! 
! 	  /* Create an arbitrary input stack.  */
! 	  bi->stack_in.top = -1;
! 	  for (reg = LAST_STACK_REG; reg >= FIRST_STACK_REG; --reg)
! 	    if (TEST_HARD_REG_BIT (bi->stack_in.reg_set, reg))
! 	      bi->stack_in.reg[++bi->stack_in.top] = reg;
! 
! 	  inserted |= convert_regs_2 (file, b);
! 	}
      }
  
    if (inserted)
--- 2826,2840 ----
    for (e = ENTRY_BLOCK_PTR->succ; e ; e = e->succ_next)
      inserted |= convert_regs_2 (file, e->dest);
    
!   /* As we are now deleting all dead blocks even when not optimizing,
!      we should never miss some.  */
    for (i = 0; i < n_basic_blocks; ++i)
      {
        basic_block b = BASIC_BLOCK (i);
        block_info bi = BLOCK_INFO (b);
  
        if (! bi->done)
! 	abort ();
      }
  
    if (inserted)


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