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]

track n_bbs_in_dom_tree only when asserting


This patch adds some asserts which update the value of n_bbs_in_dom_tree.
That variable is only used when asserting, so there's no need to
manipulate it at other times.  This does introduce intentionally
side-effecting asserts, but I hope that's flagged sufficiently with the
extra parens and comments.

booted & tested on i686-pc-linux-gnu,ok?

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2004-09-13  Nathan Sidwell  <nathan@codesourcery.com>

	* dominance.c (n_bbs_in_dom_tree): Only manipulate in asserts.
	(calculate_dominance_info, add_to_dominance_info,
	delete_from_dominance_info): Likewise.

Index: dominance.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dominance.c,v
retrieving revision 1.27
diff -c -3 -p -r1.27 dominance.c
*** dominance.c	8 Sep 2004 07:47:45 -0000	1.27
--- dominance.c	13 Sep 2004 13:57:38 -0000
*************** static void link_roots (struct dom_info 
*** 122,128 ****
  static void calc_idoms (struct dom_info *, enum cdi_direction);
  void debug_dominance_info (enum cdi_direction);
  
! /* Keeps track of the*/
  static unsigned n_bbs_in_dom_tree[2];
  
  /* Helper macro for allocating and initializing an array,
--- 122,128 ----
  static void calc_idoms (struct dom_info *, enum cdi_direction);
  void debug_dominance_info (enum cdi_direction);
  
! /* Basic block/dominator consistency check.  */
  static unsigned n_bbs_in_dom_tree[2];
  
  /* Helper macro for allocating and initializing an array,
*************** calculate_dominance_info (enum cdi_direc
*** 632,638 ****
  	{
  	  b->dom[dir] = et_new_tree (b);
  	}
!       n_bbs_in_dom_tree[dir] = n_basic_blocks + 2;
  
        init_dom_info (&di, dir);
        calc_dfs_tree (&di, dir);
--- 632,638 ----
  	{
  	  b->dom[dir] = et_new_tree (b);
  	}
!       gcc_assert ((n_bbs_in_dom_tree[dir] = n_basic_blocks + 2));  /* Set. */
  
        init_dom_info (&di, dir);
        calc_dfs_tree (&di, dir);
*************** add_to_dominance_info (enum cdi_directio
*** 905,911 ****
    gcc_assert (dom_computed[dir]);
    gcc_assert (!bb->dom[dir]);
  
!   n_bbs_in_dom_tree[dir]++;
    
    bb->dom[dir] = et_new_tree (bb);
  
--- 905,911 ----
    gcc_assert (dom_computed[dir]);
    gcc_assert (!bb->dom[dir]);
  
!   gcc_assert ((n_bbs_in_dom_tree[dir]++)); /* Update. */
    
    bb->dom[dir] = et_new_tree (bb);
  
*************** delete_from_dominance_info (enum cdi_dir
*** 920,926 ****
  
    et_free_tree (bb->dom[dir]);
    bb->dom[dir] = NULL;
!   n_bbs_in_dom_tree[dir]--;
  
    if (dom_computed[dir] == DOM_OK)
      dom_computed[dir] = DOM_NO_FAST_QUERY;
--- 920,926 ----
  
    et_free_tree (bb->dom[dir]);
    bb->dom[dir] = NULL;
!   gcc_assert ((n_bbs_in_dom_tree[dir]--)); /* Update. */
  
    if (dom_computed[dir] == DOM_OK)
      dom_computed[dir] = DOM_NO_FAST_QUERY;

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