was handled, otherwise false. */
static bool
-find_func_aliases_for_builtin_call (gimple t)
+find_func_aliases_for_builtin_call (struct function *fn, gimple t)
{
tree fndecl = gimple_call_fndecl (t);
vec<ce_s> lhsc = vNULL;
and otherwise are just all nonlocal variables. */
if (in_ipa_mode)
{
- fi = lookup_vi_for_tree (cfun->decl);
+ fi = lookup_vi_for_tree (fn->decl);
rhs = get_function_part_constraint (fi, ~0);
rhs.type = ADDRESSOF;
}
{
fi = NULL;
if (!in_ipa_mode
- || !(fi = get_vi_for_tree (cfun->decl)))
+ || !(fi = get_vi_for_tree (fn->decl)))
make_constraint_from (get_varinfo (escaped_id), anything_id);
else if (in_ipa_mode
&& fi != NULL)
/* Create constraints for the call T. */
static void
-find_func_aliases_for_call (gimple t)
+find_func_aliases_for_call (struct function *fn, gimple t)
{
tree fndecl = gimple_call_fndecl (t);
vec<ce_s> lhsc = vNULL;
if (fndecl != NULL_TREE
&& DECL_BUILT_IN (fndecl)
- && find_func_aliases_for_builtin_call (t))
+ && find_func_aliases_for_builtin_call (fn, t))
return;
fi = get_fi_for_callee (t);
when building alias sets and computing alias grouping heuristics. */
static void
-find_func_aliases (gimple origt)
+find_func_aliases (struct function *fn, gimple origt)
{
gimple t = origt;
vec<ce_s> lhsc = vNULL;
In non-ipa mode, we need to generate constraints for each
pointer passed by address. */
else if (is_gimple_call (t))
- find_func_aliases_for_call (t);
+ find_func_aliases_for_call (fn, t);
/* Otherwise, just a regular assignment statement. Only care about
operations with pointer result, others are dealt with as escape
{
fi = NULL;
if (!in_ipa_mode
- || !(fi = get_vi_for_tree (cfun->decl)))
+ || !(fi = get_vi_for_tree (fn->decl)))
make_escape_constraint (gimple_return_retval (t));
else if (in_ipa_mode
&& fi != NULL)
IPA constraint builder. */
static void
-find_func_clobbers (gimple origt)
+find_func_clobbers (struct function *fn, gimple origt)
{
gimple t = origt;
vec<ce_s> lhsc = vNULL;
return;
/* We'd better have function information for the current function. */
- fi = lookup_vi_for_tree (cfun->decl);
+ fi = lookup_vi_for_tree (fn->decl);
gcc_assert (fi != NULL);
/* Account for stores in assignments and calls. */
while (handled_component_p (tem))
tem = TREE_OPERAND (tem, 0);
if ((DECL_P (tem)
- && !auto_var_in_fn_p (tem, cfun->decl))
+ && !auto_var_in_fn_p (tem, fn->decl))
|| INDIRECT_REF_P (tem)
|| (TREE_CODE (tem) == MEM_REF
&& !(TREE_CODE (TREE_OPERAND (tem, 0)) == ADDR_EXPR
&& auto_var_in_fn_p
- (TREE_OPERAND (TREE_OPERAND (tem, 0), 0), cfun->decl))))
+ (TREE_OPERAND (TREE_OPERAND (tem, 0), 0), fn->decl))))
{
struct constraint_expr lhsc, *rhsp;
unsigned i;
while (handled_component_p (tem))
tem = TREE_OPERAND (tem, 0);
if ((DECL_P (tem)
- && !auto_var_in_fn_p (tem, cfun->decl))
+ && !auto_var_in_fn_p (tem, fn->decl))
|| INDIRECT_REF_P (tem)
|| (TREE_CODE (tem) == MEM_REF
&& !(TREE_CODE (TREE_OPERAND (tem, 0)) == ADDR_EXPR
&& auto_var_in_fn_p
- (TREE_OPERAND (TREE_OPERAND (tem, 0), 0), cfun->decl))))
+ (TREE_OPERAND (TREE_OPERAND (tem, 0), 0), fn->decl))))
{
struct constraint_expr lhs, *rhsp;
unsigned i;
function for intraprocedural mode. */
static void
-intra_create_variable_infos (void)
+intra_create_variable_infos (struct function *fn)
{
tree t;
/* For each incoming pointer argument arg, create the constraint ARG
= NONLOCAL or a dummy variable if it is a restrict qualified
passed-by-reference argument. */
- for (t = DECL_ARGUMENTS (current_function_decl); t; t = DECL_CHAIN (t))
+ for (t = DECL_ARGUMENTS (fn->decl); t; t = DECL_CHAIN (t))
{
varinfo_t p = get_vi_for_tree (t);
}
/* Add a constraint for a result decl that is passed by reference. */
- if (DECL_RESULT (cfun->decl)
- && DECL_BY_REFERENCE (DECL_RESULT (cfun->decl)))
+ if (DECL_RESULT (fn->decl)
+ && DECL_BY_REFERENCE (DECL_RESULT (fn->decl)))
{
- varinfo_t p, result_vi = get_vi_for_tree (DECL_RESULT (cfun->decl));
+ varinfo_t p, result_vi = get_vi_for_tree (DECL_RESULT (fn->decl));
for (p = result_vi; p; p = vi_next (p))
make_constraint_from (p, nonlocal_id);
}
/* Add a constraint for the incoming static chain parameter. */
- if (cfun->static_chain_decl != NULL_TREE)
+ if (fn->static_chain_decl != NULL_TREE)
{
- varinfo_t p, chain_vi = get_vi_for_tree (cfun->static_chain_decl);
+ varinfo_t p, chain_vi = get_vi_for_tree (fn->static_chain_decl);
for (p = chain_vi; p; p = vi_next (p))
make_constraint_from (p, nonlocal_id);
init_alias_vars ();
- intra_create_variable_infos ();
+ intra_create_variable_infos (cfun);
/* Now walk all statements and build the constraint set. */
FOR_EACH_BB_FN (bb, cfun)
gimple phi = gsi_stmt (gsi);
if (! virtual_operand_p (gimple_phi_result (phi)))
- find_func_aliases (phi);
+ find_func_aliases (cfun, phi);
}
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
- find_func_aliases (stmt);
+ find_func_aliases (cfun, stmt);
}
}
}
func = DECL_STRUCT_FUNCTION (node->decl);
- push_cfun (func);
+ gcc_assert (cfun == NULL);
/* For externally visible or attribute used annotated functions use
local constraints for their arguments.
|| node->externally_visible
|| node->force_output)
{
- intra_create_variable_infos ();
+ intra_create_variable_infos (func);
/* We also need to make function return values escape. Nothing
escapes by returning from main though. */
gimple phi = gsi_stmt (gsi);
if (! virtual_operand_p (gimple_phi_result (phi)))
- find_func_aliases (phi);
+ find_func_aliases (func, phi);
}
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
- find_func_aliases (stmt);
- find_func_clobbers (stmt);
+ find_func_aliases (func, stmt);
+ find_func_clobbers (func, stmt);
}
}
- pop_cfun ();
-
if (dump_file)
{
fprintf (dump_file, "\n");