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]

Care to kill couple of SSA datastructures leaking out of outof-ssa pass.


Hi,
these changes are neccesary to be able to go out of SSA and back, but they are
usefull at their own too, as they just care to clear out and release couple of
datastructures we leaked out of SSA that would kill us later.

There are small memory savings on combine.c (mostly because fewer
datastructures overlaps in liferange)  and no measurable slowdown on compiling
GCC modules.  Bootstrapped/regtested i686-pc-gnu-linux, OK?

Honza

2005-06-27  Jan Hubicka  <jh@suse.cz>
	* tree-optimize.c (exercute_free_datastructures):
	Do not disband implicit edges; do not attempt to build insn list;
	do not free cfg annotations.
	(execute_free_cfg_annotations); Disband implicit edges here;
	free cfg annotations here too.
	(pass_free_cfg_annotations); New pass.
	(init_tree_optimization_passes); Add pass_free_cfg_annotations.
	* tree-ssa-operands.c (free_ssa_operands); Recover; export.
	* tree-ssa-operands.h (free_ssa_operands); declare.
	* tree-ssa.c (delete_tree_ssa); Free SSA operand; mark stmt modified;
	kill PHI nodes.
	* tree-ssanames.c (release_defs): Kill addresses_taken.
Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 2.110
diff -c -3 -p -r2.110 tree-optimize.c
*** tree-optimize.c	23 Jun 2005 22:00:26 -0000	2.110
--- tree-optimize.c	24 Jun 2005 19:38:53 -0000
*************** static struct tree_opt_pass pass_cleanup
*** 120,151 ****
  static void
  execute_free_datastructures (void)
  {
-   tree *chain;
- 
    /* ??? This isn't the right place for this.  Worse, it got computed
       more or less at random in various passes.  */
    free_dominance_info (CDI_DOMINATORS);
! 
!   /* Emit gotos for implicit jumps.  */
!   disband_implicit_edges ();
  
    /* Remove the ssa structures.  Do it here since this includes statement
       annotations that need to be intact during disband_implicit_edges.  */
    delete_tree_ssa ();
  
!   /* Re-chain the statements from the blocks.  */
!   chain = &DECL_SAVED_TREE (current_function_decl);
!   *chain = alloc_stmt_list ();
  
    /* And get rid of annotations we no longer need.  */
    delete_tree_cfg_annotations ();
  }
  
