[tree-ssa-branch]: Fix a few random things

Daniel Berlin dberlin@dberlin.org
Wed Jun 26 08:03:00 GMT 2002


I'll commit this in a few hours unless someone has a problem (the 
VARRAY_FREE->VARRAY_CLEAR has obviously been in my tree since varray's 
were ggc allocated).


2002-06-26  Daniel Berlin  <dberlin@dberlin.org>

	* tree-ssa.c (tree_build_ssa): Call free_dominance_info, not
	free, on idom.

	* tree-ssa-pre.c (compute_domchildren): Update to use new
	dominance_info structure, rather than idom array.
	(tree_perform_ssapre): Don't forget to free the dominance info.

	s/VARRAY_FREE/VARRAY_CLEAR/g now that VARRAY's are ggc allocated.

Index: tree-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa.c,v
retrieving revision 1.1.4.2
diff -c -3 -p -w -B -b -r1.1.4.2 tree-ssa.c
*** tree-ssa.c	24 Jun 2002 21:38:01 -0000	1.1.4.2
--- tree-ssa.c	26 Jun 2002 14:57:02 -0000
*************** tree_build_ssa ()
*** 97,103 ****
    build_fud_chains (idom);
  
    sbitmap_vector_free (dfs);
!   free (idom);
  
    /* Debugging dumps.  */
    dump_file = dump_begin (TDI_ssa, &dump_flags);
--- 97,103 ----
    build_fud_chains (idom);
  
    sbitmap_vector_free (dfs);
!   free_dominance_info (idom);
  
    /* Debugging dumps.  */
    dump_file = dump_begin (TDI_ssa, &dump_flags);
Index: tree-ssa-pre.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-pre.c,v
retrieving revision 1.1.4.2
diff -c -3 -p -w -B -b -r1.1.4.2 tree-ssa-pre.c
*** tree-ssa-pre.c	24 Jun 2002 21:38:00 -0000	1.1.4.2
--- tree-ssa-pre.c	26 Jun 2002 14:57:02 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 39,44 ****
--- 39,45 ----
  #include "varray.h"
  #include "hashtab.h"
  #include "splay-tree.h"
+ #include "ggc.h"
  #include "fibheap.h"
  /* This should be eventually be generalized to other languages, but
     this would require a shared function-as-trees infrastructure.  */
*************** static hashval_t hash_expr_tree PARAMS (
*** 62,68 ****
  static int expr_lexically_eq PARAMS ((tree, tree));
  static void free_expr_info PARAMS ((struct expr_info *));
  static sbitmap compute_idfs PARAMS ((sbitmap *, tree));
! static void compute_domchildren PARAMS ((int *, sbitmap *));
  
  static inline bool a_dom_b PARAMS ((basic_block, basic_block));
  static void set_var_phis PARAMS ((varref, int));
--- 63,69 ----
  static int expr_lexically_eq PARAMS ((tree, tree));
  static void free_expr_info PARAMS ((struct expr_info *));
  static sbitmap compute_idfs PARAMS ((sbitmap *, tree));
! static void compute_domchildren PARAMS ((dominance_info, sbitmap *));
  
  static inline bool a_dom_b PARAMS ((basic_block, basic_block));
  static void set_var_phis PARAMS ((varref, int));
*************** a_dom_b (a, b)
*** 151,164 ****
     dominators.  */     
  static void
  compute_domchildren (idom, domc)
!      int *idom;
       sbitmap *domc;
  {
    basic_block bb;
    FOR_EACH_BB (bb)
      {     
!       if (idom[bb->index] >= 0)
!         SET_BIT (domc[idom[bb->index]], bb->index);
      }
  }
  
--- 152,167 ----
     dominators.  */     
  static void
  compute_domchildren (idom, domc)
!      dominance_info idom;
       sbitmap *domc;
  {
    basic_block bb;
    FOR_EACH_BB (bb)
      {     
!       basic_block dom;
!       dom = get_immediate_dominator (idom, bb);
!       if (dom && dom->index >= 0)
!         SET_BIT (domc[dom->index], bb->index);
      }
  }
  
*************** free_expr_info (v1)
*** 252,265 ****
       struct expr_info * v1;
  {
    struct expr_info *e1 = (struct expr_info *)v1;
!   VARRAY_FREE (e1->occurs);
!   VARRAY_FREE (e1->occurstmts);
!   VARRAY_FREE (e1->reals);
!   VARRAY_FREE (e1->realstmts);
!   VARRAY_FREE (e1->phis);
!   VARRAY_FREE (e1->erefs);
!   VARRAY_FREE (e1->refs);
!   free (e1);
  }
  
  /* dfphis and varphis, from the paper. */
--- 255,268 ----
       struct expr_info * v1;
  {
    struct expr_info *e1 = (struct expr_info *)v1;
!   VARRAY_CLEAR (e1->occurs);
!   VARRAY_CLEAR (e1->occurstmts);
!   VARRAY_CLEAR (e1->reals);
!   VARRAY_CLEAR (e1->realstmts);
!   VARRAY_CLEAR (e1->phis);
!   VARRAY_CLEAR (e1->erefs);
!   VARRAY_CLEAR (e1->refs);
!   /*free (e1);*/
  }
  
  /* dfphis and varphis, from the paper. */
*************** rename_2 (ei, rename2_set)
*** 698,704 ****
  	      
  	      if (!X)
  	        {
! 	          VARRAY_FREE (Y);
  		  continue;
  	        }
  	      
--- 701,707 ----
  	      
  	      if (!X)
  	        {
! 	          VARRAY_CLEAR (Y);
  		  continue;
  	        }
  	      
*************** rename_2 (ei, rename2_set)
*** 775,781 ****
                  }
  	      /* processed (w) <- true */
  	      bitmap_set_bit (EXPRPHI_PROCESSED (phiZ), i);
