diff options
Diffstat (limited to 'gcc/tree-switch-conversion.c')
-rw-r--r-- | gcc/tree-switch-conversion.c | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c index 13a54106c49..9728273beb4 100644 --- a/gcc/tree-switch-conversion.c +++ b/gcc/tree-switch-conversion.c @@ -100,7 +100,7 @@ hoist_edge_and_branch_if_true (gimple_stmt_iterator *gsip, bool update_dominators) { tree tmp; - gimple cond_stmt; + gcond *cond_stmt; edge e_false; basic_block new_bb, split_bb = gsi_bb (*gsip); bool dominated_e_true = false; @@ -285,7 +285,7 @@ case_bit_test_cmp (const void *p1, const void *p2) node targets. */ static void -emit_case_bit_tests (gimple swtch, tree index_expr, +emit_case_bit_tests (gswitch *swtch, tree index_expr, tree minval, tree range, tree maxval) { struct case_bit_test test[MAX_CASE_BIT_TESTS]; @@ -304,7 +304,7 @@ emit_case_bit_tests (gimple swtch, tree index_expr, unsigned int branch_num = gimple_switch_num_labels (swtch); gimple_stmt_iterator gsi; - gimple shift_stmt; + gassign *shift_stmt; tree idx, tmp, csui; tree word_type_node = lang_hooks.types.type_for_mode (word_mode, 1); @@ -621,7 +621,7 @@ struct switch_conv_info /* Collect information about GIMPLE_SWITCH statement SWTCH into INFO. */ static void -collect_switch_conv_info (gimple swtch, struct switch_conv_info *info) +collect_switch_conv_info (gswitch *swtch, struct switch_conv_info *info) { unsigned int branch_num = gimple_switch_num_labels (swtch); tree min_case, max_case; @@ -759,12 +759,12 @@ check_all_empty_except_final (struct switch_conv_info *info) static bool check_final_bb (struct switch_conv_info *info) { - gimple_stmt_iterator gsi; + gphi_iterator gsi; info->phi_count = 0; for (gsi = gsi_start_phis (info->final_bb); !gsi_end_p (gsi); gsi_next (&gsi)) { - gimple phi = gsi_stmt (gsi); + gphi *phi = gsi.phi (); unsigned int i; info->phi_count++; @@ -840,7 +840,7 @@ free_temp_arrays (struct switch_conv_info *info) static void gather_default_values (tree default_case, struct switch_conv_info *info) { - gimple_stmt_iterator gsi; + gphi_iterator gsi; basic_block bb = label_to_block (CASE_LABEL (default_case)); edge e; int i = 0; @@ -854,7 +854,7 @@ gather_default_values (tree default_case, struct switch_conv_info *info) for (gsi = gsi_start_phis (info->final_bb); !gsi_end_p (gsi); gsi_next (&gsi)) { - gimple phi = gsi_stmt (gsi); + gphi *phi = gsi.phi (); tree val = PHI_ARG_DEF_FROM_EDGE (phi, e); gcc_assert (val); info->default_values[i++] = val; @@ -866,7 +866,7 @@ gather_default_values (tree default_case, struct switch_conv_info *info) order of phi nodes. SWTCH is the switch statement being converted. */ static void -build_constructors (gimple swtch, struct switch_conv_info *info) +build_constructors (gswitch *swtch, struct switch_conv_info *info) { unsigned i, branch_num = gimple_switch_num_labels (swtch); tree pos = info->range_min; @@ -877,7 +877,7 @@ build_constructors (gimple swtch, struct switch_conv_info *info) basic_block bb = label_to_block (CASE_LABEL (cs)); edge e; tree high; - gimple_stmt_iterator gsi; + gphi_iterator gsi; int j; if (bb == info->final_bb) @@ -912,7 +912,7 @@ build_constructors (gimple swtch, struct switch_conv_info *info) for (gsi = gsi_start_phis (info->final_bb); !gsi_end_p (gsi); gsi_next (&gsi)) { - gimple phi = gsi_stmt (gsi); + gphi *phi = gsi.phi (); tree val = PHI_ARG_DEF_FROM_EDGE (phi, e); tree low = CASE_LOW (cs); pos = CASE_LOW (cs); @@ -960,7 +960,7 @@ constructor_contains_same_values_p (vec<constructor_elt, va_gc> *vec) all the constants. */ static tree -array_value_type (gimple swtch, tree type, int num, +array_value_type (gswitch *swtch, tree type, int num, struct switch_conv_info *info) { unsigned int i, len = vec_safe_length (info->constructors[num]); @@ -1037,8 +1037,8 @@ array_value_type (gimple swtch, tree type, int num, new array. */ static void -build_one_array (gimple swtch, int num, tree arr_index_type, gimple phi, - tree tidx, struct switch_conv_info *info) +build_one_array (gswitch *swtch, int num, tree arr_index_type, + gphi *phi, tree tidx, struct switch_conv_info *info) { tree name, cst; gimple load; @@ -1103,12 +1103,13 @@ build_one_array (gimple swtch, int num, tree arr_index_type, gimple phi, them. */ static void -build_arrays (gimple swtch, struct switch_conv_info *info) +build_arrays (gswitch *swtch, struct switch_conv_info *info) { tree arr_index_type; tree tidx, sub, utype; gimple stmt; gimple_stmt_iterator gsi; + gphi_iterator gpi; int i; location_t loc = gimple_location (swtch); @@ -1134,19 +1135,19 @@ build_arrays (gimple swtch, struct switch_conv_info *info) update_stmt (stmt); info->arr_ref_first = stmt; - for (gsi = gsi_start_phis (info->final_bb), i = 0; - !gsi_end_p (gsi); gsi_next (&gsi), i++) - build_one_array (swtch, i, arr_index_type, gsi_stmt (gsi), tidx, info); + for (gpi = gsi_start_phis (info->final_bb), i = 0; + !gsi_end_p (gpi); gsi_next (&gpi), i++) + build_one_array (swtch, i, arr_index_type, gpi.phi (), tidx, info); } /* Generates and appropriately inserts loads of default values at the position given by BSI. Returns the last inserted statement. */ -static gimple +static gassign * gen_def_assigns (gimple_stmt_iterator *gsi, struct switch_conv_info *info) { int i; - gimple assign = NULL; + gassign *assign = NULL; for (i = 0; i < info->phi_count; i++) { @@ -1190,13 +1191,13 @@ static void fix_phi_nodes (edge e1f, edge e2f, basic_block bbf, struct switch_conv_info *info) { - gimple_stmt_iterator gsi; + gphi_iterator gsi; int i; for (gsi = gsi_start_phis (bbf), i = 0; !gsi_end_p (gsi); gsi_next (&gsi), i++) { - gimple phi = gsi_stmt (gsi); + gphi *phi = gsi.phi (); add_phi_arg (phi, info->target_inbound_names[i], e1f, UNKNOWN_LOCATION); add_phi_arg (phi, info->target_outbound_names[i], e2f, UNKNOWN_LOCATION); } @@ -1224,18 +1225,18 @@ fix_phi_nodes (edge e1f, edge e2f, basic_block bbf, */ static void -gen_inbound_check (gimple swtch, struct switch_conv_info *info) +gen_inbound_check (gswitch *swtch, struct switch_conv_info *info) { tree label_decl1 = create_artificial_label (UNKNOWN_LOCATION); tree label_decl2 = create_artificial_label (UNKNOWN_LOCATION); tree label_decl3 = create_artificial_label (UNKNOWN_LOCATION); - gimple label1, label2, label3; + glabel *label1, *label2, *label3; tree utype, tidx; tree bound; - gimple cond_stmt; + gcond *cond_stmt; - gimple last_assign; + gassign *last_assign; gimple_stmt_iterator gsi; basic_block bb0, bb1, bb2, bbf, bbd; edge e01, e02, e21, e1d, e1f, e2f; @@ -1344,7 +1345,7 @@ gen_inbound_check (gimple swtch, struct switch_conv_info *info) conversion failed. */ static const char * -process_switch (gimple swtch) +process_switch (gswitch *swtch) { struct switch_conv_info info; @@ -1478,7 +1479,7 @@ pass_convert_switch::execute (function *fun) putc ('\n', dump_file); } - failure_reason = process_switch (stmt); + failure_reason = process_switch (as_a <gswitch *> (stmt)); if (! failure_reason) { if (dump_file) |