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]

[tree-ssa] vars_to_rename conversion to bitmap


[ This is another piece of infrastructure on the road to a better
  dominator based jump threader.... ]


This patch cleans up how the optimizers communicate with the main driver
in regards to new variables and variables that need to be renamed after
an optimization pass.

We've got some rather unpleasant problems lurking as long as we continue
to use sbitmaps for this purpose.  Consider what happens when something
like PRE creates new variables with new PHI nodes and a later DOM pass
attempts to thread across one of those new PHIs....

The way this is supposed to work is that DOM will mark those variables as
needing to be taken out of SSA form, then put back into SSA form after the
CFG has been updated.  But the size of the sbitmap passed into the
dominator optimizer will not be large enough in this case.  Leading to
all kinds of problems since we'll be setting bits outside the accepted
range of the sbitmap.

At the same time we have this wonderful code in tree-sra.c:

        size_t i;
                                                                              
        *vars_to_rename_p = sbitmap_realloc (*vars_to_rename_p,
                                             num_referenced_vars);
        sbitmap_zero (*vars_to_rename_p);

        /* Mark the new scalar replacements.  */
        for (i = old_num_referenced_vars; i < num_referenced_vars; i++)
          SET_BIT (*vars_to_rename_p, i);

        /* Also mark existing structures that were modified during the
           scalarization process.  */
        EXECUTE_IF_SET_IN_SBITMAP (vars_to_rename, 0, i,
          SET_BIT (*vars_to_rename_p, i));
 
Which is basically dealing with the same problem -- sra exposes totally
new variables, so it has to expand the sbitmap.  Ugh.  I don't want to
replicate this gunk.


And in some cases we've got glaring inefficiencies.  Consider this
code in rewrite_into_ssa:


    /* Initialize the array of variables to rename.  */
    if (vars == NULL)
      {
        vars_to_rename = sbitmap_alloc (num_referenced_vars);
        sbitmap_ones (vars_to_rename);
      }
    else
      {
        vars_to_rename = vars;
        remove_all_phi_nodes_for (vars_to_rename);
      }
                                                                               
Then in prepare_operand_for_rename:

    /* Ignore variables that don't need to be renamed.  */
    if (!TEST_BIT (vars_to_rename, *uid_p))
      return false;
                                                                               



So, for the first call into the rewriter, we generate an all-ones sbitmap,
then proceed to test its elements for *every operand in the function*.  Egad.


And in general, these bitmaps are expected to be very sparse.  It's just rather
silly for them to be sbitmaps.

This patch turns them into "bitmaps".  They have the nice property that
they can grow implicitly since they have no fixed size.  Thus, we don't have
to worry about the wonderful interactions between PRE & DOM, everything
just works.  We don't have to play those wonderful games in tree-sra.c to
reallocate the sbitmap if we expose new variables and for good measure, I
killed the "test an all-ones bitmap" for every operand sillyness.

Ultimately this is compile-time neutral.  The cleanups are really what I'm
after anyway.

