From e2a4f08e58fb49ec692efa10c97b9598738be7db Mon Sep 17 00:00:00 2001 From: rguenth Date: Tue, 15 Apr 2014 08:21:56 +0000 Subject: [PATCH] 2014-04-15 Richard Biener * tree-ssa-structalias.c (find_func_aliases_for_builtin_call): Add struct function argument and adjust. (find_func_aliases_for_call): Likewise. (find_func_aliases): Likewise. (find_func_clobbers): Likewise. (intra_create_variable_infos): Likewise. (compute_points_to_sets): Likewise. (ipa_pta_execute): Adjust. Do not push/pop cfun. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@209408 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 11 +++++++++ gcc/tree-ssa-structalias.c | 60 ++++++++++++++++++++++------------------------ 2 files changed, 40 insertions(+), 31 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3732bd2b176..751c2f7346e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,16 @@ 2014-04-15 Richard Biener + * tree-ssa-structalias.c (find_func_aliases_for_builtin_call): + Add struct function argument and adjust. + (find_func_aliases_for_call): Likewise. + (find_func_aliases): Likewise. + (find_func_clobbers): Likewise. + (intra_create_variable_infos): Likewise. + (compute_points_to_sets): Likewise. + (ipa_pta_execute): Adjust. Do not push/pop cfun. + +2014-04-15 Richard Biener + * tree.c (iterative_hash_expr): Use enum tree_code_class to store TREE_CODE_CLASS. (tree_block): Likewise. diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 8201cb423c1..70133cfdcbe 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -4136,7 +4136,7 @@ get_fi_for_callee (gimple call) 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 lhsc = vNULL; @@ -4450,7 +4450,7 @@ find_func_aliases_for_builtin_call (gimple t) 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; } @@ -4475,7 +4475,7 @@ find_func_aliases_for_builtin_call (gimple t) { 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) @@ -4502,7 +4502,7 @@ find_func_aliases_for_builtin_call (gimple t) /* 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 lhsc = vNULL; @@ -4511,7 +4511,7 @@ find_func_aliases_for_call (gimple t) 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); @@ -4621,7 +4621,7 @@ find_func_aliases_for_call (gimple 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 lhsc = vNULL; @@ -4665,7 +4665,7 @@ find_func_aliases (gimple origt) 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 @@ -4756,7 +4756,7 @@ find_func_aliases (gimple origt) { 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) @@ -4859,7 +4859,7 @@ process_ipa_clobber (varinfo_t fi, tree ptr) IPA constraint builder. */ static void -find_func_clobbers (gimple origt) +find_func_clobbers (struct function *fn, gimple origt) { gimple t = origt; vec lhsc = vNULL; @@ -4877,7 +4877,7 @@ find_func_clobbers (gimple origt) 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. */ @@ -4889,12 +4889,12 @@ find_func_clobbers (gimple origt) 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; @@ -4917,12 +4917,12 @@ find_func_clobbers (gimple origt) 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; @@ -5846,14 +5846,14 @@ debug_solution_for_var (unsigned int var) 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); @@ -5905,19 +5905,19 @@ intra_create_variable_infos (void) } /* 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); @@ -6802,7 +6802,7 @@ compute_points_to_sets (void) 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) @@ -6814,14 +6814,14 @@ compute_points_to_sets (void) 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); } } @@ -7176,7 +7176,7 @@ ipa_pta_execute (void) } 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. @@ -7186,7 +7186,7 @@ ipa_pta_execute (void) || 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. */ @@ -7221,20 +7221,18 @@ ipa_pta_execute (void) 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"); -- 2.11.4.GIT