diff options
author | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-08-11 20:24:30 +0000 |
---|---|---|
committer | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-08-11 20:24:30 +0000 |
commit | 88a551f165ada66781b7378e78055faed2e9c3fa (patch) | |
tree | 98a0719b68d9049543d31152f1c35e66b84f84f1 /gcc/sese.c | |
parent | 39a34dd8a8a8cd103161362f9a9f7086e557ac28 (diff) | |
download | gcc-88a551f165ada66781b7378e78055faed2e9c3fa.tar.gz |
Also rewrite out of SSA scalar dependences going outside the SCoP region.
2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
* graphite-clast-to-gimple.c (gloog): Remove call to
sese_adjust_liveout_phis.
* graphite-sese-to-poly.c (scev_analyzable_p): When scev returns an
SSA_NAME, allow it to be handled by rewrite_cross_bb_scalar_deps.
(rewrite_cross_bb_scalar_deps): Handle GIMPLE_PHI nodes: call
rewrite_phi_out_of_ssa.
* sese.c (get_vdef_before_sese): Removed.
(sese_adjust_vphi): Removed.
(sese_adjust_liveout_phis): Removed.
* sese.h (sese_adjust_liveout_phis): Removed.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163118 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sese.c')
-rw-r--r-- | gcc/sese.c | 159 |
1 files changed, 0 insertions, 159 deletions
diff --git a/gcc/sese.c b/gcc/sese.c index 2ed6485beed..0a6c45d959c 100644 --- a/gcc/sese.c +++ b/gcc/sese.c @@ -394,100 +394,6 @@ sese_insert_phis_for_liveouts (sese region, basic_block bb, update_ssa (TODO_update_ssa); } -/* Get the definition of NAME before the SESE. Keep track of the - basic blocks that have been VISITED in a bitmap. */ - -static tree -get_vdef_before_sese (sese region, tree name, sbitmap visited) -{ - unsigned i; - gimple stmt = SSA_NAME_DEF_STMT (name); - basic_block def_bb = gimple_bb (stmt); - - if (!def_bb || !bb_in_sese_p (def_bb, region)) - return name; - - if (TEST_BIT (visited, def_bb->index)) - return NULL_TREE; - - SET_BIT (visited, def_bb->index); - - switch (gimple_code (stmt)) - { - case GIMPLE_PHI: - for (i = 0; i < gimple_phi_num_args (stmt); i++) - { - tree arg = gimple_phi_arg_def (stmt, i); - tree res; - - if (gimple_bb (SSA_NAME_DEF_STMT (arg)) - && def_bb->index == gimple_bb (SSA_NAME_DEF_STMT (arg))->index) - continue; - - res = get_vdef_before_sese (region, arg, visited); - if (res) - return res; - } - return NULL_TREE; - - case GIMPLE_ASSIGN: - case GIMPLE_CALL: - { - use_operand_p use_p = gimple_vuse_op (stmt); - tree use = USE_FROM_PTR (use_p); - - if (def_bb->index == gimple_bb (SSA_NAME_DEF_STMT (use))->index) - RESET_BIT (visited, def_bb->index); - - return get_vdef_before_sese (region, use, visited); - } - - default: - return NULL_TREE; - } -} - -/* Adjust a virtual phi node PHI that is placed at the end of the - generated code for SCOP: - - | if (1) - | generated code from REGION; - | else - | REGION; - - The FALSE_E edge comes from the original code, TRUE_E edge comes - from the code generated for the SCOP. */ - -static void -sese_adjust_vphi (sese region, gimple phi, edge true_e) -{ - unsigned i; - - gcc_assert (gimple_phi_num_args (phi) == 2); - - for (i = 0; i < gimple_phi_num_args (phi); i++) - if (gimple_phi_arg_edge (phi, i) == true_e) - { - tree true_arg, false_arg, before_scop_arg; - sbitmap visited; - - true_arg = gimple_phi_arg_def (phi, i); - if (!SSA_NAME_IS_DEFAULT_DEF (true_arg)) - return; - - false_arg = gimple_phi_arg_def (phi, i == 0 ? 1 : 0); - if (SSA_NAME_IS_DEFAULT_DEF (false_arg)) - return; - - visited = sbitmap_alloc (last_basic_block); - sbitmap_zero (visited); - before_scop_arg = get_vdef_before_sese (region, false_arg, visited); - gcc_assert (before_scop_arg != NULL_TREE); - SET_PHI_ARG_DEF (phi, i, before_scop_arg); - sbitmap_free (visited); - } -} - /* Returns the expression associated to OLD_NAME in MAP. */ static tree @@ -585,71 +491,6 @@ rename_sese_parameters (htab_t rename_map, sese region) rename_variables_in_expr (rename_map, p)); } -/* Adjusts the phi nodes in the block BB for variables defined in - SCOP_REGION and used outside the SCOP_REGION. The code generation - moves SCOP_REGION in the else clause of an "if (1)" and generates - code in the then clause: - - | if (1) - | generated code from REGION; - | else - | REGION; - - To adjust the phi nodes after the condition, the RENAME_MAP is - used. */ - -void -sese_adjust_liveout_phis (sese region, htab_t rename_map, basic_block bb, - edge false_e, edge true_e) -{ - gimple_stmt_iterator si; - - for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si)) - { - unsigned i; - unsigned false_i = 0; - gimple phi = gsi_stmt (si); - tree res = gimple_phi_result (phi); - - if (!is_gimple_reg (res)) - { - sese_adjust_vphi (region, phi, true_e); - continue; - } - - for (i = 0; i < gimple_phi_num_args (phi); i++) - if (gimple_phi_arg_edge (phi, i) == false_e) - { - false_i = i; - break; - } - - for (i = 0; i < gimple_phi_num_args (phi); i++) - if (gimple_phi_arg_edge (phi, i) == true_e) - { - tree old_name = gimple_phi_arg_def (phi, false_i); - tree expr = get_rename (rename_map, old_name); - gimple_seq stmts; - - gcc_assert (old_name != expr); - - if (TREE_CODE (expr) != SSA_NAME - && is_gimple_reg (old_name)) - { - tree type = TREE_TYPE (old_name); - tree var = create_tmp_var (type, "var"); - - expr = build2 (MODIFY_EXPR, type, var, expr); - expr = force_gimple_operand (expr, &stmts, true, NULL); - gsi_insert_seq_on_edge_immediate (true_e, stmts); - } - - SET_PHI_ARG_DEF (phi, i, expr); - set_rename (rename_map, old_name, res); - } - } -} - /* Rename the SSA_NAMEs used in STMT and that appear in MAP. */ static void |