! static struct tree_opt_pass pass_free_datastructures =
  {
    NULL,					/* name */
    NULL,					/* gate */
!   execute_free_datastructures,			/* execute */
    NULL,					/* sub */
    NULL,					/* next */
    0,					/* static_pass_number */
--- 120,180 ----
  static void
  execute_free_datastructures (void)
  {
    /* ??? This isn't the right place for this.  Worse, it got computed
       more or less at random in various passes.  */
    free_dominance_info (CDI_DOMINATORS);
!   free_dominance_info (CDI_POST_DOMINATORS);
  
    /* Remove the ssa structures.  Do it here since this includes statement
       annotations that need to be intact during disband_implicit_edges.  */
    delete_tree_ssa ();
+ }
+ 
+ static struct tree_opt_pass pass_free_datastructures =
+ {
+   NULL,					/* name */
+   NULL,					/* gate */
+   execute_free_datastructures,			/* execute */
+   NULL,					/* sub */
+   NULL,					/* next */
+   0,					/* static_pass_number */
+   0,					/* tv_id */
+   PROP_cfg,				/* properties_required */
+   0,					/* properties_provided */
+   0,					/* properties_destroyed */
+   0,					/* todo_flags_start */
+   0,					/* todo_flags_finish */
+   0					/* letter */
+ };
+ /* Pass: free cfg annotations.  */
+ 
+ static void
+ execute_free_cfg_annotations (void)
+ {
+   basic_block bb;
+   block_stmt_iterator bsi;
  
!   /* Emit gotos for implicit jumps.  */
!   disband_implicit_edges ();
! 
!   /* Remove annotations from every tree in the function.  */
!   FOR_EACH_BB (bb)
!     for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
!       {
! 	tree stmt = bsi_stmt (bsi);
! 	ggc_free (stmt->common.ann);
! 	stmt->common.ann = NULL;
!       }
  
    /* And get rid of annotations we no longer need.  */
    delete_tree_cfg_annotations ();
  }
  
! static struct tree_opt_pass pass_free_cfg_annotations =
  {
    NULL,					/* name */
    NULL,					/* gate */
!   execute_free_cfg_annotations,		/* execute */
    NULL,					/* sub */
    NULL,					/* next */
    0,					/* static_pass_number */
*************** static struct tree_opt_pass pass_free_da
*** 157,163 ****
    0,					/* todo_flags_finish */
    0					/* letter */
  };
- 
  /* Pass: fixup_cfg - IPA passes or compilation of earlier functions might've
     changed some properties - such as marked functions nothrow.  Remove now
     redundant edges and basic blocks.  */
--- 186,191 ----
*************** init_tree_optimization_passes (void)
*** 387,392 ****
--- 415,421 ----
    NEXT_PASS (pass_warn_function_noreturn);
    NEXT_PASS (pass_mudflap_2);
    NEXT_PASS (pass_free_datastructures);
+   NEXT_PASS (pass_free_cfg_annotations);
    NEXT_PASS (pass_expand);
    NEXT_PASS (pass_rest_of_compilation);
    *p = NULL;
Index: tree-ssa-operands.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-operands.c,v
retrieving revision 2.89
diff -c -3 -p -r2.89 tree-ssa-operands.c
*** tree-ssa-operands.c	24 Jun 2005 13:52:35 -0000	2.89
--- tree-ssa-operands.c	24 Jun 2005 19:38:53 -0000
*************** build_ssa_operands (tree stmt)
*** 998,1005 ****
  
  
  /* Free any operands vectors in OPS.  */
! #if 0
! static void 
  free_ssa_operands (stmt_operands_p ops)
  {
    ops->def_ops = NULL;
--- 998,1004 ----
  
  
  /* Free any operands vectors in OPS.  */
! void 
  free_ssa_operands (stmt_operands_p ops)
  {
    ops->def_ops = NULL;
*************** free_ssa_operands (stmt_operands_p ops)
*** 1007,1020 ****
    ops->maydef_ops = NULL;
    ops->mustdef_ops = NULL;
    ops->vuse_ops = NULL;
-   while (ops->memory.next != NULL)
-     {
-       operand_memory_p tmp = ops->memory.next;
-       ops->memory.next = tmp->next;
-       ggc_free (tmp);
-     }
  }
- #endif
  
  
  /* Get the operands of statement STMT.  Note that repeated calls to
--- 1006,1012 ----
Index: tree-ssa-operands.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-operands.h,v
retrieving revision 2.17
diff -c -3 -p -r2.17 tree-ssa-operands.h
*** tree-ssa-operands.h	9 May 2005 17:52:20 -0000	2.17
--- tree-ssa-operands.h	24 Jun 2005 19:38:53 -0000
*************** typedef struct stmt_operands_d *stmt_ope
*** 153,158 ****
--- 153,159 ----
  
  extern void init_ssa_operands (void);
  extern void fini_ssa_operands (void);
+ extern void free_ssa_operands (stmt_operands_p);
  extern void update_stmt_operands (tree);
  extern bool verify_imm_links (FILE *f, tree var);
  
Index: tree-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa.c,v
retrieving revision 2.98
diff -c -3 -p -r2.98 tree-ssa.c
*** tree-ssa.c	15 Jun 2005 20:13:11 -0000	2.98
--- tree-ssa.c	24 Jun 2005 19:38:53 -0000
*************** delete_tree_ssa (void)
*** 819,830 ****
  
    /* Remove annotations from every tree in the function.  */
    FOR_EACH_BB (bb)
!     for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
!       {
! 	tree stmt = bsi_stmt (bsi);
! 	ggc_free (stmt->common.ann);
! 	stmt->common.ann = NULL;
!       }
  
    /* Remove annotations from every referenced variable.  */
    for (i = 0; i < num_referenced_vars; i++)
--- 819,836 ----
  
    /* Remove annotations from every tree in the function.  */
    FOR_EACH_BB (bb)
!     {
!       for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
! 	{
! 	  tree stmt = bsi_stmt (bsi);
! 	  stmt_ann_t ann = get_stmt_ann (stmt);
! 
! 	  free_ssa_operands (&ann->operands);
! 	  ann->addresses_taken = 0;
! 	  mark_stmt_modified (stmt);
! 	}
!       set_phi_nodes (bb, NULL);
!     }
  
    /* Remove annotations from every referenced variable.  */
    for (i = 0; i < num_referenced_vars; i++)
In


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