condexec merge part 8

Richard Henderson rth@cygnus.com
Thu Apr 27 00:01:00 GMT 2000


Make update_life_info a little easier to use.


r~

        * flow.c (update_life_info): Consider blocks null to mean the
        universal set.
        (calculate_global_regs_live): Likewise.
        (life_analysis): Do that instead of collecting all_blocks.

Index: flow.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/flow.c,v
retrieving revision 1.263
diff -c -p -d -r1.263 flow.c
*** flow.c	2000/04/27 06:47:16	1.263
--- flow.c	2000/04/27 06:58:58
*************** life_analysis (f, file, flags)
*** 2486,2492 ****
    register int i;
    static struct {int from, to; } eliminables[] = ELIMINABLE_REGS;
  #endif
-   sbitmap all_blocks;
  
    /* Record which registers will be eliminated.  We use this in
       mark_used_regs.  */
--- 2486,2491 ----
*************** life_analysis (f, file, flags)
*** 2532,2539 ****
       data from lifetime analysis.  */
    allocate_reg_life_data ();
    allocate_bb_life_data ();
-   all_blocks = sbitmap_alloc (n_basic_blocks);
-   sbitmap_ones (all_blocks);
  
    /* Find the set of registers live on function exit.  */
    mark_regs_live_at_end (EXIT_BLOCK_PTR->global_live_at_start);
--- 2531,2536 ----
*************** life_analysis (f, file, flags)
*** 2544,2554 ****
  
    if (flags & PROP_REG_INFO)
      memset (regs_ever_live, 0, sizeof(regs_ever_live));
!   update_life_info (all_blocks, UPDATE_LIFE_GLOBAL, flags);
  
    /* Clean up.  */
-   sbitmap_free (all_blocks);
- 
    if (flags & PROP_SCAN_DEAD_CODE)
      end_alias_analysis ();
  
--- 2541,2549 ----
  
    if (flags & PROP_REG_INFO)
      memset (regs_ever_live, 0, sizeof(regs_ever_live));
!   update_life_info (NULL, UPDATE_LIFE_GLOBAL, flags);
  
    /* Clean up.  */
    if (flags & PROP_SCAN_DEAD_CODE)
      end_alias_analysis ();
  
*************** verify_local_live_at_start (new_live_at_
*** 2634,2643 ****
  }
  
  /* Updates life information starting with the basic blocks set in BLOCKS.
     
!    If LOCAL_ONLY, such as after splitting or peepholeing, we are only
!    expecting local modifications to basic blocks.  If we find extra
!    registers live at the beginning of a block, then we either killed
     useful data, or we have a broken split that wants data not provided.
     If we find registers removed from live_at_start, that means we have
     a broken peephole that is killing a register it shouldn't.
--- 2629,2639 ----
  }
  
  /* Updates life information starting with the basic blocks set in BLOCKS.
+    If BLOCKS is null, consider it to be the universal set.
     
!    If EXTENT is UPDATE_LIFE_LOCAL, such as after splitting or peepholeing,
!    we are only expecting local modifications to basic blocks.  If we find
!    extra registers live at the beginning of a block, then we either killed
     useful data, or we have a broken split that wants data not provided.
     If we find registers removed from live_at_start, that means we have
     a broken peephole that is killing a register it shouldn't.
*************** update_life_info (blocks, extent, prop_f
*** 2672,2688 ****
  	count_or_remove_death_notes (blocks, 1);
      }
  
!   EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i,
      {
!       basic_block bb = BASIC_BLOCK (i);
  
!       COPY_REG_SET (tmp, bb->global_live_at_end);
!       propagate_block (bb, tmp, (regset) NULL, prop_flags);
  
!       if (extent == UPDATE_LIFE_LOCAL)
! 	verify_local_live_at_start (tmp, bb);
!     });
  
    FREE_REG_SET (tmp);
  
    if (prop_flags & PROP_REG_INFO)
--- 2668,2700 ----
  	count_or_remove_death_notes (blocks, 1);
      }
  
!   if (blocks)
      {
!       EXECUTE_IF_SET_IN_SBITMAP (blocks, 0, i,
! 	{
! 	  basic_block bb = BASIC_BLOCK (i);
  
! 	  COPY_REG_SET (tmp, bb->global_live_at_end);
! 	  propagate_block (bb, tmp, (regset) NULL, prop_flags);
  
! 	  if (extent == UPDATE_LIFE_LOCAL)
! 	    verify_local_live_at_start (tmp, bb);
! 	});
!     }
!   else
!     {
!       for (i = n_basic_blocks - 1; i >= 0; --i)
! 	{
! 	  basic_block bb = BASIC_BLOCK (i);
  
+ 	  COPY_REG_SET (tmp, bb->global_live_at_end);
+ 	  propagate_block (bb, tmp, (regset) NULL, prop_flags);
+ 
+ 	  if (extent == UPDATE_LIFE_LOCAL)
+ 	    verify_local_live_at_start (tmp, bb);
+ 	}
+     }
+ 
    FREE_REG_SET (tmp);
  
    if (prop_flags & PROP_REG_INFO)
*************** set_phi_alternative_reg (insn, dest_regn
*** 2970,2975 ****
--- 2982,2989 ----
  
  /* Propagate global life info around the graph of basic blocks.  Begin
     considering blocks with their corresponding bit set in BLOCKS_IN. 
+    If BLOCKS_IN is null, consider it the universal set.
+ 
     BLOCKS_OUT is set for every block that was changed.  */
  
  static void
