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]

Move local_set and cond_local_set out of struct basic_block_def


Hi,

These two regsets are only used in flow.c, so there is no valid reason
to spoil two pointers on every basic block for them.

Bootstrapped and tested on i686-pc-linux-gnu.  The patch has no effect
on compile time.

OK?

Gr.
Steven

	* basic-block.h (XMALLOC_REG_SET, XFREE_REG_SET): New.
	(struct basic_block_def): Remove local_set and cond_local_set
	fields.  Update comment for global_live_at_start.
	* flow.c (calculate_global_regs_live): Allocate local_sets and
	cond_local_sets here as arrays of bitmaps previously stored in
	bb->local_set and bb->cond_local_set.  Use xmalloc instead of
	obstack allocated bitmaps.

Index: basic-block.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/basic-block.h,v
retrieving revision 1.223
diff -c -3 -p -r1.223 basic-block.h
*** basic-block.h	29 Oct 2004 08:40:51 -0000	1.223
--- basic-block.h	6 Nov 2004 22:36:06 -0000
*************** typedef bitmap_iterator reg_set_iterator
*** 110,115 ****
--- 110,121 ----
  /* Do any cleanup needed on a regset when it is no longer used.  */
  #define FREE_REG_SET(REGSET) BITMAP_FREE(REGSET)
  
+ /* Allocate a register set with xmalloc.  */
+ #define XMALLOC_REG_SET() BITMAP_XMALLOC ()
+ 
+ /* Free a register set.  */
+ #define XFREE_REG_SET(REGSET) BITMAP_XFREE (REGSET)
+ 
  /* Do any one-time initializations needed for regsets.  */
  #define INIT_ONCE_REG_SET() BITMAP_INIT_ONCE ()
  
