+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.
+
2006-02-19 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* doc/install.texi: Add missing `@samp'.
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
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);
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)
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)
{
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)
}
return;
}
-#endif
/* For each member j of delta (Sol(x)), add an edge from y to j and
union Sol(y) into Sol(j) */
{
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);
}
}
+/* 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;
arg = DECL_ARGUMENTS (decl);
+
/* Set up variables for each argument. */
for (i = 1; i < vi->fullsize; i++)
{
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)
{
arg = TREE_CHAIN (arg);
}
}
-
+
/* Create a variable for the return var. */
if (DECL_RESULT (decl) != NULL
|| !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl))))
vi->fullsize ++;
-
if (DECL_RESULT (decl))
resultdecl = DECL_RESULT (decl);
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);
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;
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,
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));
}
{
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))
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 =