!               VARRAY_FREE (Y); 
              }
          }
      }
--- 778,784 ----
                  }
  	      /* processed (w) <- true */
  	      bitmap_set_bit (EXPRPHI_PROCESSED (phiZ), i);
!               VARRAY_CLEAR (Y); 
              }
          }
      }
*************** catch it in rename_2 or during downsafet
*** 1021,1029 ****
        EXPRUSE_DEF (ref) = NULL;
      }
    fibheap_delete (fh);
!   VARRAY_FREE (stack);
!   VARRAY_FREE (rename2_set);
!   VARRAY_FREE (recheck_set);
    splay_tree_delete (touched_set);
  }
  
--- 1024,1032 ----
        EXPRUSE_DEF (ref) = NULL;
      }
    fibheap_delete (fh);
!   VARRAY_CLEAR (stack);
!   VARRAY_CLEAR (rename2_set);
!   VARRAY_CLEAR (recheck_set);
    splay_tree_delete (touched_set);
  }
  
*************** code_motion (ei, temp)
*** 1610,1619 ****
    while (!fibheap_empty (exprs))
      {
        use = fibheap_extract_min (exprs);
-       if (EXPRREF_BB (use)->index == 104 && EXPRREF_TYPE (use) == EXPRUSE)
- 	{
- 	  EXPRREF_TYPE (use) = EXPRUSE;
- 	}
        if (EXPRREF_TYPE (use) == EXPRUSE /*&& !EXPRUSE_PHIOP (use) */
  	  && !EXPRREF_INSERTED (use))
  	{
--- 1613,1618 ----
*************** tree_perform_ssapre ()
*** 1783,1793 ****
  	  varref ref = VARRAY_GENERIC_PTR (bbrefs, j);
  	  tree expr = VARREF_EXPR (ref);
  	  tree stmt = VARREF_STMT (ref);
- 	  if ((strcmp (IDENTIFIER_POINTER (DECL_NAME (VARREF_SYM (ref))), "la") == 0) 
- 	      && VARREF_BB (ref)->index == 104)
- 	    {
- 	      expr = VARREF_EXPR (ref);	      
- 	    }
  	  if (VARREF_TYPE (ref) != VARUSE)
  	    continue;
  	  if (htab_find (seen, expr) != NULL)
--- 1782,1787 ----
*************** tree_perform_ssapre ()
*** 1817,1823 ****
  		}
  	      else
  		{
! 		  slot = xmalloc (sizeof (struct expr_info));
  		  slot->expr = expr;
  		  VARRAY_TREE_INIT (slot->occurs, 1, "Kills and occurrence");
  		  VARRAY_TREE_INIT (slot->occurstmts, 1, 
--- 1811,1817 ----
  		}
  	      else
  		{
! 		  slot = ggc_alloc (sizeof (struct expr_info));
  		  slot->expr = expr;
  		  VARRAY_TREE_INIT (slot->occurs, 1, "Kills and occurrence");
  		  VARRAY_TREE_INIT (slot->occurstmts, 1, 
*************** tree_perform_ssapre ()
*** 1868,1875 ****
    
    for (j = 0; j < VARRAY_ACTIVE_SIZE (bexprs); j++)
      free_expr_info (VARRAY_GENERIC_PTR (bexprs, j));
!   VARRAY_FREE (bexprs);
    htab_delete (seen);
    free (pre_preorder);
    sbitmap_vector_free (pre_dfs);
    sbitmap_vector_free (domchildren);
--- 1862,1870 ----
    
    for (j = 0; j < VARRAY_ACTIVE_SIZE (bexprs); j++)
      free_expr_info (VARRAY_GENERIC_PTR (bexprs, j));
!   VARRAY_CLEAR (bexprs);
    htab_delete (seen);
+   free_dominance_info (pre_idom);
    free (pre_preorder);
    sbitmap_vector_free (pre_dfs);
    sbitmap_vector_free (domchildren);



More information about the Gcc-patches mailing list