*************** calculate_global_regs_live (blocks_in, b
*** 3000,3013 ****
    /* Queue the blocks set in the initial mask.  Do this in reverse block
       number order so that we are more likely for the first round to do 
       useful work.  We use AUX non-null to flag that the block is queued.  */
!   EXECUTE_IF_SET_IN_SBITMAP (blocks_in, 0, i,
      {
!       basic_block bb = BASIC_BLOCK (i);
!       *--qhead = bb;
!       bb->aux = bb;
!     });
  
!   sbitmap_zero (blocks_out);
  
    while (qhead != qtail)
      {
--- 3014,3040 ----
    /* Queue the blocks set in the initial mask.  Do this in reverse block
       number order so that we are more likely for the first round to do 
       useful work.  We use AUX non-null to flag that the block is queued.  */
!   if (blocks_in)
      {
!       EXECUTE_IF_SET_IN_SBITMAP (blocks_in, 0, i,
! 	{
! 	  basic_block bb = BASIC_BLOCK (i);
! 	  *--qhead = bb;
! 	  bb->aux = bb;
! 	});
!     }
!   else
!     {
!       for (i = 0; i < n_basic_blocks; ++i)
! 	{
! 	  basic_block bb = BASIC_BLOCK (i);
! 	  *--qhead = bb;
! 	  bb->aux = bb;
! 	}
!     }
  
!   if (blocks_out)
!     sbitmap_zero (blocks_out);
  
    while (qhead != qtail)
      {
*************** calculate_global_regs_live (blocks_in, b
*** 3080,3086 ****
  
        /* Let our caller know that BB changed enough to require its
  	 death notes updated.  */
!       SET_BIT (blocks_out, bb->index);
  
        if (! rescan)
  	{
--- 3107,3114 ----
  
        /* Let our caller know that BB changed enough to require its
  	 death notes updated.  */
!       if (blocks_out)
! 	SET_BIT (blocks_out, bb->index);
  
        if (! rescan)
  	{
*************** calculate_global_regs_live (blocks_in, b
*** 3130,3140 ****
    FREE_REG_SET (tmp);
    FREE_REG_SET (new_live_at_end);
  
!   EXECUTE_IF_SET_IN_SBITMAP (blocks_out, 0, i,
      {
!       basic_block bb = BASIC_BLOCK (i);
!       FREE_REG_SET (bb->local_set);
!     });
  
    free (queue);
  }
--- 3158,3179 ----
    FREE_REG_SET (tmp);
    FREE_REG_SET (new_live_at_end);
  
!   if (blocks_out)
      {
!       EXECUTE_IF_SET_IN_SBITMAP (blocks_out, 0, i,
! 	{
! 	  basic_block bb = BASIC_BLOCK (i);
! 	  FREE_REG_SET (bb->local_set);
! 	});
!     }
!   else
!     {
!       for (i = n_basic_blocks - 1; i >= 0; --i)
! 	{
! 	  basic_block bb = BASIC_BLOCK (i);
! 	  FREE_REG_SET (bb->local_set);
! 	}
!     }
  
    free (queue);
  }


More information about the Gcc-patches mailing list