diff options
author | Daniel Berlin <dberlin@dberlin.org> | 2006-02-19 18:26:00 +0000 |
---|---|---|
committer | Daniel Berlin <dberlin@gcc.gnu.org> | 2006-02-19 18:26:00 +0000 |
commit | 4cf4d6a32328de2725c0ca4ca7a991b97ab5e46f (patch) | |
tree | 05d78ede2903b096a832aaebd005c6044c193a98 /gcc/tree-ssa-structalias.c | |
parent | 353f74e8ee82e2a87bb41bc7cc8c5451aedec06b (diff) | |
download | gcc-4cf4d6a32328de2725c0ca4ca7a991b97ab5e46f.zip gcc-4cf4d6a32328de2725c0ca4ca7a991b97ab5e46f.tar.gz gcc-4cf4d6a32328de2725c0ca4ca7a991b97ab5e46f.tar.bz2 |
invoke.texi: Document -fipa-pta.
2006-02-19 Daniel Berlin <dberlin@dberlin.org>
* doc/invoke.texi: Document -fipa-pta.
* common.opt: Add ipa-pta option.
* tree-ssa-structalias.c (DONT_PROPAGATE_WITH_ANYTHING): Removed.
(do_sd_constraint): Enable DONT_PROPAGATE_WITH_ANYTHING code.
(do_ds_constraint): Ditto.
(get_constraint_for): Only add to referenced_vars if
referenced_vars exists.
(insert_into_field_list): Rewrite to do this unsorted.
(insert_into_field_list_sorted): Rename old insert_into_field_list
to this.
(create_function_info_for): Use insert_into_field_list_sorted.
(create_variable_info_for): Rewrite so it uses unsorted version,
since the field list is sorted.
(intra_create_variable_infos): Only add to referenced_vars if
referenced_vars exists.
(ipa_pta_execute): Init heapvars, and delete when done.
* passes.c (init_optimization_passes): Add call to pass_ipa_pta.
From-SVN: r111273
Diffstat (limited to 'gcc/tree-ssa-structalias.c')
-rw-r--r-- | gcc/tree-ssa-structalias.c | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index c7eae96..e7a9892 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -1535,8 +1535,6 @@ type_safe (unsigned int n, unsigned HOST_WIDE_INT *offset) return (get_varinfo (n)->offset + *offset) < get_varinfo (n)->fullsize; } -#define DONT_PROPAGATE_WITH_ANYTHING 0 - /* Process a constraint C that represents *x = &y. */ static void @@ -1593,7 +1591,6 @@ do_sd_constraint (constraint_graph_t graph, constraint_t c, unsigned int j; bitmap_iterator bi; -#if DONT_PROPAGATE_WITH_ANYTHING if (bitmap_bit_p (delta, anything_id)) { flag = !bitmap_bit_p (sol, anything_id); @@ -1601,7 +1598,6 @@ do_sd_constraint (constraint_graph_t graph, constraint_t c, bitmap_set_bit (sol, anything_id); goto done; } -#endif /* For each variable j in delta (Sol(y)), add an edge in the graph from j to x, and union Sol(j) into Sol(x). */ EXECUTE_IF_SET_IN_BITMAP (delta, 0, j, bi) @@ -1629,9 +1625,8 @@ do_sd_constraint (constraint_graph_t graph, constraint_t c, fprintf (dump_file, "Untypesafe usage in do_sd_constraint\n"); } -#if DONT_PROPAGATE_WITH_ANYTHING + done: -#endif /* If the LHS solution changed, mark the var as changed. */ if (flag) { @@ -1655,7 +1650,6 @@ do_ds_constraint (constraint_graph_t graph, constraint_t c, bitmap delta) unsigned int j; bitmap_iterator bi; -#if DONT_PROPAGATE_WITH_ANYTHING if (bitmap_bit_p (sol, anything_id)) { EXECUTE_IF_SET_IN_BITMAP (delta, 0, j, bi) @@ -1683,7 +1677,6 @@ do_ds_constraint (constraint_graph_t graph, constraint_t c, bitmap delta) } return; } -#endif /* For each member j of delta (Sol(x)), add an edge from y to j and union Sol(y) into Sol(j) */ @@ -2538,7 +2531,8 @@ get_constraint_for (tree t, VEC (ce_s, heap) **results) { heapvar = create_tmp_var_raw (ptr_type_node, "HEAP"); DECL_EXTERNAL (heapvar) = 1; - add_referenced_tmp_var (heapvar); + if (referenced_vars) + add_referenced_tmp_var (heapvar); heapvar_insert (t, heapvar); } @@ -3531,11 +3525,24 @@ first_vi_for_offset (varinfo_t start, unsigned HOST_WIDE_INT offset) } +/* Insert the varinfo FIELD into the field list for BASE, at the front + of the list. */ + +static void +insert_into_field_list (varinfo_t base, varinfo_t field) +{ + varinfo_t prev = base; + varinfo_t curr = base->next; + + field->next = curr; + prev->next = field; +} + /* Insert the varinfo FIELD into the field list for BASE, ordered by offset. */ static void -insert_into_field_list (varinfo_t base, varinfo_t field) +insert_into_field_list_sorted (varinfo_t base, varinfo_t field) { varinfo_t prev = base; varinfo_t curr = base->next; @@ -3793,6 +3800,7 @@ create_function_info_for (tree decl, const char *name) arg = DECL_ARGUMENTS (decl); + /* Set up variables for each argument. */ for (i = 1; i < vi->fullsize; i++) { @@ -3817,7 +3825,7 @@ create_function_info_for (tree decl, const char *name) argvi->size = 1; argvi->fullsize = vi->fullsize; argvi->has_union = false; - insert_into_field_list (vi, argvi); + insert_into_field_list_sorted (vi, argvi); stats.total_vars ++; if (arg) { @@ -3825,7 +3833,7 @@ create_function_info_for (tree decl, const char *name) arg = TREE_CHAIN (arg); } } - + /* Create a variable for the return var. */ if (DECL_RESULT (decl) != NULL || !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl)))) @@ -3838,7 +3846,6 @@ create_function_info_for (tree decl, const char *name) vi->fullsize ++; - if (DECL_RESULT (decl)) resultdecl = DECL_RESULT (decl); @@ -3854,7 +3861,7 @@ create_function_info_for (tree decl, const char *name) resultvi->size = 1; resultvi->fullsize = vi->fullsize; resultvi->has_union = false; - insert_into_field_list (vi, resultvi); + insert_into_field_list_sorted (vi, resultvi); stats.total_vars ++; if (DECL_RESULT (decl)) insert_id_for_tree (DECL_RESULT (decl), newindex); @@ -3991,7 +3998,9 @@ create_variable_info_for (tree decl, const char *name) vi->size = TREE_INT_CST_LOW (fo->size); vi->offset = fo->offset; - for (i = 1; VEC_iterate (fieldoff_s, fieldstack, i, fo); i++) + for (i = VEC_length (fieldoff_s, fieldstack) - 1; + i >= 1 && VEC_iterate (fieldoff_s, fieldstack, i, fo); + i--) { varinfo_t newvi; const char *newname; @@ -4077,9 +4086,11 @@ intra_create_variable_infos (void) unsigned int id; if (heapvar == NULL_TREE) { - heapvar = create_tmp_var_raw (TREE_TYPE (TREE_TYPE (t)), "PARM_NOALIAS"); + heapvar = create_tmp_var_raw (TREE_TYPE (TREE_TYPE (t)), + "PARM_NOALIAS"); DECL_EXTERNAL (heapvar) = 1; - add_referenced_tmp_var (heapvar); + if (referenced_vars) + add_referenced_tmp_var (heapvar); heapvar_insert (t, heapvar); } id = create_variable_info_for (heapvar, @@ -4560,6 +4571,7 @@ static bool gate_ipa_pta (void) { return (flag_unit_at_a_time != 0 + && flag_ipa_pta /* Don't bother doing anything if the program has errors. */ && !(errorcount || sorrycount)); } @@ -4570,9 +4582,9 @@ ipa_pta_execute (void) { struct cgraph_node *node; in_ipa_mode = 1; - + init_alias_heapvars (); init_alias_vars (); - + for (node = cgraph_nodes; node; node = node->next) { if (!node->analyzed || cgraph_is_master_clone (node)) @@ -4658,6 +4670,8 @@ ipa_pta_execute (void) if (dump_file) dump_sa_points_to_info (dump_file); in_ipa_mode = 0; + delete_alias_heapvars (); + delete_points_to_sets (); } struct tree_opt_pass pass_ipa_pta = |