diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-28 08:50:19 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-28 08:50:19 +0000 |
commit | f003f9fd5d444827a26d75acd2147e791a77ec3d (patch) | |
tree | eeeda80bc63372aa4a48d848ceb4bb06bb28cb7c | |
parent | e6eacc4fd50a0bf2b24ab7f879084f3c90263353 (diff) | |
download | gcc-f003f9fd5d444827a26d75acd2147e791a77ec3d.tar.gz |
2009-04-28 Richard Guenther <rguenther@suse.de>
* tree.h (SSA_NAME_VALUE): Remove.
(struct tree_ssa_name): Remove value_handle member.
* tree-vrp.c (execute_vrp): Initialize/free the value-handle
array for jump threading.
* tree-ssa-propagate.c (ssa_prop_init): Do not initialize
SSA_NAME_VALUEs.
* print-tree.c (print_node): Do not dump SSA_NAME_VALUEs.
* tree-flow.h (threadedge_initialize_values): Declare.
(threadedge_finalize_values): Likewise.
* tree-ssa-threadedge.c (ssa_name_values): New global variable.
(SSA_NAME_VALUE): Define.
(threadedge_initialize_values): New function.
(threadedge_finalize_values): Likewise.
* tree-ssa-dom.c (ssa_name_values): New global variable.
(SSA_NAME_VALUE): Define.
(tree_ssa_dominator_optimize): Initialize/free the value-handle
array.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146877 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 20 | ||||
-rw-r--r-- | gcc/print-tree.c | 5 | ||||
-rw-r--r-- | gcc/tree-flow.h | 8 | ||||
-rw-r--r-- | gcc/tree-ssa-dom.c | 33 | ||||
-rw-r--r-- | gcc/tree-ssa-propagate.c | 6 | ||||
-rw-r--r-- | gcc/tree-ssa-threadedge.c | 33 | ||||
-rw-r--r-- | gcc/tree-vrp.c | 2 | ||||
-rw-r--r-- | gcc/tree.h | 11 |
8 files changed, 73 insertions, 45 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4ca02a38b31..560c03cc053 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,23 @@ +2009-04-28 Richard Guenther <rguenther@suse.de> + + * tree.h (SSA_NAME_VALUE): Remove. + (struct tree_ssa_name): Remove value_handle member. + * tree-vrp.c (execute_vrp): Initialize/free the value-handle + array for jump threading. + * tree-ssa-propagate.c (ssa_prop_init): Do not initialize + SSA_NAME_VALUEs. + * print-tree.c (print_node): Do not dump SSA_NAME_VALUEs. + * tree-flow.h (threadedge_initialize_values): Declare. + (threadedge_finalize_values): Likewise. + * tree-ssa-threadedge.c (ssa_name_values): New global variable. + (SSA_NAME_VALUE): Define. + (threadedge_initialize_values): New function. + (threadedge_finalize_values): Likewise. + * tree-ssa-dom.c (ssa_name_values): New global variable. + (SSA_NAME_VALUE): Define. + (tree_ssa_dominator_optimize): Initialize/free the value-handle + array. + 2009-04-28 Ira Rosen <irar@il.ibm.com> * tree-vect-loop-manip.c (vect_create_cond_for_alias_checks): diff --git a/gcc/print-tree.c b/gcc/print-tree.c index 24ff249c108..2e514436394 100644 --- a/gcc/print-tree.c +++ b/gcc/print-tree.c @@ -896,14 +896,11 @@ print_node (FILE *file, const char *prefix, tree node, int indent) if (SSA_NAME_IN_FREE_LIST (node)) fprintf (file, " in-free-list"); - if (SSA_NAME_PTR_INFO (node) - || SSA_NAME_VALUE (node)) + if (SSA_NAME_PTR_INFO (node)) { indent_to (file, indent + 3); if (SSA_NAME_PTR_INFO (node)) dump_addr (file, " ptr-info ", SSA_NAME_PTR_INFO (node)); - if (SSA_NAME_VALUE (node)) - dump_addr (file, " value ", SSA_NAME_VALUE (node)); } break; diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index 5fe75391ad7..a02eca5275b 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -803,6 +803,14 @@ bool stmt_dominates_stmt_p (gimple, gimple); void mark_virtual_ops_for_renaming (gimple); /* In tree-ssa-threadedge.c */ +extern void threadedge_initialize_values (void); +extern void threadedge_finalize_values (void); +extern VEC(tree,heap) *ssa_name_values; +#define SSA_NAME_VALUE(x) \ + (SSA_NAME_VERSION(x) < VEC_length(tree, ssa_name_values) \ + ? VEC_index(tree, ssa_name_values, SSA_NAME_VERSION(x)) \ + : NULL_TREE) +extern void set_ssa_name_value (tree, tree); extern bool potentially_threadable_block (basic_block); extern void thread_across_edge (gimple, edge, bool, VEC(tree, heap) **, tree (*) (gimple, gimple)); diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index 1a851fa6770..a134244bd9f 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -619,7 +619,6 @@ static unsigned int tree_ssa_dominator_optimize (void) { struct dom_walk_data walk_data; - unsigned int i; memset (&opt_stats, 0, sizeof (opt_stats)); @@ -659,6 +658,9 @@ tree_ssa_dominator_optimize (void) that we update the loop info. */ loop_optimizer_init (LOOPS_HAVE_SIMPLE_LATCHES); + /* Initialize the value-handle array. */ + threadedge_initialize_values (); + /* We need accurate information regarding back edges in the CFG for jump threading; this may include back edges that are not part of a single loop. */ @@ -716,23 +718,6 @@ tree_ssa_dominator_optimize (void) bitmap_zero (need_eh_cleanup); } - /* Finally, remove everything except invariants in SSA_NAME_VALUE. - - Long term we will be able to let everything in SSA_NAME_VALUE - persist. However, for now, we know this is the safe thing to do. */ - for (i = 0; i < num_ssa_names; i++) - { - tree name = ssa_name (i); - tree value; - - if (!name) - continue; - - value = SSA_NAME_VALUE (name); - if (value && !is_gimple_min_invariant (value)) - SSA_NAME_VALUE (name) = NULL; - } - statistics_counter_event (cfun, "Redundant expressions eliminated", opt_stats.num_re); statistics_counter_event (cfun, "Constants propagated", @@ -759,6 +744,10 @@ tree_ssa_dominator_optimize (void) VEC_free (tree, heap, const_and_copies_stack); VEC_free (gimple_p, heap, stmts_to_rescan); + /* Free the value-handle array. */ + threadedge_finalize_values (); + ssa_name_values = NULL; + return 0; } @@ -912,7 +901,7 @@ restore_vars_to_original_value (void) } prev_value = VEC_pop (tree, const_and_copies_stack); - SSA_NAME_VALUE (dest) = prev_value; + set_ssa_name_value (dest, prev_value); } } @@ -1124,7 +1113,7 @@ record_equivalences_from_phis (basic_block bb) inferred from a comparison. All uses of this ssa name are dominated by this assignment, so unwinding just costs time and space. */ if (i == gimple_phi_num_args (phi) && may_propagate_copy (lhs, rhs)) - SSA_NAME_VALUE (lhs) = rhs; + set_ssa_name_value (lhs, rhs); } } @@ -1437,7 +1426,7 @@ record_conditions (struct edge_info *edge_info, tree cond, tree inverted) static void record_const_or_copy_1 (tree x, tree y, tree prev_x) { - SSA_NAME_VALUE (x) = y; + set_ssa_name_value (x, y); if (dump_file && (dump_flags & TDF_DETAILS)) { @@ -1956,7 +1945,7 @@ record_equivalences_from_stmt (gimple stmt, int may_optimize_p) fprintf (dump_file, "\n"); } - SSA_NAME_VALUE (lhs) = rhs; + set_ssa_name_value (lhs, rhs); } } diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index 89bbe08adbd..3e8d1219c80 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -487,7 +487,6 @@ ssa_prop_init (void) edge e; edge_iterator ei; basic_block bb; - size_t i; /* Worklists of SSA edges. */ interesting_ssa_edges = VEC_alloc (gimple, gc, 20); @@ -505,11 +504,6 @@ ssa_prop_init (void) cfg_blocks = VEC_alloc (basic_block, heap, 20); VEC_safe_grow (basic_block, heap, cfg_blocks, 20); - /* Initialize the values for every SSA_NAME. */ - for (i = 1; i < num_ssa_names; i++) - if (ssa_name (i)) - SSA_NAME_VALUE (ssa_name (i)) = NULL_TREE; - /* Initially assume that every edge in the CFG is not executable. (including the edges coming out of ENTRY_BLOCK_PTR). */ FOR_ALL_BB (bb) diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c index 1429c18c998..473bc9b90b4 100644 --- a/gcc/tree-ssa-threadedge.c +++ b/gcc/tree-ssa-threadedge.c @@ -49,6 +49,35 @@ along with GCC; see the file COPYING3. If not see to copy as part of the jump threading process. */ static int stmt_count; +/* Array to record value-handles per SSA_NAME. */ +VEC(tree,heap) *ssa_name_values; + +/* Set the value for the SSA name NAME to VALUE. */ + +void +set_ssa_name_value (tree name, tree value) +{ + if (SSA_NAME_VERSION (name) >= VEC_length (tree, ssa_name_values)) + VEC_safe_grow_cleared (tree, heap, ssa_name_values, + SSA_NAME_VERSION (name) + 1); + VEC_replace (tree, ssa_name_values, SSA_NAME_VERSION (name), value); +} + +/* Initialize the per SSA_NAME value-handles array. Returns it. */ +void +threadedge_initialize_values (void) +{ + gcc_assert (ssa_name_values == NULL); + ssa_name_values = VEC_alloc(tree, heap, num_ssa_names); +} + +/* Free the per SSA_NAME value-handle array. */ +void +threadedge_finalize_values (void) +{ + VEC_free(tree, heap, ssa_name_values); +} + /* Return TRUE if we may be able to thread an incoming edge into BB to an outgoing edge from BB. Return FALSE otherwise. */ @@ -126,7 +155,7 @@ remove_temporary_equivalences (VEC(tree, heap) **stack) break; prev_value = VEC_pop (tree, *stack); - SSA_NAME_VALUE (dest) = prev_value; + set_ssa_name_value (dest, prev_value); } } @@ -145,7 +174,7 @@ record_temporary_equivalence (tree x, tree y, VEC(tree, heap) **stack) y = tmp ? tmp : y; } - SSA_NAME_VALUE (x) = y; + set_ssa_name_value (x, y); VEC_reserve (tree, heap, *stack, 2); VEC_quick_push (tree, *stack, prev_x); VEC_quick_push (tree, *stack, x); diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 8464ffddd89..09c634246ec 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -7277,6 +7277,7 @@ execute_vrp (void) to_remove_edges = VEC_alloc (edge, heap, 10); to_update_switch_stmts = VEC_alloc (switch_update, heap, 5); + threadedge_initialize_values (); vrp_initialize (); ssa_propagate (vrp_visit_stmt, vrp_visit_phi_node); @@ -7322,6 +7323,7 @@ execute_vrp (void) VEC_free (edge, heap, to_remove_edges); VEC_free (switch_update, heap, to_update_switch_stmts); + threadedge_finalize_values (); scev_finalize (); loop_optimizer_finalize (); diff --git a/gcc/tree.h b/gcc/tree.h index d6550b51c50..1e58d52d8bc 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -1854,10 +1854,6 @@ struct GTY(()) tree_exp { #define SSA_NAME_PTR_INFO(N) \ SSA_NAME_CHECK (N)->ssa_name.ptr_info -/* Get the value of this SSA_NAME, if available. */ -#define SSA_NAME_VALUE(N) \ - SSA_NAME_CHECK (N)->ssa_name.value_handle - #ifndef _TREE_FLOW_H struct ptr_info_def; #endif @@ -1896,13 +1892,6 @@ struct GTY(()) tree_ssa_name { /* Pointer attributes used for alias analysis. */ struct ptr_info_def *ptr_info; - /* Value for SSA name used by various passes. - - Right now only invariants are allowed to persist beyond a pass in - this field; in the future we will allow VALUE_HANDLEs to persist - as well. */ - tree value_handle; - /* Immediate uses list for this SSA_NAME. */ struct ssa_use_operand_d imm_uses; }; |