*************** struct basic_block_def GTY((chain_next (
*** 229,248 ****
    VEC(edge) *preds;
    VEC(edge) *succs;
  
!   /* Liveness info.  */
! 
!   /* The registers that are modified within this in block.  */
!   bitmap GTY ((skip (""))) local_set;
!   /* The registers that are conditionally modified within this block.
!      In other words, registers that are set only as part of a
!      COND_EXEC.  */
!   bitmap GTY ((skip (""))) cond_local_set;
!   /* The registers that are live on entry to this block.
! 
!      Note that in SSA form, global_live_at_start does not reflect the
!      use of regs in phi functions, since the liveness of these regs
!      may depend on which edge was taken into the block.  */
    bitmap GTY ((skip (""))) global_live_at_start;
    /* The registers that are live on exit from this block.  */
    bitmap GTY ((skip (""))) global_live_at_end;
  
--- 235,243 ----
    VEC(edge) *preds;
    VEC(edge) *succs;
  
!   /* The registers that are live on entry to this block.  */
    bitmap GTY ((skip (""))) global_live_at_start;
+ 
    /* The registers that are live on exit from this block.  */
    bitmap GTY ((skip (""))) global_live_at_end;
  
Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.606
diff -c -3 -p -r1.606 flow.c
*** flow.c	4 Nov 2004 20:35:57 -0000	1.606
--- flow.c	6 Nov 2004 22:36:07 -0000
*************** Software Foundation, 59 Temple Place - S
*** 112,118 ****
  /* TODO:
  
     Split out from life_analysis:
! 	- local property discovery (bb->local_live, bb->local_set)
  	- global property computation
  	- log links creation
  	- pre/post modify transformation
--- 112,118 ----
  /* TODO:
  
     Split out from life_analysis:
! 	- local property discovery
  	- global property computation
  	- log links creation
  	- pre/post modify transformation
*************** calculate_global_regs_live (sbitmap bloc
*** 1017,1022 ****
--- 1017,1030 ----
    regset tmp, new_live_at_end, invalidated_by_call;
    regset_head tmp_head, invalidated_by_call_head;
    regset_head new_live_at_end_head;
+ 
+   /* The registers that are modified within this in block.  */
+   regset *local_sets;
+ 
+   /* The registers that are conditionally modified within this block.
+      In other words, regs that are set only as part of a COND_EXEC.  */
+   regset *cond_local_sets;
+ 
    int i;
  
    /* Some passes used to forget clear aux field of basic block causing
*************** calculate_global_regs_live (sbitmap bloc
*** 1035,1040 ****
--- 1043,1052 ----
      if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i))
        SET_REGNO_REG_SET (invalidated_by_call, i);
  
+   /* Allocate space for the sets of local properties.  */
+   local_sets = xcalloc (last_basic_block + 2, sizeof (regset));
+   cond_local_sets = xcalloc (last_basic_block + 2, sizeof (regset));
+ 
    /* Create a worklist.  Allocate an extra slot for ENTRY_BLOCK, and one
       because the `head == tail' style test for an empty queue doesn't
       work with a full queue.  */
*************** calculate_global_regs_live (sbitmap bloc
*** 1170,1182 ****
  	}
  
        /* On our first pass through this block, we'll go ahead and continue.
! 	 Recognize first pass by local_set NULL.  On subsequent passes, we
! 	 get to skip out early if live_at_end wouldn't have changed.  */
  
!       if (bb->local_set == NULL)
  	{
! 	  bb->local_set = OBSTACK_ALLOC_REG_SET (&flow_obstack);
! 	  bb->cond_local_set = OBSTACK_ALLOC_REG_SET (&flow_obstack);
  	  rescan = 1;
  	}
        else
--- 1182,1195 ----
  	}
  
        /* On our first pass through this block, we'll go ahead and continue.
! 	 Recognize first pass by checking if local_set is NULL for this
!          basic block.  On subsequent passes, we get to skip out early if
! 	 live_at_end wouldn't have changed.  */
  
!       if (local_sets[bb->index + 2] == NULL)
  	{
! 	  local_sets[bb->index + 2] = XMALLOC_REG_SET ();
! 	  cond_local_sets[bb->index + 2] = XMALLOC_REG_SET ();
  	  rescan = 1;
  	}
        else
*************** calculate_global_regs_live (sbitmap bloc
*** 1198,1204 ****
  	       we only compare the new live_at_end against the
  	       previous one.  */
  	    rescan = bitmap_intersect_p (new_live_at_end,
! 					 bb->cond_local_set);
  
  	  if (!rescan)
  	    {
--- 1211,1217 ----
  	       we only compare the new live_at_end against the
  	       previous one.  */
  	    rescan = bitmap_intersect_p (new_live_at_end,
! 					 cond_local_sets[bb->index + 2]);
  
  	  if (!rescan)
  	    {
*************** calculate_global_regs_live (sbitmap bloc
*** 1208,1216 ****
  	      if (bitmap_empty_p (tmp))
  		continue;
    
! 	      /* If any of the changed bits overlap with local_set,
   		 we'll have to rescan the block.  */
! 	      rescan = bitmap_intersect_p (tmp, bb->local_set);
  	    }
  	}
  
--- 1221,1229 ----
  	      if (bitmap_empty_p (tmp))
  		continue;
    
! 	      /* If any of the changed bits overlap with local_sets[bb],
   		 we'll have to rescan the block.  */
! 	      rescan = bitmap_intersect_p (tmp, local_sets[bb->index + 2]);
  	    }
  	}
  
*************** calculate_global_regs_live (sbitmap bloc
*** 1237,1244 ****
  
  	  /* Rescan the block insn by insn to turn (a copy of) live_at_end
  	     into live_at_start.  */
! 	  propagate_block (bb, new_live_at_end, bb->local_set,
! 			   bb->cond_local_set, flags);
  
  	  /* If live_at start didn't change, no need to go farther.  */
  	  if (REG_SET_EQUAL_P (bb->global_live_at_start, new_live_at_end))
--- 1250,1257 ----
  
  	  /* Rescan the block insn by insn to turn (a copy of) live_at_end
  	     into live_at_start.  */
! 	  propagate_block (bb, new_live_at_end, local_sets[bb->index + 2],
! 			   cond_local_sets[bb->index + 2], flags);
  
  	  /* If live_at start didn't change, no need to go farther.  */
  	  if (REG_SET_EQUAL_P (bb->global_live_at_start, new_live_at_end))
*************** calculate_global_regs_live (sbitmap bloc
*** 1271,1290 ****
        EXECUTE_IF_SET_IN_SBITMAP (blocks_out, 0, i,
  	{
  	  basic_block bb = BASIC_BLOCK (i);
! 	  FREE_REG_SET (bb->local_set);
! 	  FREE_REG_SET (bb->cond_local_set);
  	});
      }
    else
      {
        FOR_EACH_BB (bb)
  	{
! 	  FREE_REG_SET (bb->local_set);
! 	  FREE_REG_SET (bb->cond_local_set);
  	}
      }
  
    free (queue);
  }
  
  
--- 1284,1305 ----
        EXECUTE_IF_SET_IN_SBITMAP (blocks_out, 0, i,
  	{
  	  basic_block bb = BASIC_BLOCK (i);
! 	  XFREE_REG_SET (local_sets[bb->index + 2]);
! 	  XFREE_REG_SET (cond_local_sets[bb->index + 2]);
  	});
      }
    else
      {
        FOR_EACH_BB (bb)
  	{
! 	  XFREE_REG_SET (local_sets[bb->index + 2]);
! 	  XFREE_REG_SET (cond_local_sets[bb->index + 2]);
  	}
      }
  
    free (queue);
+   free (cond_local_sets);
+   free (local_sets);
  }
  
  


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