diff options
author | Martin Liska <mliska@suse.cz> | 2018-08-27 14:17:19 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2018-08-27 12:17:19 +0000 |
commit | 61ff5d6f4ed5000ee427e054ee803bc8f5535bdd (patch) | |
tree | 258d294d1bd789f941b4e62269851da44fa8a99c /gcc/hsa-gen.c | |
parent | 78ea9abc2018243af7f7ada6135144ac90c6ad27 (diff) | |
download | gcc-61ff5d6f4ed5000ee427e054ee803bc8f5535bdd.zip gcc-61ff5d6f4ed5000ee427e054ee803bc8f5535bdd.tar.gz gcc-61ff5d6f4ed5000ee427e054ee803bc8f5535bdd.tar.bz2 |
Add new gswitch related functions into tree-cfg.c.
2018-08-27 Martin Liska <mliska@suse.cz>
* cfgexpand.c (expand_asm_stmt): Use label_to_block and pass
cfun argument explicitly.
* gimple-pretty-print.c (dump_gimple_switch): Likewise.
* hsa-gen.c (gen_hsa_insns_for_switch_stmt): Use new
function gimple_switch_default_bb.
(convert_switch_statements):
(expand_builtins):
* ipa-fnsummary.c (set_switch_stmt_execution_predicate):
* stmt.c (label_to_block_fn): Use label_to_block and pass
cfun argument explicitly and use gimple_switch_label_bb.
(expand_case): Likewise.
* tree-cfg.c (lower_phi_internal_fn): Use label_to_block and pass
cfun argument explicitly. Likewise.
(make_edges_bb): Likewise.
(make_cond_expr_edges): Likewise.
(get_cases_for_edge): Likewise.
(make_gimple_switch_edges): Likewise.
(label_to_block_fn): Likewise.
(label_to_block): Likewise.
(make_goto_expr_edges): Likewise.
(make_gimple_asm_edges): Likewise.
(main_block_label): Likewise.
(group_case_labels_stmt): Likewise.
(find_taken_edge_computed_goto): Likewise.
(find_taken_edge_switch_expr): Likewise.
(gimple_verify_flow_info): Likewise.
(gimple_redirect_edge_and_branch): Likewise.
(gimple_switch_label_bb): New function.
(gimple_switch_default_bb): Likewise.
(gimple_switch_edge): Likewise.
(gimple_switch_default_edge): Likewise.
* tree-cfg.h (label_to_block_fn): Remove and replace ...
(label_to_block): ... with this.
(gimple_switch_label_bb): New.
(gimple_switch_default_bb): Likewise.
(gimple_switch_edge): Likewise.
(gimple_switch_default_edge): Likewise.
* tree-cfgcleanup.c (convert_single_case_switch): Use
new gimple functions and pass new argument to label_to_block.
(cleanup_control_flow_bb):
* tree-eh.c (make_eh_dispatch_edges): Use label_to_block and pass
cfun argument explicitly.
(make_eh_edges): Likewise.
(redirect_eh_dispatch_edge): Likewise.
(lower_resx): Likewise.
(lower_eh_dispatch): Likewise.
(maybe_remove_unreachable_handlers): Likewise.
(unsplit_eh): Likewise.
(cleanup_empty_eh): Likewise.
(verify_eh_edges): Likewise.
(verify_eh_dispatch_edge): Likewise.
* tree-ssa-dom.c (record_edge_info): Likewise.
* tree-ssa-forwprop.c (simplify_gimple_switch_label_vec): Likewise.
* tree-ssa-threadedge.c (thread_around_empty_blocks): Likewise.
(thread_through_normal_block): Likewise.
* tree-ssa-uncprop.c (associate_equivalences_with_edges): Likewise.
* tree-ssa-uninit.c (convert_control_dep_chain_into_preds):
* tree-switch-conversion.c (switch_conversion::collect): Use new
gimple functions.
(switch_conversion::check_final_bb): Likewise.
(switch_conversion::gather_default_values): Pass new argument
to label_to_block.
(switch_conversion::build_constructors): Likewise.
(switch_decision_tree::compute_cases_per_edge): Use new
gimple_switch_edge function.
(switch_decision_tree::analyze_switch_statement): Pass new argument
to label_to_block.
(switch_decision_tree::try_switch_expansion): Use
gimple_switch_default_edge.
* tree-vrp.c (find_switch_asserts): Pass new argument
to label_to_block.
* vr-values.c (vr_values::vrp_visit_switch_stmt): Likewise.
(vr_values::simplify_switch_using_ranges): Likewise.
From-SVN: r263876
Diffstat (limited to 'gcc/hsa-gen.c')
-rw-r--r-- | gcc/hsa-gen.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c index 6595bed..416de93 100644 --- a/gcc/hsa-gen.c +++ b/gcc/hsa-gen.c @@ -3475,7 +3475,6 @@ gen_hsa_insns_for_switch_stmt (gswitch *s, hsa_bb *hbb) e->flags &= ~EDGE_FALLTHRU; e->flags |= EDGE_TRUE_VALUE; - function *func = DECL_STRUCT_FUNCTION (current_function_decl); tree index_tree = gimple_switch_index (s); tree lowest = get_switch_low (s); tree highest = get_switch_high (s); @@ -3499,9 +3498,7 @@ gen_hsa_insns_for_switch_stmt (gswitch *s, hsa_bb *hbb) hbb->append_insn (new hsa_insn_cbr (cmp_reg)); - tree default_label = gimple_switch_default_label (s); - basic_block default_label_bb = label_to_block_fn (func, - CASE_LABEL (default_label)); + basic_block default_label_bb = gimple_switch_default_bb (cfun, s); if (!gimple_seq_empty_p (phi_nodes (default_label_bb))) { @@ -3536,7 +3533,7 @@ gen_hsa_insns_for_switch_stmt (gswitch *s, hsa_bb *hbb) for (unsigned i = 1; i < labels; i++) { tree label = gimple_switch_label (s, i); - basic_block bb = label_to_block_fn (func, CASE_LABEL (label)); + basic_block bb = label_to_block (cfun, CASE_LABEL (label)); unsigned HOST_WIDE_INT sub_low = tree_to_uhwi (int_const_binop (MINUS_EXPR, CASE_LOW (label), lowest)); @@ -6290,12 +6287,11 @@ LD: hard_work_3 (); static bool convert_switch_statements (void) { - function *func = DECL_STRUCT_FUNCTION (current_function_decl); basic_block bb; bool modified_cfg = false; - FOR_EACH_BB_FN (bb, func) + FOR_EACH_BB_FN (bb, cfun) { gimple_stmt_iterator gsi = gsi_last_bb (bb); if (gsi_end_p (gsi)) @@ -6318,7 +6314,7 @@ convert_switch_statements (void) tree index_type = TREE_TYPE (index); tree default_label = gimple_switch_default_label (s); basic_block default_label_bb - = label_to_block_fn (func, CASE_LABEL (default_label)); + = label_to_block (cfun, CASE_LABEL (default_label)); basic_block cur_bb = bb; auto_vec <edge> new_edges; @@ -6330,8 +6326,7 @@ convert_switch_statements (void) should be fixed after we add new collection of edges. */ for (unsigned i = 0; i < labels; i++) { - tree label = gimple_switch_label (s, i); - basic_block label_bb = label_to_block_fn (func, CASE_LABEL (label)); + basic_block label_bb = gimple_switch_label_bb (cfun, s, i); edge e = find_edge (bb, label_bb); edge_counts.safe_push (e->count ()); edge_probabilities.safe_push (e->probability); @@ -6413,8 +6408,7 @@ convert_switch_statements (void) gsi_insert_before (&cond_gsi, c, GSI_SAME_STMT); - basic_block label_bb - = label_to_block_fn (func, CASE_LABEL (label)); + basic_block label_bb = label_to_block (cfun, CASE_LABEL (label)); edge new_edge = make_edge (cur_bb, label_bb, EDGE_TRUE_VALUE); profile_probability prob_sum = sum_slice <profile_probability> (edge_probabilities, i, labels, profile_probability::never ()) @@ -6481,10 +6475,9 @@ convert_switch_statements (void) static void expand_builtins () { - function *func = DECL_STRUCT_FUNCTION (current_function_decl); basic_block bb; - FOR_EACH_BB_FN (bb, func) + FOR_EACH_BB_FN (bb, cfun) { for (gimple_stmt_iterator gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) |