Bootstrapped and regression tested on i686-pc-linux-gnu.

	* tree-dfa.c (mark_new_vars_to_rename): Change VARS_TO_RENAME to be
	a "bitmap" instead of an "sbitmap".  Callers updated.
	* tree-must-alias.c (promote_var): Likewise.
	(tree_compute_must_alias): Likewise.
	* tree-phinodes.c (remove_all_phi_nodes_for): Likewise.
	* tree-ssa-dom.c (tree_ssa_dominator_thread_jumps): Likewise.
	(tree_ssa_dominator_optimize): Likewise.
	(tree_ssa_dominator_optimize_1): Likewise.
	* tree-ssa-pre.c (pre_expression): Likewise.
	(tree_perform_ssapre): Likewise.
	* tree-ssa.c (rewrite_into_ssa): Likewise. 
	(insert_phi_nodes): If VARS_TO_RENAME is zero, then examine
	each node to determine if we need to insert a PHI.
	(prepare_operand_for_rename): If VARS_TO_RENAME is zero, then
	assume the operand needs renaming.
	* tree-ssa-ccp.c (substitute_and_fold): Change VARS_TO_RENAME to
	be a "bitmap" instead of an "sbitmap".  Callers updated.
	(tree_ssa_ccp): Likewise.  Also make sure timevar_pop encloses
	entire function.
	(scalarize_modify_expr): Likewise.
	* tree-sra.c (create_scalar_copies): Change VARS_TO_RENAME to
	be a "bitmap" instead of an "sbitmap".  Callers updated.
	(tree_sra): Likewise.
	* tree-optimize.c (optimize_function_tree): Make VARS_TO_RENAME
	be a "bitmap" instead of an "sbitmap".
	* tree-flow.h: Update various prototypes.


Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-dfa.c,v
retrieving revision 1.1.4.197
diff -c -3 -p -r1.1.4.197 tree-dfa.c
*** tree-dfa.c	4 Dec 2003 19:40:23 -0000	1.1.4.197
--- tree-dfa.c	5 Dec 2003 21:23:57 -0000
*************** vdefs_disappeared_p (varray_type vdefs_b
*** 2684,2700 ****
     VARS_TO_RENAME.  */
  
  void
! mark_new_vars_to_rename (tree stmt, sbitmap vars_to_rename)
  {
    varray_type ops;
    size_t i;
!   sbitmap vars_in_vops_to_rename;
    bool found_exposed_symbol = false;
    varray_type vdefs_before, vdefs_after;
    stmt_ann_t ann;
  
!   vars_in_vops_to_rename = sbitmap_alloc (num_referenced_vars);
!   sbitmap_zero (vars_in_vops_to_rename);
  
    /* Before re-scanning the statement for operands, mark the existing
       virtual operands to be renamed again.  We do this because when new
--- 2684,2699 ----
     VARS_TO_RENAME.  */
  
  void
! mark_new_vars_to_rename (tree stmt, bitmap vars_to_rename)
  {
    varray_type ops;
    size_t i;
!   bitmap vars_in_vops_to_rename;
    bool found_exposed_symbol = false;
    varray_type vdefs_before, vdefs_after;
    stmt_ann_t ann;
  
!   vars_in_vops_to_rename = BITMAP_XMALLOC ();
  
    /* Before re-scanning the statement for operands, mark the existing
       virtual operands to be renamed again.  We do this because when new
*************** mark_new_vars_to_rename (tree stmt, sbit
*** 2712,2718 ****
        tree var = VDEF_RESULT (ops, i);
        if (!DECL_P (var))
  	var = SSA_NAME_VAR (var);
!       SET_BIT (vars_in_vops_to_rename, var_ann (var)->uid);
      }
  
    ops = vuse_ops (ann);
--- 2711,2717 ----
        tree var = VDEF_RESULT (ops, i);
        if (!DECL_P (var))
  	var = SSA_NAME_VAR (var);
!       bitmap_set_bit (vars_in_vops_to_rename, var_ann (var)->uid);
      }
  
    ops = vuse_ops (ann);
*************** mark_new_vars_to_rename (tree stmt, sbit
*** 2721,2727 ****
        tree var = VARRAY_TREE (ops, i);
        if (!DECL_P (var))
  	var = SSA_NAME_VAR (var);
!       SET_BIT (vars_in_vops_to_rename, var_ann (var)->uid);
      }
  
    /* Now force an operand re-scan on the statement and mark any newly
--- 2720,2726 ----
        tree var = VARRAY_TREE (ops, i);
        if (!DECL_P (var))
  	var = SSA_NAME_VAR (var);
!       bitmap_set_bit (vars_in_vops_to_rename, var_ann (var)->uid);
      }
  
    /* Now force an operand re-scan on the statement and mark any newly
*************** mark_new_vars_to_rename (tree stmt, sbit
*** 2736,2742 ****
        if (DECL_P (*var_p))
  	{
  	  found_exposed_symbol = true;
! 	  SET_BIT (vars_to_rename, var_ann (*var_p)->uid);
  	}
      }
  
--- 2735,2741 ----
        if (DECL_P (*var_p))
  	{
  	  found_exposed_symbol = true;
! 	  bitmap_set_bit (vars_to_rename, var_ann (*var_p)->uid);
  	}
      }
  
*************** mark_new_vars_to_rename (tree stmt, sbit
*** 2747,2753 ****
        if (DECL_P (*var_p))
  	{
  	  found_exposed_symbol = true;
! 	  SET_BIT (vars_to_rename, var_ann (*var_p)->uid);
  	}
      }
  
--- 2746,2752 ----
        if (DECL_P (*var_p))
  	{
  	  found_exposed_symbol = true;
! 	  bitmap_set_bit (vars_to_rename, var_ann (*var_p)->uid);
  	}
      }
  
*************** mark_new_vars_to_rename (tree stmt, sbit
*** 2758,2764 ****
        if (DECL_P (var))
  	{
  	  found_exposed_symbol = true;
! 	  SET_BIT (vars_to_rename, var_ann (var)->uid);
  	}
      }
  
--- 2757,2763 ----
        if (DECL_P (var))
  	{
  	  found_exposed_symbol = true;
! 	  bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
  	}
      }
  
*************** mark_new_vars_to_rename (tree stmt, sbit
*** 2769,2775 ****
        if (DECL_P (var))
  	{
  	  found_exposed_symbol = true;
! 	  SET_BIT (vars_to_rename, var_ann (var)->uid);
  	}
      }
  
--- 2768,2774 ----
        if (DECL_P (var))
  	{
  	  found_exposed_symbol = true;
! 	  bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
  	}
      }
  
*************** mark_new_vars_to_rename (tree stmt, sbit
*** 2780,2788 ****
       generated by this statement are not going to be available anymore.  */
    if (found_exposed_symbol
        || vdefs_disappeared_p (vdefs_before, vdefs_after))
!     sbitmap_a_or_b (vars_to_rename, vars_to_rename, vars_in_vops_to_rename);
  
!   sbitmap_free (vars_in_vops_to_rename);
  }
  
  #include "gt-tree-dfa.h"
--- 2779,2787 ----
       generated by this statement are not going to be available anymore.  */
    if (found_exposed_symbol
        || vdefs_disappeared_p (vdefs_before, vdefs_after))
!     bitmap_a_or_b (vars_to_rename, vars_to_rename, vars_in_vops_to_rename);
  
!   BITMAP_XFREE (vars_in_vops_to_rename);
  }
  
  #include "gt-tree-dfa.h"
Index: tree-flow.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-flow.h,v
retrieving revision 1.1.4.163
diff -c -3 -p -r1.1.4.163 tree-flow.h
*** tree-flow.h	4 Dec 2003 05:33:19 -0000	1.1.4.163
--- tree-flow.h	5 Dec 2003 21:24:00 -0000
*************** extern void add_phi_arg (tree *, tree, e
*** 459,465 ****
  extern void remove_phi_arg (tree, basic_block);
  extern void remove_phi_arg_num (tree, int);
  extern void remove_phi_node (tree, tree, basic_block);
! extern void remove_all_phi_nodes_for (sbitmap);
  extern void dump_dfa_stats (FILE *);
  extern void debug_dfa_stats (void);
  extern void debug_referenced_vars (void);
--- 459,465 ----
  extern void remove_phi_arg (tree, basic_block);
  extern void remove_phi_arg_num (tree, int);
  extern void remove_phi_node (tree, tree, basic_block);
! extern void remove_all_phi_nodes_for (bitmap);
  extern void dump_dfa_stats (FILE *);
  extern void debug_dfa_stats (void);
  extern void debug_referenced_vars (void);
*************** extern tree get_virtual_var (tree);
*** 484,490 ****
  extern void add_vuse (tree, tree, voperands_t);
  extern void create_global_var (void);
  extern void add_referenced_tmp_var (tree var);
! extern void mark_new_vars_to_rename (tree, sbitmap);
  
  /* Flags used when computing reaching definitions and reached uses.  */
  #define TDFA_USE_OPS		1 << 0
--- 484,490 ----
  extern void add_vuse (tree, tree, voperands_t);
  extern void create_global_var (void);
  extern void add_referenced_tmp_var (tree var);
! extern void mark_new_vars_to_rename (tree, bitmap);
  
  /* Flags used when computing reaching definitions and reached uses.  */
  #define TDFA_USE_OPS		1 << 0
*************** void record_vars (tree);
*** 498,504 ****
  
  /* In tree-ssa.c  */
  extern void init_tree_ssa (void);
! extern void rewrite_into_ssa (tree, sbitmap, enum tree_dump_index);
  extern void rewrite_out_of_ssa (tree, enum tree_dump_index);
  extern void dump_reaching_defs (FILE *);
  extern void debug_reaching_defs (void);
--- 498,504 ----
  
  /* In tree-ssa.c  */
  extern void init_tree_ssa (void);
! extern void rewrite_into_ssa (tree, bitmap, enum tree_dump_index);
  extern void rewrite_out_of_ssa (tree, enum tree_dump_index);
  extern void dump_reaching_defs (FILE *);
  extern void debug_reaching_defs (void);
*************** extern unsigned int highest_ssa_version;
*** 520,532 ****
  extern void tree_perform_ssapre (tree, enum tree_dump_index);
  
  /* In tree-ssa-ccp.c  */
! void tree_ssa_ccp (tree, sbitmap, enum tree_dump_index);
  bool fold_stmt (tree *);
  tree widen_bitfield (tree, tree, tree);
  
  /* In tree-ssa-dom.c  */
  extern void tree_ssa_dominator_thread_jumps (tree, enum tree_dump_index);
! extern void tree_ssa_dominator_optimize (tree, sbitmap, enum 
tree_dump_index);
  extern void dump_dominator_optimization_stats (FILE *);
  extern void debug_dominator_optimization_stats (void);
  extern void propagate_copy (tree *, tree);
--- 520,532 ----
  extern void tree_perform_ssapre (tree, enum tree_dump_index);
  
  /* In tree-ssa-ccp.c  */
! void tree_ssa_ccp (tree, bitmap, enum tree_dump_index);
  bool fold_stmt (tree *);
  tree widen_bitfield (tree, tree, tree);
  
  /* In tree-ssa-dom.c  */
  extern void tree_ssa_dominator_thread_jumps (tree, enum tree_dump_index);
! extern void tree_ssa_dominator_optimize (tree, bitmap, enum tree_dump_index);
  extern void dump_dominator_optimization_stats (FILE *);
  extern void debug_dominator_optimization_stats (void);
  extern void propagate_copy (tree *, tree);
*************** static inline struct phi_arg_d *phi_elem
*** 541,547 ****
  static inline bool may_propagate_copy (tree, tree);
  
  /* In tree-must-alias.c  */
! void tree_compute_must_alias (tree, sbitmap, enum tree_dump_index);
  
  /* In tree-eh.c  */
  extern void lower_eh_constructs (tree *);
--- 541,547 ----
  static inline bool may_propagate_copy (tree, tree);
  
  /* In tree-must-alias.c  */
! void tree_compute_must_alias (tree, bitmap, enum tree_dump_index);
  
  /* In tree-eh.c  */
  extern void lower_eh_constructs (tree *);
*************** void lower_function_body (tree *);
*** 557,563 ****
  extern bool block_may_fallthru (tree block);
  
  /* In tree-sra.c  */
! void tree_sra (tree, sbitmap *, enum tree_dump_index);
  
  #include "tree-flow-inline.h"
  
--- 557,563 ----
  extern bool block_may_fallthru (tree block);
  
  /* In tree-sra.c  */
! void tree_sra (tree, bitmap, enum tree_dump_index);
  
  #include "tree-flow-inline.h"
  
Index: tree-must-alias.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-must-alias.c,v
retrieving revision 1.1.2.12
diff -c -3 -p -r1.1.2.12 tree-must-alias.c
*** tree-must-alias.c	4 Dec 2003 05:33:19 -0000	1.1.2.12
--- tree-must-alias.c	5 Dec 2003 21:24:01 -0000
*************** Software Foundation, 59 Temple Place - S
*** 43,49 ****
  
  /* Local functions.  */
  static void find_addressable_vars (sbitmap);
! static void promote_var (tree, sbitmap);
  static inline int find_variable_in (varray_type, tree);
  static inline void remove_element_from (varray_type, size_t);
  
--- 43,49 ----
  
  /* Local functions.  */
  static void find_addressable_vars (sbitmap);
! static void promote_var (tree, bitmap);
  static inline int find_variable_in (varray_type, tree);
  static inline void remove_element_from (varray_type, size_t);
  
*************** static int dump_flags;
*** 65,71 ****
     dumping debugging information.  */
  
  void
! tree_compute_must_alias (tree fndecl, sbitmap vars_to_rename,
  			 enum tree_dump_index phase)
  {
    size_t i;
--- 65,71 ----
     dumping debugging information.  */
  
  void
! tree_compute_must_alias (tree fndecl, bitmap vars_to_rename,
  			 enum tree_dump_index phase)
  {
    size_t i;
*************** tree_compute_must_alias (tree fndecl, sb
*** 77,83 ****
    dump_file = dump_begin (phase, &dump_flags);
  
    /* Initialize internal data structures.  */
!   sbitmap_zero (vars_to_rename);
  
    addresses_needed = sbitmap_alloc (num_referenced_vars);
    sbitmap_zero (addresses_needed);
--- 77,83 ----
    dump_file = dump_begin (phase, &dump_flags);
  
    /* Initialize internal data structures.  */
!   bitmap_clear (vars_to_rename);
  
    addresses_needed = sbitmap_alloc (num_referenced_vars);
    sbitmap_zero (addresses_needed);
*************** find_addressable_vars (sbitmap addresses
*** 194,200 ****
     bitmap.  */
  
  static void
! promote_var (tree var, sbitmap vars_to_rename)
  {
    int ix;
    var_ann_t ann = var_ann (var);
--- 194,200 ----
     bitmap.  */
  
  static void
! promote_var (tree var, bitmap vars_to_rename)
  {
    int ix;
    var_ann_t ann = var_ann (var);
*************** promote_var (tree var, sbitmap vars_to_r
*** 212,218 ****
        for (i = 0; i < VARRAY_ACTIVE_SIZE (ann->may_aliases); i++)
  	{
  	  tree alias = VARRAY_TREE (ann->may_aliases, i);
! 	  SET_BIT (vars_to_rename, var_ann (alias)->uid);
  	}
      }
  
--- 212,218 ----
        for (i = 0; i < VARRAY_ACTIVE_SIZE (ann->may_aliases); i++)
  	{
  	  tree alias = VARRAY_TREE (ann->may_aliases, i);
! 	  bitmap_set_bit (vars_to_rename, var_ann (alias)->uid);
  	}
      }
  
*************** promote_var (tree var, sbitmap vars_to_r
*** 241,247 ****
  	  if (ix >= 0)
  	    {
  	      remove_element_from (aliases, (size_t) ix);
! 	      SET_BIT (vars_to_rename, var_ann (aliased_var)->uid);
  
  	      /* Completely remove the may-alias array if it's empty.  */
  	      if (VARRAY_ACTIVE_SIZE (aliases) == 0)
--- 241,247 ----
  	  if (ix >= 0)
  	    {
  	      remove_element_from (aliases, (size_t) ix);
! 	      bitmap_set_bit (vars_to_rename, var_ann (aliased_var)->uid);
  
  	      /* Completely remove the may-alias array if it's empty.  */
  	      if (VARRAY_ACTIVE_SIZE (aliases) == 0)
*************** promote_var (tree var, sbitmap vars_to_r
*** 254,260 ****
      }
  
    /* Add VAR to the list of variables to rename.  */
!   SET_BIT (vars_to_rename, var_ann (var)->uid);
  
    /* Remove VAR from CALL_CLOBBERED_VARS.  */
    ix = find_variable_in (call_clobbered_vars, var);
--- 254,260 ----
      }
  
    /* Add VAR to the list of variables to rename.  */
!   bitmap_set_bit (vars_to_rename, var_ann (var)->uid);
  
    /* Remove VAR from CALL_CLOBBERED_VARS.  */
    ix = find_variable_in (call_clobbered_vars, var);
Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 1.1.4.86
diff -c -3 -p -r1.1.4.86 tree-optimize.c
*** tree-optimize.c	4 Dec 2003 19:58:23 -0000	1.1.4.86
--- tree-optimize.c	5 Dec 2003 21:24:01 -0000
*************** optimize_function_tree (tree fndecl, tre
*** 73,79 ****
       VARS_TO_RENAME bitmap and call rewrite_into_ssa() afterwards.  */
    if (n_basic_blocks > 0)
      {
!       sbitmap vars_to_rename;
  
  #ifdef ENABLE_CHECKING
        verify_stmts ();
--- 73,79 ----
       VARS_TO_RENAME bitmap and call rewrite_into_ssa() afterwards.  */
    if (n_basic_blocks > 0)
      {
!       bitmap vars_to_rename;
  
  #ifdef ENABLE_CHECKING
        verify_stmts ();
*************** optimize_function_tree (tree fndecl, tre
*** 107,125 ****
  
        /* Set up VARS_TO_RENAME to allow passes to inform which variables
  	 need to be renamed.  */
!       vars_to_rename = sbitmap_alloc (num_referenced_vars);
  
        /* Perform dominator optimizations.  */
        if (flag_tree_dom)
  	{
  	  tree_ssa_dominator_thread_jumps (fndecl, TDI_thread_jumps);
  
! 	  sbitmap_zero (vars_to_rename);
  	  tree_ssa_dominator_optimize (fndecl, vars_to_rename, TDI_dom_1);
  
  	  /* If the dominator optimizations exposed new variables, we need
  	      to repeat the SSA renaming process for those symbols.  */
! 	  if (sbitmap_first_set_bit (vars_to_rename) >= 0)
  	    rewrite_into_ssa (fndecl, vars_to_rename, TDI_ssa_2);
  	}
  
--- 107,125 ----
  
        /* Set up VARS_TO_RENAME to allow passes to inform which variables
  	 need to be renamed.  */
!       vars_to_rename = BITMAP_XMALLOC ();
  
        /* Perform dominator optimizations.  */
        if (flag_tree_dom)
  	{
  	  tree_ssa_dominator_thread_jumps (fndecl, TDI_thread_jumps);
  
! 	  bitmap_clear (vars_to_rename);
  	  tree_ssa_dominator_optimize (fndecl, vars_to_rename, TDI_dom_1);
  
  	  /* If the dominator optimizations exposed new variables, we need
  	      to repeat the SSA renaming process for those symbols.  */
! 	  if (bitmap_first_set_bit (vars_to_rename) >= 0)
  	    rewrite_into_ssa (fndecl, vars_to_rename, TDI_ssa_2);
  	}
  
*************** optimize_function_tree (tree fndecl, tre
*** 142,152 ****
  	 from variables that used to have their address taken.  */
        if (flag_tree_must_alias)
  	{
! 	  sbitmap_zero (vars_to_rename);
  	  tree_compute_must_alias (fndecl, vars_to_rename, TDI_mustalias);
  
  	  /* Run the SSA pass again if we need to rename new variables.  */
! 	  if (sbitmap_first_set_bit (vars_to_rename) >= 0)
  	    rewrite_into_ssa (fndecl, vars_to_rename, TDI_ssa_3);
            ggc_collect ();
  	}
--- 142,152 ----
  	 from variables that used to have their address taken.  */
        if (flag_tree_must_alias)
  	{
! 	  bitmap_clear (vars_to_rename);
  	  tree_compute_must_alias (fndecl, vars_to_rename, TDI_mustalias);
  
  	  /* Run the SSA pass again if we need to rename new variables.  */
! 	  if (bitmap_first_set_bit (vars_to_rename) >= 0)
  	    rewrite_into_ssa (fndecl, vars_to_rename, TDI_ssa_3);
            ggc_collect ();
  	}
*************** optimize_function_tree (tree fndecl, tre
*** 165,175 ****
        /* Scalarize some structure references.  */
        if (flag_tree_sra)
  	{
! 	  sbitmap_zero (vars_to_rename);
! 	  tree_sra (fndecl, &vars_to_rename, TDI_sra);
  
  	  /* Run the SSA pass again if we need to rename new variables.  */
! 	  if (sbitmap_first_set_bit (vars_to_rename) >= 0)
  	    rewrite_into_ssa (fndecl, vars_to_rename, TDI_ssa_4);
            ggc_collect ();
  	}
--- 165,175 ----
        /* Scalarize some structure references.  */
        if (flag_tree_sra)
  	{
! 	  bitmap_clear (vars_to_rename);
! 	  tree_sra (fndecl, vars_to_rename, TDI_sra);
  
  	  /* Run the SSA pass again if we need to rename new variables.  */
! 	  if (bitmap_first_set_bit (vars_to_rename) >= 0)
  	    rewrite_into_ssa (fndecl, vars_to_rename, TDI_ssa_4);
            ggc_collect ();
  	}
*************** optimize_function_tree (tree fndecl, tre
*** 181,191 ****
        /* Run SCCP (Sparse Conditional Constant Propagation).  */
        if (flag_tree_ccp)
  	{
! 	  sbitmap_zero (vars_to_rename);
  	  tree_ssa_ccp (fndecl, vars_to_rename, TDI_ccp);
  
  	  /* Run the SSA pass again if we need to rename new variables.  */
! 	  if (sbitmap_first_set_bit (vars_to_rename) >= 0)
  	    rewrite_into_ssa (fndecl, vars_to_rename, TDI_ssa_5);
            ggc_collect ();
  	}
--- 181,191 ----
        /* Run SCCP (Sparse Conditional Constant Propagation).  */
        if (flag_tree_ccp)
  	{
! 	  bitmap_clear (vars_to_rename);
  	  tree_ssa_ccp (fndecl, vars_to_rename, TDI_ccp);
  
  	  /* Run the SSA pass again if we need to rename new variables.  */
! 	  if (bitmap_first_set_bit (vars_to_rename) >= 0)
  	    rewrite_into_ssa (fndecl, vars_to_rename, TDI_ssa_5);
            ggc_collect ();
  	}
*************** optimize_function_tree (tree fndecl, tre
*** 208,218 ****
        /* Perform a second pass of dominator optimizations.  */
        if (flag_tree_dom)
  	{
! 	  sbitmap_zero (vars_to_rename);
  	  tree_ssa_dominator_optimize (fndecl, vars_to_rename, TDI_dom_2);
  
  	  /* Run the SSA pass again if we need to rename new variables.  */
! 	  if (sbitmap_first_set_bit (vars_to_rename) >= 0)
  	    rewrite_into_ssa (fndecl, vars_to_rename, TDI_ssa_6);
  	}
  
--- 208,218 ----
        /* Perform a second pass of dominator optimizations.  */
        if (flag_tree_dom)
  	{
! 	  bitmap_clear (vars_to_rename);
  	  tree_ssa_dominator_optimize (fndecl, vars_to_rename, TDI_dom_2);
  
  	  /* Run the SSA pass again if we need to rename new variables.  */
! 	  if (bitmap_first_set_bit (vars_to_rename) >= 0)
  	    rewrite_into_ssa (fndecl, vars_to_rename, TDI_ssa_6);
  	}
  
Index: tree-phinodes.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-phinodes.c,v
retrieving revision 1.1.2.6
diff -c -3 -p -r1.1.2.6 tree-phinodes.c
*** tree-phinodes.c	3 Dec 2003 18:59:22 -0000	1.1.2.6
--- tree-phinodes.c	5 Dec 2003 21:24:03 -0000
*************** remove_phi_node (tree phi, tree prev, ba
*** 461,467 ****
  /* Remove all the PHI nodes for variables in the VARS bitmap.  */
  
  void
! remove_all_phi_nodes_for (sbitmap vars)
  {
    basic_block bb;
  
--- 461,467 ----
  /* Remove all the PHI nodes for variables in the VARS bitmap.  */
  
  void
! remove_all_phi_nodes_for (bitmap vars)
  {
    basic_block bb;
  
*************** remove_all_phi_nodes_for (sbitmap vars)
*** 477,483 ****
  
  	  next = TREE_CHAIN (phi);
  	  /* Only add PHI nodes for variables not in VARS.  */
! 	  if (!TEST_BIT (vars, var_ann (var)->uid))
  	    {
  	      /* If we're not removing this PHI node, then it must have
  		 been rewritten by a previous call into the SSA rewriter.
--- 477,483 ----
  
  	  next = TREE_CHAIN (phi);
  	  /* Only add PHI nodes for variables not in VARS.  */
! 	  if (!bitmap_bit_p (vars, var_ann (var)->uid))
  	    {
  	      /* If we're not removing this PHI node, then it must have
  		 been rewritten by a previous call into the SSA rewriter.
*************** remove_all_phi_nodes_for (sbitmap vars)
*** 510,516 ****
        for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
  	{
  	  tree var = SSA_NAME_VAR (PHI_RESULT (phi));
! 	  if (TEST_BIT (vars, var_ann (var)->uid))
  	    abort ();
  	}
  #endif
--- 510,516 ----
        for (phi = phi_nodes (bb); phi; phi = TREE_CHAIN (phi))
  	{
  	  tree var = SSA_NAME_VAR (PHI_RESULT (phi));
! 	  if (bitmap_bit_p (vars, var_ann (var)->uid))
  	    abort ();
  	}
  #endif
Index: tree-sra.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-sra.c,v
retrieving revision 1.1.2.5
diff -c -3 -p -r1.1.2.5 tree-sra.c
*** tree-sra.c	4 Dec 2003 05:33:19 -0000	1.1.2.5
--- tree-sra.c	5 Dec 2003 21:24:04 -0000
*************** static sbitmap sra_candidates;
*** 77,83 ****
     scalar replacements created during this pass.  At the end of the pass,
     a new set is created with all the variables in this set and all the new
     scalar replacements.  */
! static sbitmap vars_to_rename;
  
  /* Set of scalarizable PARM_DECLs that need copy-in operations at the
     beginning of the function.  */
--- 77,83 ----
     scalar replacements created during this pass.  At the end of the pass,
     a new set is created with all the variables in this set and all the new
     scalar replacements.  */
! static bitmap vars_to_rename;
  
  /* Set of scalarizable PARM_DECLs that need copy-in operations at the
     beginning of the function.  */
*************** create_scalar_copies (tree lhs, tree rhs
*** 438,444 ****
        for (i = 0; vdefs && i < NUM_VDEFS (vdefs); i++)
  	{
  	  tree sym = VDEF_RESULT (vdefs, i);
! 	  SET_BIT (vars_to_rename, var_ann (sym)->uid);
  	}
  
        /* Set RHS to be the new temporary TMP.  */
--- 438,444 ----
        for (i = 0; vdefs && i < NUM_VDEFS (vdefs); i++)
  	{
  	  tree sym = VDEF_RESULT (vdefs, i);
! 	  bitmap_set_bit (vars_to_rename, var_ann (sym)->uid);
  	}
  
        /* Set RHS to be the new temporary TMP.  */
*************** create_scalar_copies (tree lhs, tree rhs
*** 541,547 ****
        if (mode == SCALAR_FIELD || mode == SCALAR_SCALAR)
  	{
  	  /* If the LHS has been scalarized, mark it for renaming.  */
! 	  SET_BIT (vars_to_rename, var_ann (lhs)->uid);
  	}
        else if (mode == FIELD_SCALAR)
  	{
--- 541,547 ----
        if (mode == SCALAR_FIELD || mode == SCALAR_SCALAR)
  	{
  	  /* If the LHS has been scalarized, mark it for renaming.  */
! 	  bitmap_set_bit (vars_to_rename, var_ann (lhs)->uid);
  	}
        else if (mode == FIELD_SCALAR)
  	{
*************** create_scalar_copies (tree lhs, tree rhs
*** 557,563 ****
  	  for (i = 0; vdefs && i < NUM_VDEFS (vdefs); i++)
  	    {
  	      tree sym = VDEF_RESULT (vdefs, i);
! 	      SET_BIT (vars_to_rename, var_ann (sym)->uid);
  	    }
  	}
        else
--- 557,563 ----
  	  for (i = 0; vdefs && i < NUM_VDEFS (vdefs); i++)
  	    {
  	      tree sym = VDEF_RESULT (vdefs, i);
! 	      bitmap_set_bit (vars_to_rename, var_ann (sym)->uid);
  	    }
  	}
        else
*************** scalarize_modify_expr (block_stmt_iterat
*** 676,682 ****
        if (NUM_VDEFS (vdefs) != 1)
  	abort ();
        sym = SSA_NAME_VAR (VDEF_RESULT (vdefs, 0));
!       SET_BIT (vars_to_rename, var_ann (sym)->uid);
      }
  
    /* Found ... = AGGREGATE.FIELD  */
--- 676,682 ----
        if (NUM_VDEFS (vdefs) != 1)
  	abort ();
        sym = SSA_NAME_VAR (VDEF_RESULT (vdefs, 0));
!       bitmap_set_bit (vars_to_rename, var_ann (sym)->uid);
      }
  
    /* Found ... = AGGREGATE.FIELD  */
*************** scalarize_return_expr (block_stmt_iterat
*** 851,857 ****
     4- Determine what's a good value for MAX_NFIELDS_FOR_SRA.  */
  
  void
! tree_sra (tree fndecl, sbitmap *vars_to_rename_p, enum tree_dump_index phase)
  {
    size_t old_num_referenced_vars;
  
--- 851,857 ----
     4- Determine what's a good value for MAX_NFIELDS_FOR_SRA.  */
  
  void
! tree_sra (tree fndecl, bitmap vars, enum tree_dump_index phase)
  {
    size_t old_num_referenced_vars;
  
*************** tree_sra (tree fndecl, sbitmap *vars_to_
*** 863,872 ****
    sra_candidates = sbitmap_alloc (num_referenced_vars);
    sbitmap_zero (sra_candidates);
    sra_map = NULL;
-   vars_to_rename = NULL;
    needs_copy_in = NULL;
    old_num_referenced_vars = num_referenced_vars;
  
    /* Find structures to be scalarized.  */
    find_candidates_for_sra ();
  
--- 863,873 ----
    sra_candidates = sbitmap_alloc (num_referenced_vars);
    sbitmap_zero (sra_candidates);
    sra_map = NULL;
    needs_copy_in = NULL;
    old_num_referenced_vars = num_referenced_vars;
  
+   vars_to_rename = vars;
+ 
    /* Find structures to be scalarized.  */
    find_candidates_for_sra ();
  
*************** tree_sra (tree fndecl, sbitmap *vars_to_
*** 876,884 ****
      {
        sra_map = xcalloc (num_referenced_vars, sizeof (tree *));
  
-       vars_to_rename = sbitmap_alloc (num_referenced_vars);
-       sbitmap_zero (vars_to_rename);
- 
        needs_copy_in = sbitmap_alloc (num_referenced_vars);
        sbitmap_zero (needs_copy_in);
  
--- 877,882 ----
*************** tree_sra (tree fndecl, sbitmap *vars_to_
*** 889,906 ****
  	{
  	  size_t i;
  
- 	  *vars_to_rename_p = sbitmap_realloc (*vars_to_rename_p,
- 					       num_referenced_vars);
- 	  sbitmap_zero (*vars_to_rename_p);
- 
  	  /* Mark the new scalar replacements.  */
  	  for (i = old_num_referenced_vars; i < num_referenced_vars; i++)
! 	    SET_BIT (*vars_to_rename_p, i);
! 
! 	  /* Also mark existing structures that were modified during the
! 	     scalarization process.  */
! 	  EXECUTE_IF_SET_IN_SBITMAP (vars_to_rename, 0, i,
! 	    SET_BIT (*vars_to_rename_p, i));
  	}
      }
  
--- 887,895 ----
  	{
  	  size_t i;
  
  	  /* Mark the new scalar replacements.  */
  	  for (i = old_num_referenced_vars; i < num_referenced_vars; i++)
! 	    bitmap_set_bit (vars_to_rename, i);
  	}
      }
  
Index: tree-ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-ccp.c,v
retrieving revision 1.1.2.120
diff -c -3 -p -r1.1.2.120 tree-ssa-ccp.c
*** tree-ssa-ccp.c	4 Dec 2003 05:33:19 -0000	1.1.2.120
--- tree-ssa-ccp.c	5 Dec 2003 21:24:07 -0000
*************** static void def_to_varying (tree);
*** 112,118 ****
  static void set_lattice_value (tree, value);
  static void simulate_block (basic_block);
  static void simulate_stmt (tree);
! static void substitute_and_fold (sbitmap);
  static value evaluate_stmt (tree);
  static void dump_lattice_value (FILE *, const char *, value);
  static bool replace_uses_in (tree, bool *);
--- 112,118 ----
  static void set_lattice_value (tree, value);
  static void simulate_block (basic_block);
  static void simulate_stmt (tree);
! static void substitute_and_fold (bitmap);
  static value evaluate_stmt (tree);
  static void dump_lattice_value (FILE *, const char *, value);
  static bool replace_uses_in (tree, bool *);
*************** static int dump_flags;
*** 144,150 ****
     dumping debugging information.  */
  
  void
! tree_ssa_ccp (tree fndecl, sbitmap vars_to_rename, enum tree_dump_index 
phase)
  {
    timevar_push (TV_TREE_CCP);
  
--- 144,150 ----
     dumping debugging information.  */
  
  void
! tree_ssa_ccp (tree fndecl, bitmap vars_to_rename, enum tree_dump_index phase)
  {
    timevar_push (TV_TREE_CCP);
  
*************** tree_ssa_ccp (tree fndecl, sbitmap vars_
*** 191,198 ****
    /* Free allocated memory.  */
    finalize ();
  
-   timevar_pop (TV_TREE_CCP);
- 
    /* Debugging dumps.  */
    if (dump_file)
      {
--- 191,196 ----
*************** tree_ssa_ccp (tree fndecl, sbitmap vars_
*** 206,211 ****
--- 204,211 ----
        dump_function_to_file (fndecl, dump_file, dump_flags);
        dump_end (phase, dump_file);
      }
+ 
+   timevar_pop (TV_TREE_CCP);
  }
  
  
*************** simulate_stmt (tree use_stmt)
*** 323,329 ****
     should still be in SSA form.  */
  
  static void
! substitute_and_fold (sbitmap vars_to_rename)
  {
    basic_block bb;
  
--- 323,329 ----
     should still be in SSA form.  */
  
  static void
! substitute_and_fold (bitmap vars_to_rename)
  {
    basic_block bb;
  
Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-dom.c,v
retrieving revision 1.1.2.91
diff -c -3 -p -r1.1.2.91 tree-ssa-dom.c
*** tree-ssa-dom.c	3 Dec 2003 16:06:34 -0000	1.1.2.91
--- tree-ssa-dom.c	5 Dec 2003 21:24:12 -0000
*************** static bool cfg_altered;
*** 80,86 ****
  
  /* This pass can expose additional variables to rename.  We track them in
     this bitmap.  */
! static sbitmap vars_to_rename;
  
  /* Nonzero if we should thread jumps through blocks which contain PHI
     nodes.  This is not safe once we have performed any transformation
--- 80,86 ----
  
  /* This pass can expose additional variables to rename.  We track them in
     this bitmap.  */
! static bitmap vars_to_rename;
  
  /* Nonzero if we should thread jumps through blocks which contain PHI
     nodes.  This is not safe once we have performed any transformation
*************** tree_ssa_dominator_thread_jumps (tree fn
*** 291,298 ****
    /* The jump threader will always perform any necessary rewriting, so
       we do not expose VAR_TO_RENAME to our caller, we just allocate and
       deallocate one here.  */
!   vars_to_rename = sbitmap_alloc (num_referenced_vars);
!   sbitmap_zero (vars_to_rename);
  
    /* Mark loop edges so we avoid threading across loop boundaries.
       This may result in transformating natural loop into irreducible
--- 291,297 ----
    /* The jump threader will always perform any necessary rewriting, so
       we do not expose VAR_TO_RENAME to our caller, we just allocate and
       deallocate one here.  */
!   vars_to_rename = BITMAP_XMALLOC ();
  
    /* Mark loop edges so we avoid threading across loop boundaries.
       This may result in transformating natural loop into irreducible
*************** tree_ssa_dominator_thread_jumps (tree fn
*** 301,307 ****
  
    tree_ssa_dominator_optimize_1 (fndecl, phase, TV_TREE_SSA_THREAD_JUMPS);
  
!   sbitmap_free (vars_to_rename);
  }
  
  /* Optimize function FNDECL based on the dominator tree.  This does
--- 300,306 ----
  
    tree_ssa_dominator_optimize_1 (fndecl, phase, TV_TREE_SSA_THREAD_JUMPS);
  
!   BITMAP_XFREE (vars_to_rename);
  }
  
  /* Optimize function FNDECL based on the dominator tree.  This does
*************** tree_ssa_dominator_thread_jumps (tree fn
*** 316,322 ****
     dumping debugging information.  */
  
  void
! tree_ssa_dominator_optimize (tree fndecl, sbitmap vars,
  			     enum tree_dump_index phase)
  {
    /* Indicate we can not thread through blocks with PHI nodes.  */
--- 315,321 ----
     dumping debugging information.  */
  
  void
! tree_ssa_dominator_optimize (tree fndecl, bitmap vars,
  			     enum tree_dump_index phase)
  {
    /* Indicate we can not thread through blocks with PHI nodes.  */
*************** tree_ssa_dominator_optimize (tree fndecl
*** 326,332 ****
       walker datastructure this (along with other pass-global data) should
       move into that structure.  */
    vars_to_rename = vars;
! 
    tree_ssa_dominator_optimize_1 (fndecl, phase, TV_TREE_SSA_DOMINATOR_OPTS);
  }
  
--- 325,331 ----
       walker datastructure this (along with other pass-global data) should
       move into that structure.  */
    vars_to_rename = vars;
!  
    tree_ssa_dominator_optimize_1 (fndecl, phase, TV_TREE_SSA_DOMINATOR_OPTS);
  }
  
*************** tree_ssa_dominator_optimize_1 (tree fnde
*** 469,475 ****
  		 all the PHI arguments are different versions of the same variable,
  		 so we only need to mark the underlying variable for PHI_RESULT.  */
  	      for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi))
! 		SET_BIT (vars_to_rename, var_ann (SSA_NAME_VAR (PHI_RESULT (phi)))->uid);
  
  	      e = redirect_edge_and_branch (e, tgt);
  	      
--- 468,474 ----
  		 all the PHI arguments are different versions of the same variable,
  		 so we only need to mark the underlying variable for PHI_RESULT.  */
  	      for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi))
! 		bitmap_set_bit (vars_to_rename, var_ann (SSA_NAME_VAR (PHI_RESULT (phi)))->
uid);
  
  	      e = redirect_edge_and_branch (e, tgt);
  	      
*************** tree_ssa_dominator_optimize_1 (tree fnde
*** 501,510 ****
        /* If we are going to iterate (CFG_ALTERED is true), then we must
  	 perform any queued renaming before the next iteration.  */
        if (cfg_altered
! 	  && sbitmap_first_set_bit (vars_to_rename) >= 0)
  	{
  	  rewrite_into_ssa (fndecl, vars_to_rename, TDI_none);
! 	  sbitmap_zero (vars_to_rename);
  	  VARRAY_GROW (const_and_copies, highest_ssa_version);
  	  VARRAY_GROW (vrp_data, highest_ssa_version);
  	  VARRAY_GROW (nonzero_vars, highest_ssa_version);
--- 500,509 ----
        /* If we are going to iterate (CFG_ALTERED is true), then we must
  	 perform any queued renaming before the next iteration.  */
        if (cfg_altered
! 	  && bitmap_first_set_bit (vars_to_rename) >= 0)
  	{
  	  rewrite_into_ssa (fndecl, vars_to_rename, TDI_none);
! 	  bitmap_zero (vars_to_rename);
  	  VARRAY_GROW (const_and_copies, highest_ssa_version);
  	  VARRAY_GROW (vrp_data, highest_ssa_version);
  	  VARRAY_GROW (nonzero_vars, highest_ssa_version);
Index: tree-ssa-pre.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-pre.c,v
retrieving revision 1.1.4.113
diff -c -3 -p -r1.1.4.113 tree-ssa-pre.c
*** tree-ssa-pre.c	3 Dec 2003 23:35:52 -0000	1.1.4.113
--- tree-ssa-pre.c	5 Dec 2003 21:24:17 -0000
*************** static bitmap compute_idfs (bitmap *, tr
*** 119,125 ****
  static void set_var_phis (struct expr_info *, tree);
  static inline bool names_match_p (const tree, const tree);
  static bool is_strred_cand (const tree);
! static int pre_expression (struct expr_info *, void *, sbitmap);
  static bool is_injuring_def (struct expr_info *, tree);
  static inline bool okay_injuring_def (tree, tree);
  static bool expr_phi_insertion (bitmap *, struct expr_info *);
--- 119,125 ----
  static void set_var_phis (struct expr_info *, tree);
  static inline bool names_match_p (const tree, const tree);
  static bool is_strred_cand (const tree);
! static int pre_expression (struct expr_info *, void *, bitmap);
  static bool is_injuring_def (struct expr_info *, tree);
  static inline bool okay_injuring_def (tree, tree);
  static bool expr_phi_insertion (bitmap *, struct expr_info *);
*************** process_left_occs_and_kills (varray_type
*** 2981,2987 ****
  /* Perform SSAPRE on an expression.  */
  
  static int
! pre_expression (struct expr_info *slot, void *data, sbitmap vars_to_rename)
  {
    struct expr_info *ei = (struct expr_info *) slot;
    basic_block bb;
--- 2981,2987 ----
  /* Perform SSAPRE on an expression.  */
  
  static int
! pre_expression (struct expr_info *slot, void *data, bitmap vars_to_rename)
  {
    struct expr_info *ei = (struct expr_info *) slot;
    basic_block bb;
*************** pre_expression (struct expr_info *slot, 
*** 3045,3051 ****
        finalize_2 (ei);
        code_motion (ei);
        if (ei->loadpre_cand)
! 	SET_BIT (vars_to_rename, var_ann (ei->temp)->uid);
      }
  
    clear_all_eref_arrays ();
--- 3045,3051 ----
        finalize_2 (ei);
        code_motion (ei);
        if (ei->loadpre_cand)
! 	bitmap_set_bit (vars_to_rename, var_ann (ei->temp)->uid);
      }
  
    clear_all_eref_arrays ();
*************** tree_perform_ssapre (tree fndecl, enum t
*** 3213,3219 ****
    varray_type bexprs;
    size_t k;
    int i;
!   sbitmap vars_to_rename;
   
    split_critical_edges ();  
  
--- 3213,3219 ----
    varray_type bexprs;
    size_t k;
    int i;
!   bitmap vars_to_rename;
   
    split_critical_edges ();  
  
*************** tree_perform_ssapre (tree fndecl, enum t
*** 3258,3266 ****
  
    /* The maximum number of variables we'll add is the number of
       expressions to perform PRE on.  */
!   vars_to_rename = sbitmap_alloc (num_referenced_vars + VARRAY_ACTIVE_SIZE 
(bexprs));
!   
!   sbitmap_zero (vars_to_rename);
    
    for (k = 0; k < VARRAY_ACTIVE_SIZE (bexprs); k++)
      {
--- 3258,3264 ----
  
    /* The maximum number of variables we'll add is the number of
       expressions to perform PRE on.  */
!   vars_to_rename = BITMAP_XMALLOC ();
    
    for (k = 0; k < VARRAY_ACTIVE_SIZE (bexprs); k++)
      {
*************** tree_perform_ssapre (tree fndecl, enum t
*** 3305,3313 ****
    added_phis = NULL;
    
    /* Rewrite any new temporaries load PRE inserted.  */
!   if (sbitmap_first_set_bit (vars_to_rename) != -1)
      rewrite_into_ssa (fndecl, vars_to_rename, TDI_pre);
!   sbitmap_free (vars_to_rename);
    free (dfs_id);
    free (dfs_id_last);
    free (dfn);
--- 3303,3311 ----
    added_phis = NULL;
    
    /* Rewrite any new temporaries load PRE inserted.  */
!   if (bitmap_first_set_bit (vars_to_rename) != -1)
      rewrite_into_ssa (fndecl, vars_to_rename, TDI_pre);
!   BITMAP_XFREE (vars_to_rename);
    free (dfs_id);
    free (dfs_id_last);
    free (dfn);
Index: tree-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa.c,v
retrieving revision 1.1.4.173
diff -c -3 -p -r1.1.4.173 tree-ssa.c
*** tree-ssa.c	5 Dec 2003 02:45:03 -0000	1.1.4.173
--- tree-ssa.c	5 Dec 2003 21:24:23 -0000
*************** struct rewrite_block_data
*** 167,174 ****
  static struct ssa_stats_d ssa_stats;
  
  /* Bitmap representing variables that need to be renamed into SSA form.  */
! static sbitmap vars_to_rename;
! 
  
  /* Local functions.  */
  static void rewrite_finalize_block (struct dom_walk_data *, basic_block, 
tree);
--- 167,173 ----
  static struct ssa_stats_d ssa_stats;
  
  /* Bitmap representing variables that need to be renamed into SSA form.  */
! static bitmap vars_to_rename;
  
  /* Local functions.  */
  static void rewrite_finalize_block (struct dom_walk_data *, basic_block, 
tree);
*************** set_value_for (tree var, tree value, var
*** 337,343 ****
     increased compilation time.  */
  
  void
! rewrite_into_ssa (tree fndecl, sbitmap vars, enum tree_dump_index phase)
  {
    bitmap *dfs;
    dominance_info idom;
--- 336,342 ----
     increased compilation time.  */
  
  void
! rewrite_into_ssa (tree fndecl, bitmap vars, enum tree_dump_index phase)
  {
    bitmap *dfs;
    dominance_info idom;
*************** rewrite_into_ssa (tree fndecl, sbitmap v
*** 351,366 ****
    dump_file = dump_begin (phase, &dump_flags);
  
    /* Initialize the array of variables to rename.  */
!   if (vars == NULL)
!     {
!       vars_to_rename = sbitmap_alloc (num_referenced_vars);
!       sbitmap_ones (vars_to_rename);
!     }
!   else
!     {
!       vars_to_rename = vars;
!       remove_all_phi_nodes_for (vars_to_rename);
!     }
  
    /* Allocate memory for the DEF_BLOCKS hash table.  */
    def_blocks = htab_create (VARRAY_ACTIVE_SIZE (referenced_vars),
--- 350,358 ----
    dump_file = dump_begin (phase, &dump_flags);
  
    /* Initialize the array of variables to rename.  */
!   vars_to_rename = vars;
!   if (vars != NULL)
!     remove_all_phi_nodes_for (vars_to_rename);
  
    /* Allocate memory for the DEF_BLOCKS hash table.  */
    def_blocks = htab_create (VARRAY_ACTIVE_SIZE (referenced_vars),
*************** rewrite_into_ssa (tree fndecl, sbitmap v
*** 479,487 ****
      BITMAP_XFREE (dfs[bb->index]);
    free (dfs);
  
-   if (vars == NULL)
-     sbitmap_free (vars_to_rename);
- 
    htab_delete (def_blocks);
    VARRAY_CLEAR (currdefs);
  
--- 471,476 ----
*************** prepare_operand_for_rename (tree *op_p, 
*** 751,757 ****
    *uid_p = var_ann (var)->uid;
  
    /* Ignore variables that don't need to be renamed.  */
!   if (!TEST_BIT (vars_to_rename, *uid_p))
      return false;
  
    /* The variable needs to be renamed.  If it already had an
--- 740,746 ----
    *uid_p = var_ann (var)->uid;
  
    /* Ignore variables that don't need to be renamed.  */
!   if (vars_to_rename && !bitmap_bit_p (vars_to_rename, *uid_p))
      return false;
  
    /* The variable needs to be renamed.  If it already had an
*************** insert_phi_nodes (bitmap *dfs)
*** 790,803 ****
       to the work list all the blocks that have a definition for the
       variable.  PHI nodes will be added to the dominance frontier blocks of
       each definition block.  */
!   EXECUTE_IF_SET_IN_SBITMAP (vars_to_rename, 0, i,
!     {
!       tree var = referenced_var (i);
!       var_ann_t ann = var_ann (var);
! 
!       if (ann->need_phi_state != NEED_PHI_STATE_NO)
! 	insert_phi_nodes_for (var, dfs);
!     });
  
    work_stack = NULL;
    timevar_pop (TV_TREE_INSERT_PHI_NODES);
--- 779,802 ----
       to the work list all the blocks that have a definition for the
       variable.  PHI nodes will be added to the dominance frontier blocks of
       each definition block.  */
!   if (vars_to_rename)
!     EXECUTE_IF_SET_IN_BITMAP (vars_to_rename, 0, i,
!       {
!         tree var = referenced_var (i);
!         var_ann_t ann = var_ann (var);
!   
!         if (ann->need_phi_state != NEED_PHI_STATE_NO)
!   	  insert_phi_nodes_for (var, dfs);
!       });
!   else
!     for (i = 0; i < num_referenced_vars; i++)
!       {
! 	tree var = referenced_var (i);
! 	var_ann_t ann = var_ann (var);
! 
! 	if (ann->need_phi_state != NEED_PHI_STATE_NO)
! 	  insert_phi_nodes_for (var, dfs);
!       }
  
    work_stack = NULL;
    timevar_pop (TV_TREE_INSERT_PHI_NODES);





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