diff options
author | David Malcolm <dmalcolm@redhat.com> | 2014-11-19 17:00:54 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2014-11-19 17:00:54 +0000 |
commit | 538dd0b78f4b3998a1719a282811cb0caa1b035a (patch) | |
tree | 10282bd0fe08815f5683eb5ed7fbc1456ff26a4c /gcc/tree-cfg.c | |
parent | da9c88d86d71721af15f9342a31e385e897fb643 (diff) | |
download | gcc-538dd0b78f4b3998a1719a282811cb0caa1b035a.zip gcc-538dd0b78f4b3998a1719a282811cb0caa1b035a.tar.gz gcc-538dd0b78f4b3998a1719a282811cb0caa1b035a.tar.bz2 |
Merger of git branch "gimple-classes-v2-option-3"
gcc/ChangeLog:
Merger of git branch "gimple-classes-v2-option-3".
* ChangeLog.gimple-classes: New.
* coretypes.h (struct gcond): Add forward decl.
(struct gdebug): Likewise.
(struct ggoto): Likewise.
(struct glabel): Likewise.
(struct gswitch): Likewise.
(struct gassign): Likewise.
(struct gasm): Likewise.
(struct gcall): Likewise.
(struct gtransaction): Likewise.
(struct greturn): Likewise.
(struct gbind): Likewise.
(struct gcatch): Likewise.
(struct geh_filter): Likewise.
(struct geh_mnt): Likewise.
(struct geh_else): Likewise.
(struct gresx): Likewise.
(struct geh_dispatch): Likewise.
(struct gphi): Likewise.
(struct gtry): Likewise.
(struct gomp_atomic_load): Likewise.
(struct gomp_atomic_store): Likewise.
(struct gomp_continue): Likewise.
(struct gomp_critical): Likewise.
(struct gomp_for): Likewise.
(struct gomp_parallel): Likewise.
(struct gomp_task): Likewise.
(struct gomp_sections): Likewise.
(struct gomp_single): Likewise.
(struct gomp_target): Likewise.
(struct gomp_teams): Likewise.
* doc/gimple.texi (Class hierarchy of GIMPLE statements): Update
for renaming of gimple subclasses.
* gdbhooks.py: Update.
* gimple-iterator.c (gsi_for_phi): New.
(gsi_start_phis): Strengthen return type from gimple_stmt_iterator
to gphi_iterator.
* gimple-iterator.h (struct gphi_iterator): New subclass of
gimple_stmt_iterator.
(gsi_for_phi): New prototype.
(gsi_start_phis): Strengthen return type from gimple_stmt_iterator
to gphi_iterator.
(gsi_next_nonvirtual_phi): Strengthen param from
gimple_stmt_iterator * to gphi_iterator *, and local "phi" from
gimple to gphi *.
* gsstruct.def: Update for renamings of classes.
* gimple.c (gimple_build_return): Strengthen return type from
gimple to greturn *.
(gimple_call_reset_alias_info): Strengthen param to gcall *.
(gimple_build_call_1): Strengthen return type from gimple to
gcall *.
(gimple_build_call_vec): Likewise.
(gimple_build_call): Likewise.
(gimple_build_call_valist): Likewise.
(gimple_build_call_internal_1): Likewise.
(gimple_build_call_internal): Likewise.
(gimple_build_call_internal_vec): Likewise.
(gimple_build_call_from_tree): Likewise.
(gimple_build_assign_stat): Strengthen return type from gimple to
gassign *.
(gimple_build_assign_with_ops): Likewise.
(gimple_build_assign_with_ops): Likewise.
(gimple_build_cond): Strengthen return type from gimple to
gcond *.
(gimple_build_cond_from_tree): Likewise.
(gimple_cond_set_condition_from_tree): Require a gcond *.
(gimple_build_label): Strengthen return type from gimple to
glabel *.
(gimple_build_goto): Strengthen return type from gimple to
ggoto *.
(gimple_build_bind): Strengthen return type from gimple to
gbind *.
(gimple_build_asm_1): Strengthen return type from gimple to
gasm *.
(gimple_build_asm_vec): Likewise.
(gimple_build_catch): Strengthen return type from gimple to
gcatch *.
(gimple_build_eh_filter): Strengthen return type from gimple to
geh_filter *.
(gimple_build_eh_must_not_throw): Strengthen return type from
gimple to geh_mnt *.
(gimple_build_eh_else): Strengthen return type from gimple to
geh_else *.
(gimple_build_try): Update for renaming of gimple_statement_try to
gtry.
(gimple_build_resx): Strengthen return type from gimple to
gresx *.
(gimple_build_switch_nlabels): Strengthen return type from gimple
to gswitch *.
(gimple_build_switch): Likewise.
(gimple_build_eh_dispatch): Strengthen return type from gimple to
geh_dispatch *.
(gimple_build_debug_bind_stat): Strengthen return type from gimple
to gdebug *.
(gimple_build_debug_source_bind_stat): Strengthen return type from
gimple to gdebug *.
(gimple_build_omp_critical): Strengthen return type from gimple to
gomp_critical *.
(gimple_build_omp_for): Strengthen return type from gimple to
gomp_for *.
(gimple_build_omp_parallel): Strengthen return type from gimple to
gomp_parallel *.
(gimple_build_omp_task): Strengthen return type from gimple to
gomp_task *.
(gimple_build_omp_continue): Strengthen return type from gimple to
gomp_continue *.
(gimple_build_omp_sections): Strengthen return type from gimple to
gomp_sections *.
(gimple_build_omp_single): Strengthen return type from gimple to
gomp_single *.
(gimple_build_omp_target): Strengthen return type from gimple to
gomp_target *.
(gimple_build_omp_teams): Strengthen return type from gimple to
gomp_teams *.
(gimple_build_omp_atomic_load): Strengthen return type from gimple
to gomp_atomic_load *.
(gimple_build_omp_atomic_store): Strengthen return type from gimple
to gomp_atomic_store *.
(gimple_build_transaction): Strengthen return type from gimple
to gtransaction *.
(empty_stmt_p): Replace check for GIMPLE_BIND with a dyn_cast.
(gimple_call_fnspec): Require a const gcall *.
(gimple_call_arg_flags): Likewise.
(gimple_call_return_flags): Likewise.
(gimple_set_bb): Add a checked cast.
(gimple_copy): Within the cases, add locals of the appropriate
subclass and use in place of "stmt" and "copy" for typesafety.
(gimple_has_side_effects): Add a checked cast.
(gimple_could_trap_p_1): Likewise.
(gimple_call_copy_skip_args): Require a gcall *, and return one.
(gimple_asm_clobbers_memory_p): Require a const gasm *.
(infer_nonnull_range): Replace a check for GIMPLE_RETURN with a
dyn_cast, introducing local "return_stmt" and using ti in place
of "stmt".
* gimple.h (gimple_vec): Eliminate this typedef.
(struct gimple_statement_call): Rename to...
(struct gcall): ...this.
(struct gimple_statement_bind): Rename to...
(struct gbind): ...this.
(struct gimple_statement_catch): Rename to...
(struct gcatch): ...this.
(struct gimple_statement_eh_filter): Rename to...
(struct geh_filter): ...this.
(struct gimple_statement_eh_else): Rename to...
(struct geh_else): ...this.
(struct gimple_statement_eh_mnt): Rename to...
(struct geh_mnt): ...this.
(struct gimple_statement_phi): Rename to...
(struct gphi): ...this.
(struct gimple_statement_resx): Rename to...
(struct gresx): ...this.
(struct gimple_statement_eh_dispatch): Rename to...
(struct geh_dispatch): ...this.
(struct gimple_statement_try): Rename to...
(struct gtry): ...this.
(struct gimple_statement_asm): Rename to...
(struct gasm): ...this.
(struct gimple_statement_omp_critical): Rename to...
(struct gomp_critical): ...this.
(struct gimple_statement_omp_for): Rename to...
(struct gomp_for): ...this.
(struct gimple_statement_omp_parallel): Rename to...
(struct gomp_parallel): ...this.
(struct gimple_statement_omp_target): Rename to...
(struct gomp_target): ...this.
(struct gimple_statement_omp_task): Rename to...
(struct gomp_task): ...this.
(struct gimple_statement_omp_sections): Rename to...
(struct gomp_sections): ...this.
(struct gimple_statement_omp_continue): Rename to...
(struct gomp_continue): ...this.
(struct gimple_statement_omp_single): Rename to...
(struct gomp_single): ...this.
(struct gimple_statement_omp_teams): Rename to...
(struct gomp_teams): ...this.
(struct gimple_statement_omp_atomic_load): Rename to...
(struct gomp_atomic_load): ...this.
(struct gimple_statement_omp_atomic_store :): Rename to...
(struct gomp_atomic_store :): ...this.
(struct gimple_statement_transaction): Rename to...
(struct gtransaction): ...this.
(struct gcond): New subclass.
(struct gdebug): New subclass.
(struct ggoto): New subclass.
(struct glabel): New subclass.
(struct gswitch): New subclass.
(struct gassign): New subclass.
(struct greturn): New subclass.
(is_a_helper <gimple_statement_asm *>::test): Rename to...
(is_a_helper <gasm *>::test): ...this.
(is_a_helper <gimple_statement_bind *>::test): Rename to...
(is_a_helper <gbind *>::test): ...this.
(is_a_helper <gassign *>::test): New.
(is_a_helper <gimple_statement_call *>::test): Rename to...
(is_a_helper <gcall *>::test): ...this.
(is_a_helper <gimple_statement_catch *>::test): Rename to...
(is_a_helper <gcatch *>::test): ...this.
(is_a_helper <gimple_statement_resx *>::test): Rename to...
(is_a_helper <gresx *>::test): ...this.
(is_a_helper <gcond *>::test): New.
(is_a_helper <gdebug *>::test): New.
(is_a_helper <ggoto *>::test): New.
(is_a_helper <glabel *>::test): New.
(is_a_helper <gimple_statement_eh_dispatch *>::test): Rename to...
(is_a_helper <geh_dispatch *>::test): ...this.
(is_a_helper <gimple_statement_eh_else *>::test): Rename to...
(is_a_helper <geh_else *>::test): ...this.
(is_a_helper <gimple_statement_eh_filter *>::test): Rename to...
(is_a_helper <geh_filter *>::test): ...this.
(is_a_helper <gimple_statement_eh_mnt *>::test): Rename to...
(is_a_helper <geh_mnt *>::test): ...this.
(is_a_helper <gimple_statement_omp_atomic_load *>::test): Rename to...
(is_a_helper <gomp_atomic_load *>::test): ...this.
(is_a_helper <gimple_statement_omp_atomic_store *>::test): Rename to...
(is_a_helper <gomp_atomic_store *>::test): ...this.
(is_a_helper <gimple_statement_omp_continue *>::test): Rename to...
(is_a_helper <gomp_continue *>::test): ...this.
(is_a_helper <gimple_statement_omp_critical *>::test): Rename to...
(is_a_helper <gomp_critical *>::test): ...this.
(is_a_helper <gimple_statement_omp_for *>::test): Rename to...
(is_a_helper <gomp_for *>::test): ...this.
(is_a_helper <gimple_statement_omp_parallel *>::test): Rename to...
(is_a_helper <gomp_parallel *>::test): ...this.
(is_a_helper <gimple_statement_omp_target *>::test): Rename to...
(is_a_helper <gomp_target *>::test): ...this.
(is_a_helper <gimple_statement_omp_sections *>::test): Rename to...
(is_a_helper <gomp_sections *>::test): ...this.
(is_a_helper <gimple_statement_omp_single *>::test): Rename to...
(is_a_helper <gomp_single *>::test): ...this.
(is_a_helper <gimple_statement_omp_teams *>::test): Rename to...
(is_a_helper <gomp_teams *>::test): ...this.
(is_a_helper <gimple_statement_omp_task *>::test): Rename to...
(is_a_helper <gomp_task *>::test): ...this.
(is_a_helper <gimple_statement_phi *>::test): Rename to...
(is_a_helper <gphi *>::test): ...this.
(is_a_helper <gimple_statement_transaction *>::test): Rename to...
(is_a_helper <gtransaction *>::test): ...this.
(is_a_helper <greturn *>::test): New.
(is_a_helper <gswitch *>::test): New.
(is_a_helper <gimple_statement_try *>::test): Rename to...
(is_a_helper <gtry *>::test): ...this.
(is_a_helper <const gimple_statement_asm *>::test): Rename to...
(is_a_helper <const gasm *>::test): ...this.
(is_a_helper <const gimple_statement_bind *>::test): Rename to...
(is_a_helper <const gbind *>::test): ...this.
(is_a_helper <const gimple_statement_call *>::test): Rename to...
(is_a_helper <const gcall *>::test): ...this.
(is_a_helper <const gimple_statement_catch *>::test): Rename to...
(is_a_helper <const gcatch *>::test): ...this.
(is_a_helper <const gimple_statement_resx *>::test): Rename to...
(is_a_helper <const gresx *>::test): ...this.
(is_a_helper <const gimple_statement_eh_dispatch *>::test): Rename to...
(is_a_helper <const geh_dispatch *>::test): ...this.
(is_a_helper <const gimple_statement_eh_filter *>::test): Rename to...
(is_a_helper <const geh_filter *>::test): ...this.
(is_a_helper <const gimple_statement_omp_atomic_load *>::test):
Rename to...
(is_a_helper <const gomp_atomic_load *>::test): ...this.
(is_a_helper <const gimple_statement_omp_atomic_store *>::test):
Rename to...
(is_a_helper <const gomp_atomic_store *>::test): ...this.
(is_a_helper <const gimple_statement_omp_continue *>::test):
Rename to...
(is_a_helper <const gomp_continue *>::test): ...this.
(is_a_helper <const gimple_statement_omp_critical *>::test):
Rename to...
(is_a_helper <const gomp_critical *>::test): ...this.
(is_a_helper <const gimple_statement_omp_for *>::test): Rename to...
(is_a_helper <const gomp_for *>::test): ...this.
(is_a_helper <const gimple_statement_omp_parallel *>::test):
Rename to...
(is_a_helper <const gomp_parallel *>::test): ...this.
(is_a_helper <const gimple_statement_omp_target *>::test): Rename to...
(is_a_helper <const gomp_target *>::test): ...this.
(is_a_helper <const gimple_statement_omp_sections *>::test):
Rename to...
(is_a_helper <const gomp_sections *>::test): ...this.
(is_a_helper <const gimple_statement_omp_single *>::test): Rename to...
(is_a_helper <const gomp_single *>::test): ...this.
(is_a_helper <const gimple_statement_omp_teams *>::test): Rename to...
(is_a_helper <const gomp_teams *>::test): ...this.
(is_a_helper <const gimple_statement_omp_task *>::test): Rename to...
(is_a_helper <const gomp_task *>::test): ...this.
(is_a_helper <const gimple_statement_phi *>::test): Rename to...
(is_a_helper <const gphi *>::test): ...this.
(is_a_helper <const gimple_statement_transaction *>::test): Rename to...
(is_a_helper <const gtransaction *>::test): ...this.
(gimple_build_return): Strengthen return type to greturn *.
(gimple_call_reset_alias_info): Require a gcall *.
(gimple_build_call_vec): Return a gcall *.
(gimple_build_call): Likewise.
(gimple_build_call_valist): Likewise.
(gimple_build_call_internal): Likewise.
(gimple_build_call_internal_vec): Likewise.
(gimple_build_call_from_tree): Likewise.
(gimple_build_assign_stat): Return a gassign *.
(gimple_build_assign_with_ops): Likewise.
(gimple_build_cond): Return a gcond *.
(gimple_build_cond_from_tree): Likewise.
(gimple_cond_set_condition_from_tree): Require a gcond *.
(gimple_build_label): Return a glabel *.
(gimple_build_goto): Return a ggoto *.
(gimple_build_bind): Return a gbind *.
(gimple_build_asm_vec): Return a gasm *.
(gimple_build_catch): Return a gcatch *.
(gimple_build_eh_filter): Return a geh_filter *.
(gimple_build_eh_must_not_throw): Return a geh_mnt *.
(gimple_build_eh_else): Return a geh_else *.
(gimple_build_try): Return a gtry *.
(gimple_build_resx): Return a gresx *.
(gimple_build_switch_nlabels): Return a gswitch *.
(gimple_build_switch): Return a gswitch *.
(gimple_build_eh_dispatch): Return a geh_dispatch *.
(gimple_build_debug_bind_stat): Return a gdebug *.
(gimple_build_debug_source_bind_stat): Return a gdebug *.
(gimple_build_omp_critical): Return a gomp_critical *.
(gimple_build_omp_for): Return a gomp_for *.
(gimple_build_omp_parallel): Return a gomp_parallel *.
(gimple_build_omp_task): Return a gomp_task *.
(gimple_build_omp_continue): Return a gomp_continue *.
(gimple_build_omp_sections): Return a gomp_sections *.
(gimple_build_omp_single): Return a gomp_single *.
(gimple_build_omp_target): Return a gomp_target *.
(gimple_build_omp_teams): Return a gomp_teams *.
(gimple_build_omp_atomic_load): Return a gomp_atomic_load *.
(gimple_build_omp_atomic_store): Return a gomp_atomic_store *.
(gimple_build_transaction): Return a gtransaction *.
(gimple_call_arg_flags): Require a const gcall *.
(gimple_call_return_flags): Likewise.
(gimple_call_copy_skip_args): Require and return a gcall *.
(gimple_asm_clobbers_memory_p): Require a const gasm *.
(gimple_seq_first_stmt_as_a_bind): New.
(gimple_assign_nontemporal_move_p): Require a const gassign *
rather than a const_gimple.
(gimple_call_internal_fn): Update for renaming to gcall.
(gimple_call_fntype): Likewise.
(gimple_call_set_fntype): Require a gcall * rather than a gimple.
(gimple_call_set_fn): Likewise.
(gimple_call_set_internal_fn): Likewise.
(gimple_call_set_chain): Likewise.
(gimple_call_set_tail): Likewise.
(gimple_call_tail_p): Likewise.
(gimple_call_set_return_slot_opt): Likewise.
(gimple_call_return_slot_opt_p): Likewise.
(gimple_call_set_from_thunk): Likewise.
(gimple_call_from_thunk_p): Likewise.
(gimple_call_set_va_arg_pack): Likewise.
(gimple_call_va_arg_pack_p): Likewise.
(gimple_call_set_nothrow): Likewise.
(gimple_call_nothrow_p): Likewise.
(gimple_call_set_alloca_for_var): Likewise.
(gimple_call_alloca_for_var_p): Likewise.
(gimple_call_use_set): Likewise.
(gimple_call_clobber_set): Likewise.
(gimple_call_return_type): Require a const gcall * rather than a
const_gimple.
(gimple_call_chain_ptr): Likewise.
(gimple_call_copy_flags): Require a pair of gcall *.
(gimple_cond_set_code): Require a gcond * rather than a gimple
(gimple_cond_set_lhs): Likewise.
(gimple_cond_set_rhs): Likewise.
(gimple_cond_set_true_label): Likewise.
(gimple_cond_set_false_label): Likewise.
(gimple_cond_make_false): Likewise.
(gimple_cond_make_true): Likewise.
(gimple_cond_lhs_ptr): Require a const gcond * rather than a
const_gimple.
(gimple_cond_rhs_ptr): Likewise.
(gimple_cond_true_label): Likewise.
(gimple_cond_false_label): Likewise.
(gimple_cond_true_p): Likewise.
(gimple_cond_false_p): Likewise.
(gimple_cond_set_condition): Likewise.
(gimple_label_label): Require a const glabel *.
(gimple_label_set_label): Require a glabel *.
(gimple_goto_set_dest): Require a ggoto *.
(gimple_bind_vars): Require a const gbind *.
(gimple_bind_block): Likewise.
(gimple_bind_set_vars): Require a gbind *.
(gimple_bind_append_vars): Likewise.
(gimple_bind_body_ptr): Likewise.
(gimple_bind_body): Likewise.
(gimple_bind_set_body): Likewise.
(gimple_bind_add_stmt): Likewise.
(gimple_bind_add_seq): Likewise.
(gimple_bind_set_block): Likewise.
(gimple_asm_ninputs): Require a const gasm *.
(gimple_asm_noutputs): Likewise.
(gimple_asm_nclobbers): Likewise.
(gimple_asm_nlabels): Likewise.
(gimple_asm_input_op): Likewise.
(gimple_asm_input_op_ptr): Likewise.
(gimple_asm_output_op): Likewise.
(gimple_asm_output_op_ptr): Likewise.
(gimple_asm_clobber_op): Likewise.
(gimple_asm_label_op): Likewise.
(gimple_asm_string): Likewise.
(gimple_asm_volatile_p): Likewise.
(gimple_asm_input_p): Likewise.
(gimple_asm_set_input_op): Require a gasm *.
(gimple_asm_set_output_op): Likewise.
(gimple_asm_set_clobber_op): Likewise.
(gimple_asm_set_label_op): Likewise.
(gimple_asm_set_volatile): Likewise.
(gimple_asm_set_input): Likewise.
(gimple_catch_types): Require a const gcatch *.
(gimple_catch_types_ptr): Require a gcatch *.
(gimple_catch_handler_ptr): Likewise.
(gimple_catch_handler): Likewise.
(gimple_catch_set_types): Likewise.
(gimple_catch_set_handler): Likewise.
(gimple_eh_filter_types): Update for renaming of subclass to
geh_filter.
(gimple_eh_filter_types_ptr): Likewise.
(gimple_eh_filter_failure_ptr): Likewise.
(gimple_eh_filter_set_types): Require a geh_filter *.
(gimple_eh_filter_set_failure): Likewise.
(gimple_eh_must_not_throw_fndecl): Require a geh_mnt *.
(gimple_eh_must_not_throw_set_fndecl): Likewise.
(gimple_eh_else_n_body_ptr): Require a geh_else *.
(gimple_eh_else_n_body): Likewise.
(gimple_eh_else_e_body_ptr): Likewise.
(gimple_eh_else_e_body): Likewise.
(gimple_eh_else_set_n_body): Likewise.
(gimple_eh_else_set_e_body): Likewise.
(gimple_try_set_kind): Require a gtry *.
(gimple_try_set_catch_is_cleanup): Likewise.
(gimple_try_set_eval): Likewise.
(gimple_try_set_cleanup): Likewise.
(gimple_try_eval_ptr): Update for renaming of subclass to gtry.
(gimple_try_cleanup_ptr): Likewise.
(gimple_phi_capacity): Update for renaming of subclass to gphi.
(gimple_phi_num_args): Likewise.
(gimple_phi_result): Likewise.
(gimple_phi_result_ptr): Likewise.
(gimple_phi_arg): Likewise.
(gimple_phi_set_result): Require a gphi *.
(gimple_phi_set_arg): Likewise.
(gimple_phi_arg_def_ptr): Likewise.
(gimple_phi_arg_edge): Likewise.
(gimple_phi_arg_location): Likewise.
(gimple_phi_arg_location_from_edge): Likewise.
(gimple_phi_arg_set_location): Likewise.
(gimple_phi_arg_has_location): Likewise.
(gimple_resx_region): Require a const gresx *.
(gimple_resx_set_region): Require a gresx *.
(gimple_eh_dispatch_region): Require a const geh_dispatch *.
(gimple_eh_dispatch_set_region): Require a geh_dispatch *.
(gimple_switch_num_labels): Require a const gswitch *.
(gimple_switch_set_num_labels): Likewise.
(gimple_switch_index): Likewise.
(gimple_switch_index_ptr): Likewise.
(gimple_switch_label): Likewise.
(gimple_switch_default_label): Likewise.
(gimple_switch_set_index): Require a gswitch *.
(gimple_switch_set_label): Likewise.
(gimple_switch_set_default_label): Likewise.
(gimple_omp_critical_name): Require a const gomp_critical *.
(gimple_omp_critical_name_ptr): Require a gomp_critical *.
(gimple_omp_critical_set_name): Likewise.
(gimple_omp_for_set_kind): Require a gomp_for *.
(gimple_omp_for_set_combined_p): Likewise.
(gimple_omp_for_set_combined_into_p): Likewise.
(gimple_omp_for_clauses): Update for renaming of subclass to
gomp_for.
(gimple_omp_for_clauses_ptr): Likewise.
(gimple_omp_for_set_clauses): Likewise.
(gimple_omp_for_collapse): Likewise.
(gimple_omp_for_index): Likewise.
(gimple_omp_for_index_ptr): Likewise.
(gimple_omp_for_set_index): Likewise.
(gimple_omp_for_initial): Likewise.
(gimple_omp_for_initial_ptr): Likewise.
(gimple_omp_for_set_initial): Likewise.
(gimple_omp_for_final): Likewise.
(gimple_omp_for_final_ptr): Likewise.
(gimple_omp_for_set_final): Likewise.
(gimple_omp_for_incr): Likewise.
(gimple_omp_for_incr_ptr): Likewise.
(gimple_omp_for_set_incr): Likewise.
(gimple_omp_for_pre_body): Likewise.
(gimple_omp_for_set_pre_body): Likewise.
(gimple_omp_parallel_clauses): Update for renaming of subclass to
gomp_parallel.
(gimple_omp_parallel_clauses_ptr): Require a gomp_parallel *.
(gimple_omp_parallel_set_clauses): Likewise.
(gimple_omp_parallel_child_fn_ptr): Likewise.
(gimple_omp_parallel_set_child_fn): Likewise.
(gimple_omp_parallel_data_arg_ptr): Likewise.
(gimple_omp_parallel_set_data_arg): Likewise.
(gimple_omp_parallel_child_fn): Require a const gomp_parallel *.
(gimple_omp_parallel_data_arg): Likewise.
(gimple_omp_task_clauses): Update for renaming of subclass to
gomp_task.
(gimple_omp_task_clauses_ptr): Likewise.
(gimple_omp_task_set_clauses): Likewise.
(gimple_omp_task_child_fn): Likewise.
(gimple_omp_task_child_fn_ptr): Likewise.
(gimple_omp_task_set_child_fn): Likewise.
(gimple_omp_task_data_arg): Likewise.
(gimple_omp_task_data_arg_ptr): Likewise.
(gimple_omp_task_set_data_arg): Likewise.
(gimple_omp_taskreg_clauses): Whitespace fixes.
(gimple_omp_taskreg_clauses_ptr): Likewise.
(gimple_omp_taskreg_set_clauses): Likewise.
(gimple_omp_taskreg_child_fn): Likewise.
(gimple_omp_taskreg_child_fn_ptr): Likewise.
(gimple_omp_taskreg_set_child_fn): Likewise.
(gimple_omp_taskreg_data_arg): Likewise.
(gimple_omp_taskreg_data_arg_ptr): Likewise.
(gimple_omp_taskreg_set_data_arg): Likewise.
(gimple_omp_task_copy_fn): Update for renaming of subclass to
gomp_task.
(gimple_omp_task_copy_fn_ptr): Likewise.
(gimple_omp_task_set_copy_fn): Likewise.
(gimple_omp_task_arg_size): Likewise.
(gimple_omp_task_arg_size_ptr): Likewise.
(gimple_omp_task_set_arg_size): Likewise.
(gimple_omp_task_arg_align): Likewise.
(gimple_omp_task_arg_align_ptr): Likewise.
(gimple_omp_task_set_arg_align): Likewise.
(gimple_omp_single_clauses): Update for renaming of subclass to
gomp_single.
(gimple_omp_single_clauses_ptr): Likewise.
(gimple_omp_single_set_clauses): Likewise.
(gimple_omp_target_clauses): Update for renaming of subclass to
gomp_target.
(gimple_omp_target_clauses_ptr): Likewise.
(gimple_omp_target_set_clauses): Require a gomp_target *.
(gimple_omp_target_set_kind): Likewise.
(gimple_omp_target_child_fn_ptr): Likewise.
(gimple_omp_target_set_child_fn): Likewise.
(gimple_omp_target_data_arg_ptr): Likewise.
(gimple_omp_target_set_data_arg): Likewise.
(gimple_omp_target_child_fn): Require a const gomp_target *.
(gimple_omp_target_data_arg): Likewise.
(gimple_omp_teams_clauses): Update for renaming of subclass to
gomp_teams.
(gimple_omp_teams_clauses_ptr): Likewise.
(gimple_omp_teams_set_clauses): Require a gomp_teams *.
(gimple_omp_sections_clauses): Update for renaming of subclass to
gomp_sections.
(gimple_omp_sections_clauses_ptr): Likewise.
(gimple_omp_sections_set_clauses): Likewise.
(gimple_omp_sections_control): Likewise.
(gimple_omp_sections_control_ptr): Likewise.
(gimple_omp_sections_set_control): Likewise.
(gimple_omp_for_set_cond): Likewise.
(gimple_omp_for_cond): Likewise.
(gimple_omp_atomic_store_set_val): Require a gomp_atomic_store *.
(gimple_omp_atomic_store_val_ptr): Likewise.
(gimple_omp_atomic_load_set_lhs): Likewise.
(gimple_omp_atomic_store_val): Require a const gomp_atomic_store *.
(gimple_omp_atomic_load_lhs): Likewise.
(gimple_omp_atomic_load_rhs): Likewise.
(gimple_omp_atomic_load_lhs_ptr): Require a gomp_atomic_load *.
(gimple_omp_atomic_load_set_rhs): Likewise.
(gimple_omp_atomic_load_rhs_ptr): Likewise.
(gimple_omp_continue_control_def): Require a const gomp_continue *.
(gimple_omp_continue_control_use): Likewise.
(gimple_omp_continue_control_def_ptr): Require a gomp_continue *.
(gimple_omp_continue_set_control_def): Likewise.
(gimple_omp_continue_control_use_ptr): Likewise.
(gimple_omp_continue_set_control_use): Likewise.
(gimple_transaction_body_ptr): Require a gtransaction *.
(gimple_transaction_body): Likewise.
(gimple_transaction_label_ptr): Likewise.
(gimple_transaction_label): Require a const gtransaction *.
(gimple_transaction_subcode): Likewise.
(gimple_transaction_set_body): Require a gtransaction *.
(gimple_transaction_set_label): Likewise.
(gimple_transaction_set_subcode): Likewise.
(gimple_return_retval_ptr): Require a const greturn *.
(gimple_return_retval): Likewise.
(gimple_return_set_retval): Require a greturn *.
(gimple_expr_type): Introduce local "call_stmt" and use in place of
"stmt" for typesafety.
* asan.c: Use gimple subclasses.
* auto-profile.c: Likewise.
* builtins.c: Likewise.
* builtins.h: Likewise.
* cfgexpand.c: Likewise.
* cfgloop.c: Likewise.
* cfgloopmanip.c: Likewise.
* cgraph.c: Likewise.
* cgraph.h: Likewise.
* cgraphbuild.c: Likewise.
* cgraphclones.c: Likewise.
* cgraphunit.c: Likewise.
* expr.h: Likewise.
* gimple-builder.c: Likewise.
* gimple-builder.h: Likewise.
* gimple-fold.c: Likewise.
* gimple-low.c: Likewise.
* gimple-pretty-print.c: Likewise.
* gimple-ssa-isolate-paths.c: Likewise.
* gimple-ssa-strength-reduction.c: Likewise.
* gimple-streamer-in.c: Likewise.
* gimple-streamer-out.c: Likewise.
* gimple-walk.c: Likewise.
* gimplify-me.c: Likewise.
* gimplify.c: Likewise.
* gimplify.h: Likewise.
* graphite-scop-detection.c: Likewise.
* graphite-sese-to-poly.c: Likewise.
* internal-fn.c: Likewise.
* internal-fn.def:: Likewise.
* internal-fn.h: Likewise.
* ipa-icf-gimple.c: Likewise.
* ipa-icf-gimple.h: Likewise.
* ipa-icf.c: Likewise.
* ipa-inline-analysis.c: Likewise.
* ipa-prop.c: Likewise.
* ipa-prop.h: Likewise.
* ipa-pure-const.c: Likewise.
* ipa-split.c: Likewise.
* lto-streamer-in.c: Likewise.
* lto-streamer-out.c: Likewise.
* omp-low.c: Likewise.
* predict.c: Likewise.
* sanopt.c: Likewise.
* sese.c: Likewise.
* ssa-iterators.h: Likewise.
* stmt.c: Likewise.
* trans-mem.c: Likewise.
* tree-call-cdce.c: Likewise.
* tree-cfg.c: Likewise.
* tree-cfg.h: Likewise.
* tree-cfgcleanup.c: Likewise.
* tree-chkp.c: Likewise.
* tree-chkp.h: Likewise.
* tree-complex.c: Likewise.
* tree-data-ref.c: Likewise.
* tree-dfa.c: Likewise.
* tree-eh.c: Likewise.
* tree-eh.h: Likewise.
* tree-emutls.c: Likewise.
* tree-if-conv.c: Likewise.
* tree-inline.c: Likewise.
* tree-inline.h: Likewise.
* tree-into-ssa.c: Likewise.
* tree-into-ssa.h: Likewise.
* tree-loop-distribution.c: Likewise.
* tree-nrv.c: Likewise.
* tree-object-size.c: Likewise.
* tree-outof-ssa.c: Likewise.
* tree-parloops.c: Likewise.
* tree-phinodes.c: Likewise.
* tree-phinodes.h: Likewise.
* tree-predcom.c: Likewise.
* tree-profile.c: Likewise.
* tree-scalar-evolution.c: Likewise.
* tree-scalar-evolution.h
* tree-sra.cn_function):
* tree-ssa-alias.c: Likewise.
* tree-ssa-alias.h: Likewise.
* tree-ssa-ccp.c: Likewise.
* tree-ssa-coalesce.c: Likewise.
* tree-ssa-copy.c: Likewise.
* tree-ssa-copyrename.c: Likewise.
* tree-ssa-dce.c: Likewise.
* tree-ssa-dom.c: Likewise.
* tree-ssa-forwprop.c: Likewise.
* tree-ssa-ifcombine.c: Likewise.
* tree-ssa-live.c: Likewise.
* tree-ssa-loop-im.c: Likewise.
* tree-ssa-loop-ivcanon.c: Likewise.
* tree-ssa-loop-ivopts.c: Likewise.
* tree-ssa-loop-manip.c: Likewise.
* tree-ssa-loop-niter.c: Likewise.
* tree-ssa-loop-prefetch.c: Likewise.
* tree-ssa-loop-unswitch.c: Likewise.
* tree-ssa-math-opts.c: Likewise.
* tree-ssa-operands.c: Likewise.
* tree-ssa-phiopt.c: Likewise.
* tree-ssa-phiprop.c: Likewise.
* tree-ssa-pre.c: Likewise.
* tree-ssa-propagate.c: Likewise.
* tree-ssa-propagate.h: Likewise.
* tree-ssa-reassoc.c: Likewise.
* tree-ssa-sccvn.c: Likewise.
* tree-ssa-sccvn.h: Likewise.
* tree-ssa-sink.c: Likewise.
* tree-ssa-strlen.c
* tree-ssa-structalias.c
* tree-ssa-tail-merge.c: Likewise.
* tree-ssa-ter.c: Likewise.
* tree-ssa-threadedge.c: Likewise.
* tree-ssa-threadedge.h: Likewise.
* tree-ssa-threadupdate.c: Likewise.
* tree-ssa-uncprop.c: Likewise.
* tree-ssa-uninit.c: Likewise.
* tree-ssa.c: Likewise.
* tree-stdarg.c: Likewise.
* tree-switch-conversion.c: Likewise.
* tree-tailcall.c: Likewise.
* tree-vect-data-refs.c: Likewise.
* tree-vect-generic.c: Likewise.
* tree-vect-loop-manip.c: Likewise.
* tree-vect-loop.c: Likewise.
* tree-vect-patterns.c: Likewise.
* tree-vect-slp.c: Likewise.
* tree-vect-stmts.c: Likewise.
* tree-vectorizer.h: Likewise.
* tree-vrp.c: Likewise.
* tree.c: Likewise.
* ubsan.c: Likewise.
* value-prof.c: Likewise.
* value-prof.h: Likewise.
* vtable-verify.c: Likewise.
gcc/c-family/ChangeLog:
Merger of git branch "gimple-classes-v2-option-3".
* ChangeLog.gimple-classes: New.
* c-gimplify.c (add_block_to_enclosing): Strengthen local "stack"
from being just a vec<gimple> to a vec<gbind *>.
gcc/java/ChangeLog:
Merger of git branch "gimple-classes-v2-option-3".
* ChangeLog.gimple-classes: New.
* java-gimplify.c (java_gimplify_block): Strengthen local "outer"
from gimple to gbind *.
From-SVN: r217787
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 407 |
1 files changed, 225 insertions, 182 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 71a828c..e78554f 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -164,7 +164,7 @@ static void make_blocks (gimple_seq); static void make_edges (void); static void assign_discriminators (void); static void make_cond_expr_edges (basic_block); -static void make_gimple_switch_edges (basic_block); +static void make_gimple_switch_edges (gswitch *, basic_block); static bool make_goto_expr_edges (basic_block); static void make_gimple_asm_edges (basic_block); static edge gimple_redirect_edge_and_branch (edge, basic_block); @@ -175,7 +175,7 @@ static inline bool stmt_starts_bb_p (gimple, gimple); static int gimple_verify_flow_info (void); static void gimple_make_forwarder_block (edge); static gimple first_non_label_stmt (basic_block); -static bool verify_gimple_transaction (gimple); +static bool verify_gimple_transaction (gtransaction *); static bool call_can_make_abnormal_goto (gimple); /* Flowgraph optimization and cleanup. */ @@ -184,8 +184,8 @@ static bool gimple_can_merge_blocks_p (basic_block, basic_block); static void remove_bb (basic_block); static edge find_taken_edge_computed_goto (basic_block, tree); static edge find_taken_edge_cond_expr (basic_block, tree); -static edge find_taken_edge_switch_expr (basic_block, tree); -static tree find_case_label_for_value (gimple, tree); +static edge find_taken_edge_switch_expr (gswitch *, basic_block, tree); +static tree find_case_label_for_value (gswitch *, tree); void init_empty_tree_cfg_for_function (struct function *fn) @@ -623,13 +623,16 @@ fold_cond_expr_cond (void) if (stmt && gimple_code (stmt) == GIMPLE_COND) { + gcond *cond_stmt = as_a <gcond *> (stmt); location_t loc = gimple_location (stmt); tree cond; bool zerop, onep; fold_defer_overflow_warnings (); - cond = fold_binary_loc (loc, gimple_cond_code (stmt), boolean_type_node, - gimple_cond_lhs (stmt), gimple_cond_rhs (stmt)); + cond = fold_binary_loc (loc, gimple_cond_code (cond_stmt), + boolean_type_node, + gimple_cond_lhs (cond_stmt), + gimple_cond_rhs (cond_stmt)); if (cond) { zerop = integer_zerop (cond); @@ -642,9 +645,9 @@ fold_cond_expr_cond (void) stmt, WARN_STRICT_OVERFLOW_CONDITIONAL); if (zerop) - gimple_cond_make_false (stmt); + gimple_cond_make_false (cond_stmt); else if (onep) - gimple_cond_make_true (stmt); + gimple_cond_make_true (cond_stmt); } } } @@ -836,7 +839,7 @@ make_edges (void) fallthru = false; break; case GIMPLE_SWITCH: - make_gimple_switch_edges (bb); + make_gimple_switch_edges (as_a <gswitch *> (last), bb); fallthru = false; break; case GIMPLE_RESX: @@ -844,7 +847,7 @@ make_edges (void) fallthru = false; break; case GIMPLE_EH_DISPATCH: - fallthru = make_eh_dispatch_edges (last); + fallthru = make_eh_dispatch_edges (as_a <geh_dispatch *> (last)); break; case GIMPLE_CALL: @@ -891,7 +894,8 @@ make_edges (void) case GIMPLE_TRANSACTION: { - tree abort_label = gimple_transaction_label (last); + tree abort_label + = gimple_transaction_label (as_a <gtransaction *> (last)); if (abort_label) make_edge (bb, label_to_block (abort_label), EDGE_TM_ABORT); fallthru = true; @@ -939,10 +943,10 @@ make_edges (void) { for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { - gimple label_stmt = gsi_stmt (gsi); + glabel *label_stmt = dyn_cast <glabel *> (gsi_stmt (gsi)); tree target; - if (gimple_code (label_stmt) != GIMPLE_LABEL) + if (!label_stmt) break; target = gimple_label_label (label_stmt); @@ -1074,7 +1078,7 @@ assign_discriminators (void) static void make_cond_expr_edges (basic_block bb) { - gimple entry = last_stmt (bb); + gcond *entry = as_a <gcond *> (last_stmt (bb)); gimple then_stmt, else_stmt; basic_block then_bb, else_bb; tree then_label, else_label; @@ -1159,7 +1163,7 @@ end_recording_case_labels (void) { gimple stmt = last_stmt (bb); if (stmt && gimple_code (stmt) == GIMPLE_SWITCH) - group_case_labels_stmt (stmt); + group_case_labels_stmt (as_a <gswitch *> (stmt)); } } BITMAP_FREE (touched_switch_bbs); @@ -1171,7 +1175,7 @@ end_recording_case_labels (void) Otherwise return NULL. */ static tree -get_cases_for_edge (edge e, gimple t) +get_cases_for_edge (edge e, gswitch *t) { tree *slot; size_t i, n; @@ -1210,9 +1214,8 @@ get_cases_for_edge (edge e, gimple t) /* Create the edges for a GIMPLE_SWITCH starting at block BB. */ static void -make_gimple_switch_edges (basic_block bb) +make_gimple_switch_edges (gswitch *entry, basic_block bb) { - gimple entry = last_stmt (bb); size_t i, n; n = gimple_switch_num_labels (entry); @@ -1280,7 +1283,7 @@ make_goto_expr_edges (basic_block bb) static void make_gimple_asm_edges (basic_block bb) { - gimple stmt = last_stmt (bb); + gasm *stmt = as_a <gasm *> (last_stmt (bb)); int i, n = gimple_asm_nlabels (stmt); for (i = 0; i < n; ++i) @@ -1404,12 +1407,12 @@ cleanup_dead_labels (void) for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i)) { tree label; - gimple stmt = gsi_stmt (i); + glabel *label_stmt = dyn_cast <glabel *> (gsi_stmt (i)); - if (gimple_code (stmt) != GIMPLE_LABEL) + if (!label_stmt) break; - label = gimple_label_label (stmt); + label = gimple_label_label (label_stmt); /* If we have not yet seen a label for the current block, remember this one and see if there are more labels. */ @@ -1444,31 +1447,35 @@ cleanup_dead_labels (void) switch (gimple_code (stmt)) { case GIMPLE_COND: - label = gimple_cond_true_label (stmt); - if (label) - { - new_label = main_block_label (label); - if (new_label != label) - gimple_cond_set_true_label (stmt, new_label); - } + { + gcond *cond_stmt = as_a <gcond *> (stmt); + label = gimple_cond_true_label (cond_stmt); + if (label) + { + new_label = main_block_label (label); + if (new_label != label) + gimple_cond_set_true_label (cond_stmt, new_label); + } - label = gimple_cond_false_label (stmt); - if (label) - { - new_label = main_block_label (label); - if (new_label != label) - gimple_cond_set_false_label (stmt, new_label); - } + label = gimple_cond_false_label (cond_stmt); + if (label) + { + new_label = main_block_label (label); + if (new_label != label) + gimple_cond_set_false_label (cond_stmt, new_label); + } + } break; case GIMPLE_SWITCH: { - size_t i, n = gimple_switch_num_labels (stmt); + gswitch *switch_stmt = as_a <gswitch *> (stmt); + size_t i, n = gimple_switch_num_labels (switch_stmt); /* Replace all destination labels. */ for (i = 0; i < n; ++i) { - tree case_label = gimple_switch_label (stmt, i); + tree case_label = gimple_switch_label (switch_stmt, i); label = CASE_LABEL (case_label); new_label = main_block_label (label); if (new_label != label) @@ -1479,11 +1486,12 @@ cleanup_dead_labels (void) case GIMPLE_ASM: { - int i, n = gimple_asm_nlabels (stmt); + gasm *asm_stmt = as_a <gasm *> (stmt); + int i, n = gimple_asm_nlabels (asm_stmt); for (i = 0; i < n; ++i) { - tree cons = gimple_asm_label_op (stmt, i); + tree cons = gimple_asm_label_op (asm_stmt, i); tree label = main_block_label (TREE_VALUE (cons)); TREE_VALUE (cons) = label; } @@ -1495,21 +1503,23 @@ cleanup_dead_labels (void) case GIMPLE_GOTO: if (!computed_goto_p (stmt)) { - label = gimple_goto_dest (stmt); + ggoto *goto_stmt = as_a <ggoto *> (stmt); + label = gimple_goto_dest (goto_stmt); new_label = main_block_label (label); if (new_label != label) - gimple_goto_set_dest (stmt, new_label); + gimple_goto_set_dest (goto_stmt, new_label); } break; case GIMPLE_TRANSACTION: { - tree label = gimple_transaction_label (stmt); + gtransaction *trans_stmt = as_a <gtransaction *> (stmt); + tree label = gimple_transaction_label (trans_stmt); if (label) { tree new_label = main_block_label (label); if (new_label != label) - gimple_transaction_set_label (stmt, new_label); + gimple_transaction_set_label (trans_stmt, new_label); } } break; @@ -1540,12 +1550,12 @@ cleanup_dead_labels (void) for (i = gsi_start_bb (bb); !gsi_end_p (i); ) { tree label; - gimple stmt = gsi_stmt (i); + glabel *label_stmt = dyn_cast <glabel *> (gsi_stmt (i)); - if (gimple_code (stmt) != GIMPLE_LABEL) + if (!label_stmt) break; - label = gimple_label_label (stmt); + label = gimple_label_label (label_stmt); if (label == label_for_this_bb || !DECL_ARTIFICIAL (label) @@ -1565,7 +1575,7 @@ cleanup_dead_labels (void) Eg. three separate entries 1: 2: 3: become one entry 1..3: */ void -group_case_labels_stmt (gimple stmt) +group_case_labels_stmt (gswitch *stmt) { int old_size = gimple_switch_num_labels (stmt); int i, j, new_size = old_size; @@ -1653,7 +1663,7 @@ group_case_labels (void) { gimple stmt = last_stmt (bb); if (stmt && gimple_code (stmt) == GIMPLE_SWITCH) - group_case_labels_stmt (stmt); + group_case_labels_stmt (as_a <gswitch *> (stmt)); } } @@ -1663,7 +1673,6 @@ static bool gimple_can_merge_blocks_p (basic_block a, basic_block b) { gimple stmt; - gimple_stmt_iterator gsi; if (!single_succ_p (a)) return false; @@ -1687,19 +1696,20 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b) return false; /* Do not allow a block with only a non-local label to be merged. */ - if (stmt - && gimple_code (stmt) == GIMPLE_LABEL - && DECL_NONLOCAL (gimple_label_label (stmt))) - return false; + if (stmt) + if (glabel *label_stmt = dyn_cast <glabel *> (stmt)) + if (DECL_NONLOCAL (gimple_label_label (label_stmt))) + return false; /* Examine the labels at the beginning of B. */ - for (gsi = gsi_start_bb (b); !gsi_end_p (gsi); gsi_next (&gsi)) + for (gimple_stmt_iterator gsi = gsi_start_bb (b); !gsi_end_p (gsi); + gsi_next (&gsi)) { tree lab; - stmt = gsi_stmt (gsi); - if (gimple_code (stmt) != GIMPLE_LABEL) + glabel *label_stmt = dyn_cast <glabel *> (gsi_stmt (gsi)); + if (!label_stmt) break; - lab = gimple_label_label (stmt); + lab = gimple_label_label (label_stmt); /* Do not remove user forced labels or for -O0 any user labels. */ if (!DECL_ARTIFICIAL (lab) && (!optimize || FORCED_LABEL (lab))) @@ -1717,9 +1727,10 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b) /* It must be possible to eliminate all phi nodes in B. If ssa form is not up-to-date and a name-mapping is registered, we cannot eliminate any phis. Symbols marked for renaming are never a problem though. */ - for (gsi = gsi_start_phis (b); !gsi_end_p (gsi); gsi_next (&gsi)) + for (gphi_iterator gsi = gsi_start_phis (b); !gsi_end_p (gsi); + gsi_next (&gsi)) { - gimple phi = gsi_stmt (gsi); + gphi *phi = gsi.phi (); /* Technically only new names matter. */ if (name_registered_for_update_p (PHI_RESULT (phi))) return false; @@ -1768,7 +1779,8 @@ replace_uses_by (tree name, tree val) if (gimple_code (stmt) == GIMPLE_PHI) { - e = gimple_phi_arg_edge (stmt, PHI_ARG_INDEX_FROM_USE (use)); + e = gimple_phi_arg_edge (as_a <gphi *> (stmt), + PHI_ARG_INDEX_FROM_USE (use)); if (e->flags & EDGE_ABNORMAL) { /* This can only occur for virtual operands, since @@ -1830,7 +1842,8 @@ replace_uses_by (tree name, tree val) static void gimple_merge_blocks (basic_block a, basic_block b) { - gimple_stmt_iterator last, gsi, psi; + gimple_stmt_iterator last, gsi; + gphi_iterator psi; if (dump_file) fprintf (dump_file, "Merging blocks %d and %d\n", a->index, b->index); @@ -1902,9 +1915,9 @@ gimple_merge_blocks (basic_block a, basic_block b) for (gsi = gsi_start_bb (b); !gsi_end_p (gsi);) { gimple stmt = gsi_stmt (gsi); - if (gimple_code (stmt) == GIMPLE_LABEL) + if (glabel *label_stmt = dyn_cast <glabel *> (stmt)) { - tree label = gimple_label_label (stmt); + tree label = gimple_label_label (label_stmt); int lp_nr; gsi_remove (&gsi, false); @@ -1988,7 +2001,7 @@ single_noncomplex_succ (basic_block bb) /* T is CALL_EXPR. Set current_function_calls_* flags. */ void -notice_special_calls (gimple call) +notice_special_calls (gcall *call) { int flags = gimple_call_flags (call); @@ -2062,9 +2075,10 @@ remove_bb (basic_block bb) for (i = gsi_last_bb (bb); !gsi_end_p (i);) { gimple stmt = gsi_stmt (i); - if (gimple_code (stmt) == GIMPLE_LABEL - && (FORCED_LABEL (gimple_label_label (stmt)) - || DECL_NONLOCAL (gimple_label_label (stmt)))) + glabel *label_stmt = dyn_cast <glabel *> (stmt); + if (label_stmt + && (FORCED_LABEL (gimple_label_label (label_stmt)) + || DECL_NONLOCAL (gimple_label_label (label_stmt)))) { basic_block new_bb; gimple_stmt_iterator new_gsi; @@ -2072,10 +2086,10 @@ remove_bb (basic_block bb) /* A non-reachable non-local label may still be referenced. But it no longer needs to carry the extra semantics of non-locality. */ - if (DECL_NONLOCAL (gimple_label_label (stmt))) + if (DECL_NONLOCAL (gimple_label_label (label_stmt))) { - DECL_NONLOCAL (gimple_label_label (stmt)) = 0; - FORCED_LABEL (gimple_label_label (stmt)) = 1; + DECL_NONLOCAL (gimple_label_label (label_stmt)) = 0; + FORCED_LABEL (gimple_label_label (label_stmt)) = 1; } new_bb = bb->prev_bb; @@ -2132,7 +2146,7 @@ find_taken_edge (basic_block bb, tree val) return find_taken_edge_cond_expr (bb, val); if (gimple_code (stmt) == GIMPLE_SWITCH) - return find_taken_edge_switch_expr (bb, val); + return find_taken_edge_switch_expr (as_a <gswitch *> (stmt), bb, val); if (computed_goto_p (stmt)) { @@ -2191,14 +2205,13 @@ find_taken_edge_cond_expr (basic_block bb, tree val) NULL if any edge may be taken. */ static edge -find_taken_edge_switch_expr (basic_block bb, tree val) +find_taken_edge_switch_expr (gswitch *switch_stmt, basic_block bb, + tree val) { basic_block dest_bb; edge e; - gimple switch_stmt; tree taken_case; - switch_stmt = last_stmt (bb); taken_case = find_case_label_for_value (switch_stmt, val); dest_bb = label_to_block (CASE_LABEL (taken_case)); @@ -2213,7 +2226,7 @@ find_taken_edge_switch_expr (basic_block bb, tree val) sorted: We can do a binary search for a case matching VAL. */ static tree -find_case_label_for_value (gimple switch_stmt, tree val) +find_case_label_for_value (gswitch *switch_stmt, tree val) { size_t low, high, n = gimple_switch_num_labels (switch_stmt); tree default_case = gimple_switch_default_label (switch_stmt); @@ -2451,7 +2464,7 @@ is_ctrl_altering_stmt (gimple t) return true; case GIMPLE_ASM: - if (gimple_asm_nlabels (t) > 0) + if (gimple_asm_nlabels (as_a <gasm *> (t)) > 0) return true; break; @@ -2498,16 +2511,17 @@ stmt_starts_bb_p (gimple stmt, gimple prev_stmt) /* Labels start a new basic block only if the preceding statement wasn't a label of the same type. This prevents the creation of consecutive blocks that have nothing but a single label. */ - if (gimple_code (stmt) == GIMPLE_LABEL) + if (glabel *label_stmt = dyn_cast <glabel *> (stmt)) { /* Nonlocal and computed GOTO targets always start a new block. */ - if (DECL_NONLOCAL (gimple_label_label (stmt)) - || FORCED_LABEL (gimple_label_label (stmt))) + if (DECL_NONLOCAL (gimple_label_label (label_stmt)) + || FORCED_LABEL (gimple_label_label (label_stmt))) return true; if (prev_stmt && gimple_code (prev_stmt) == GIMPLE_LABEL) { - if (DECL_NONLOCAL (gimple_label_label (prev_stmt))) + if (DECL_NONLOCAL (gimple_label_label ( + as_a <glabel *> (prev_stmt)))) return true; cfg_stats.num_merged_labels++; @@ -2625,7 +2639,7 @@ reinstall_phi_args (edge new_edge, edge old_edge) { edge_var_map *vm; int i; - gimple_stmt_iterator phis; + gphi_iterator phis; vec<edge_var_map> *v = redirect_edge_var_map_vector (old_edge); if (!v) @@ -2635,7 +2649,7 @@ reinstall_phi_args (edge new_edge, edge old_edge) v->iterate (i, &vm) && !gsi_end_p (phis); i++, gsi_next (&phis)) { - gimple phi = gsi_stmt (phis); + gphi *phi = phis.phi (); tree result = redirect_edge_var_map_result (vm); tree arg = redirect_edge_var_map_def (vm); @@ -3241,7 +3255,7 @@ valid_fixed_convert_types_p (tree type1, tree type2) is a problem, otherwise false. */ static bool -verify_gimple_call (gimple stmt) +verify_gimple_call (gcall *stmt) { tree fn = gimple_call_fn (stmt); tree fntype, fndecl; @@ -3452,7 +3466,7 @@ verify_gimple_comparison (tree type, tree op0, tree op1) Returns true if anything is wrong. */ static bool -verify_gimple_assign_unary (gimple stmt) +verify_gimple_assign_unary (gassign *stmt) { enum tree_code rhs_code = gimple_assign_rhs_code (stmt); tree lhs = gimple_assign_lhs (stmt); @@ -3614,7 +3628,7 @@ verify_gimple_assign_unary (gimple stmt) Returns true if anything is wrong. */ static bool -verify_gimple_assign_binary (gimple stmt) +verify_gimple_assign_binary (gassign *stmt) { enum tree_code rhs_code = gimple_assign_rhs_code (stmt); tree lhs = gimple_assign_lhs (stmt); @@ -3855,7 +3869,7 @@ verify_gimple_assign_binary (gimple stmt) Returns true if anything is wrong. */ static bool -verify_gimple_assign_ternary (gimple stmt) +verify_gimple_assign_ternary (gassign *stmt) { enum tree_code rhs_code = gimple_assign_rhs_code (stmt); tree lhs = gimple_assign_lhs (stmt); @@ -4028,7 +4042,7 @@ verify_gimple_assign_ternary (gimple stmt) Returns true if anything is wrong. */ static bool -verify_gimple_assign_single (gimple stmt) +verify_gimple_assign_single (gassign *stmt) { enum tree_code rhs_code = gimple_assign_rhs_code (stmt); tree lhs = gimple_assign_lhs (stmt); @@ -4242,7 +4256,7 @@ verify_gimple_assign_single (gimple stmt) is a problem, otherwise false. */ static bool -verify_gimple_assign (gimple stmt) +verify_gimple_assign (gassign *stmt) { switch (gimple_assign_rhs_class (stmt)) { @@ -4267,7 +4281,7 @@ verify_gimple_assign (gimple stmt) is a problem, otherwise false. */ static bool -verify_gimple_return (gimple stmt) +verify_gimple_return (greturn *stmt) { tree op = gimple_return_retval (stmt); tree restype = TREE_TYPE (TREE_TYPE (cfun->decl)); @@ -4309,7 +4323,7 @@ verify_gimple_return (gimple stmt) is a problem, otherwise false. */ static bool -verify_gimple_goto (gimple stmt) +verify_gimple_goto (ggoto *stmt) { tree dest = gimple_goto_dest (stmt); @@ -4330,7 +4344,7 @@ verify_gimple_goto (gimple stmt) is a problem, otherwise false. */ static bool -verify_gimple_switch (gimple stmt) +verify_gimple_switch (gswitch *stmt) { unsigned int i, n; tree elt, prev_upper_bound = NULL_TREE; @@ -4434,7 +4448,7 @@ verify_gimple_debug (gimple stmt ATTRIBUTE_UNUSED) Returns true if anything is wrong. */ static bool -verify_gimple_label (gimple stmt) +verify_gimple_label (glabel *stmt) { tree decl = gimple_label_label (stmt); int uid; @@ -4472,6 +4486,31 @@ verify_gimple_label (gimple stmt) return err; } +/* Verify a gimple cond statement STMT. + Returns true if anything is wrong. */ + +static bool +verify_gimple_cond (gcond *stmt) +{ + if (TREE_CODE_CLASS (gimple_cond_code (stmt)) != tcc_comparison) + { + error ("invalid comparison code in gimple cond"); + return true; + } + if (!(!gimple_cond_true_label (stmt) + || TREE_CODE (gimple_cond_true_label (stmt)) == LABEL_DECL) + || !(!gimple_cond_false_label (stmt) + || TREE_CODE (gimple_cond_false_label (stmt)) == LABEL_DECL)) + { + error ("invalid labels in gimple cond"); + return true; + } + + return verify_gimple_comparison (boolean_type_node, + gimple_cond_lhs (stmt), + gimple_cond_rhs (stmt)); +} + /* Verify the GIMPLE statement STMT. Returns true if there is an error, otherwise false. */ @@ -4481,47 +4520,31 @@ verify_gimple_stmt (gimple stmt) switch (gimple_code (stmt)) { case GIMPLE_ASSIGN: - return verify_gimple_assign (stmt); + return verify_gimple_assign (as_a <gassign *> (stmt)); case GIMPLE_LABEL: - return verify_gimple_label (stmt); + return verify_gimple_label (as_a <glabel *> (stmt)); case GIMPLE_CALL: - return verify_gimple_call (stmt); + return verify_gimple_call (as_a <gcall *> (stmt)); case GIMPLE_COND: - if (TREE_CODE_CLASS (gimple_cond_code (stmt)) != tcc_comparison) - { - error ("invalid comparison code in gimple cond"); - return true; - } - if (!(!gimple_cond_true_label (stmt) - || TREE_CODE (gimple_cond_true_label (stmt)) == LABEL_DECL) - || !(!gimple_cond_false_label (stmt) - || TREE_CODE (gimple_cond_false_label (stmt)) == LABEL_DECL)) - { - error ("invalid labels in gimple cond"); - return true; - } - - return verify_gimple_comparison (boolean_type_node, - gimple_cond_lhs (stmt), - gimple_cond_rhs (stmt)); + return verify_gimple_cond (as_a <gcond *> (stmt)); case GIMPLE_GOTO: - return verify_gimple_goto (stmt); + return verify_gimple_goto (as_a <ggoto *> (stmt)); case GIMPLE_SWITCH: - return verify_gimple_switch (stmt); + return verify_gimple_switch (as_a <gswitch *> (stmt)); case GIMPLE_RETURN: - return verify_gimple_return (stmt); + return verify_gimple_return (as_a <greturn *> (stmt)); case GIMPLE_ASM: return false; case GIMPLE_TRANSACTION: - return verify_gimple_transaction (stmt); + return verify_gimple_transaction (as_a <gtransaction *> (stmt)); /* Tuples that do not have tree operands. */ case GIMPLE_NOP: @@ -4627,7 +4650,8 @@ verify_gimple_in_seq_2 (gimple_seq stmts) switch (gimple_code (stmt)) { case GIMPLE_BIND: - err |= verify_gimple_in_seq_2 (gimple_bind_body (stmt)); + err |= verify_gimple_in_seq_2 ( + gimple_bind_body (as_a <gbind *> (stmt))); break; case GIMPLE_TRY: @@ -4640,16 +4664,20 @@ verify_gimple_in_seq_2 (gimple_seq stmts) break; case GIMPLE_EH_ELSE: - err |= verify_gimple_in_seq_2 (gimple_eh_else_n_body (stmt)); - err |= verify_gimple_in_seq_2 (gimple_eh_else_e_body (stmt)); + { + geh_else *eh_else = as_a <geh_else *> (stmt); + err |= verify_gimple_in_seq_2 (gimple_eh_else_n_body (eh_else)); + err |= verify_gimple_in_seq_2 (gimple_eh_else_e_body (eh_else)); + } break; case GIMPLE_CATCH: - err |= verify_gimple_in_seq_2 (gimple_catch_handler (stmt)); + err |= verify_gimple_in_seq_2 (gimple_catch_handler ( + as_a <gcatch *> (stmt))); break; case GIMPLE_TRANSACTION: - err |= verify_gimple_transaction (stmt); + err |= verify_gimple_transaction (as_a <gtransaction *> (stmt)); break; default: @@ -4669,7 +4697,7 @@ verify_gimple_in_seq_2 (gimple_seq stmts) is a problem, otherwise false. */ static bool -verify_gimple_transaction (gimple stmt) +verify_gimple_transaction (gtransaction *stmt) { tree lab = gimple_transaction_label (stmt); if (lab != NULL && TREE_CODE (lab) != LABEL_DECL) @@ -4872,9 +4900,11 @@ verify_gimple_in_cfg (struct function *fn, bool verify_nothrow) { gimple_stmt_iterator gsi; - for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + for (gphi_iterator gpi = gsi_start_phis (bb); + !gsi_end_p (gpi); + gsi_next (&gpi)) { - gimple phi = gsi_stmt (gsi); + gphi *phi = gpi.phi (); bool err2 = false; unsigned i; @@ -5073,7 +5103,7 @@ gimple_verify_flow_info (void) if (gimple_code (stmt) != GIMPLE_LABEL) break; - label = gimple_label_label (stmt); + label = gimple_label_label (as_a <glabel *> (stmt)); if (prev_stmt && DECL_NONLOCAL (label)) { error ("nonlocal label "); @@ -5126,10 +5156,10 @@ gimple_verify_flow_info (void) if (stmt_ends_bb_p (stmt)) found_ctrl_stmt = true; - if (gimple_code (stmt) == GIMPLE_LABEL) + if (glabel *label_stmt = dyn_cast <glabel *> (stmt)) { error ("label "); - print_generic_expr (stderr, gimple_label_label (stmt), 0); + print_generic_expr (stderr, gimple_label_label (label_stmt), 0); fprintf (stderr, " in the middle of basic block %d", bb->index); err = 1; } @@ -5239,26 +5269,27 @@ gimple_verify_flow_info (void) case GIMPLE_SWITCH: { + gswitch *switch_stmt = as_a <gswitch *> (stmt); tree prev; edge e; size_t i, n; - n = gimple_switch_num_labels (stmt); + n = gimple_switch_num_labels (switch_stmt); /* Mark all the destination basic blocks. */ for (i = 0; i < n; ++i) { - tree lab = CASE_LABEL (gimple_switch_label (stmt, i)); + tree lab = CASE_LABEL (gimple_switch_label (switch_stmt, i)); basic_block label_bb = label_to_block (lab); gcc_assert (!label_bb->aux || label_bb->aux == (void *)1); label_bb->aux = (void *)1; } /* Verify that the case labels are sorted. */ - prev = gimple_switch_label (stmt, 0); + prev = gimple_switch_label (switch_stmt, 0); for (i = 1; i < n; ++i) { - tree c = gimple_switch_label (stmt, i); + tree c = gimple_switch_label (switch_stmt, i); if (!CASE_LOW (c)) { error ("found default case not at the start of " @@ -5304,7 +5335,7 @@ gimple_verify_flow_info (void) /* Check that we have all of them. */ for (i = 0; i < n; ++i) { - tree lab = CASE_LABEL (gimple_switch_label (stmt, i)); + tree lab = CASE_LABEL (gimple_switch_label (switch_stmt, i)); basic_block label_bb = label_to_block (lab); if (label_bb->aux != (void *)2) @@ -5320,7 +5351,7 @@ gimple_verify_flow_info (void) break; case GIMPLE_EH_DISPATCH: - err |= verify_eh_dispatch_edge (stmt); + err |= verify_eh_dispatch_edge (as_a <geh_dispatch *> (stmt)); break; default: @@ -5345,7 +5376,7 @@ gimple_make_forwarder_block (edge fallthru) edge_iterator ei; basic_block dummy, bb; tree var; - gimple_stmt_iterator gsi; + gphi_iterator gsi; dummy = fallthru->src; bb = fallthru->dest; @@ -5357,9 +5388,9 @@ gimple_make_forwarder_block (edge fallthru) start of BB. */ for (gsi = gsi_start_phis (dummy); !gsi_end_p (gsi); gsi_next (&gsi)) { - gimple phi, new_phi; + gphi *phi, *new_phi; - phi = gsi_stmt (gsi); + phi = gsi.phi (); var = gimple_phi_result (phi); new_phi = create_phi_node (var, bb); gimple_phi_set_result (phi, copy_ssa_name (var, phi)); @@ -5387,12 +5418,12 @@ gimple_block_label (basic_block bb) gimple_stmt_iterator i, s = gsi_start_bb (bb); bool first = true; tree label; - gimple stmt; + glabel *stmt; for (i = s; !gsi_end_p (i); first = false, gsi_next (&i)) { - stmt = gsi_stmt (i); - if (gimple_code (stmt) != GIMPLE_LABEL) + stmt = dyn_cast <glabel *> (gsi_stmt (i)); + if (!stmt) break; label = gimple_label_label (stmt); if (!DECL_NONLOCAL (label)) @@ -5492,8 +5523,9 @@ gimple_redirect_edge_and_branch (edge e, basic_block dest) case GIMPLE_SWITCH: { + gswitch *switch_stmt = as_a <gswitch *> (stmt); tree label = gimple_block_label (dest); - tree cases = get_cases_for_edge (e, stmt); + tree cases = get_cases_for_edge (e, switch_stmt); /* If we have a list of cases associated with E, then use it as it's a lot faster than walking the entire case vector. */ @@ -5514,7 +5546,7 @@ gimple_redirect_edge_and_branch (edge e, basic_block dest) to move all the cases associated with E to E2. */ if (e2) { - tree cases2 = get_cases_for_edge (e2, stmt); + tree cases2 = get_cases_for_edge (e2, switch_stmt); CASE_CHAIN (last) = CASE_CHAIN (cases2); CASE_CHAIN (cases2) = first; @@ -5523,11 +5555,11 @@ gimple_redirect_edge_and_branch (edge e, basic_block dest) } else { - size_t i, n = gimple_switch_num_labels (stmt); + size_t i, n = gimple_switch_num_labels (switch_stmt); for (i = 0; i < n; i++) { - tree elt = gimple_switch_label (stmt, i); + tree elt = gimple_switch_label (switch_stmt, i); if (label_to_block (CASE_LABEL (elt)) == e->dest) CASE_LABEL (elt) = label; } @@ -5537,12 +5569,13 @@ gimple_redirect_edge_and_branch (edge e, basic_block dest) case GIMPLE_ASM: { - int i, n = gimple_asm_nlabels (stmt); + gasm *asm_stmt = as_a <gasm *> (stmt); + int i, n = gimple_asm_nlabels (asm_stmt); tree label = NULL; for (i = 0; i < n; ++i) { - tree cons = gimple_asm_label_op (stmt, i); + tree cons = gimple_asm_label_op (asm_stmt, i); if (label_to_block (TREE_VALUE (cons)) == e->dest) { if (!label) @@ -5572,14 +5605,15 @@ gimple_redirect_edge_and_branch (edge e, basic_block dest) case GIMPLE_EH_DISPATCH: if (!(e->flags & EDGE_FALLTHRU)) - redirect_eh_dispatch_edge (stmt, e, dest); + redirect_eh_dispatch_edge (as_a <geh_dispatch *> (stmt), e, dest); break; case GIMPLE_TRANSACTION: /* The ABORT edge has a stored label associated with it, otherwise the edges are simply redirectable. */ if (e->flags == 0) - gimple_transaction_set_label (stmt, gimple_block_label (dest)); + gimple_transaction_set_label (as_a <gtransaction *> (stmt), + gimple_block_label (dest)); break; default: @@ -5748,17 +5782,18 @@ static basic_block gimple_duplicate_bb (basic_block bb) { basic_block new_bb; - gimple_stmt_iterator gsi, gsi_tgt; - gimple_seq phis = phi_nodes (bb); - gimple phi, stmt, copy; + gimple_stmt_iterator gsi_tgt; new_bb = create_empty_bb (EXIT_BLOCK_PTR_FOR_FN (cfun)->prev_bb); /* Copy the PHI nodes. We ignore PHI node arguments here because the incoming edges have not been setup yet. */ - for (gsi = gsi_start (phis); !gsi_end_p (gsi); gsi_next (&gsi)) + for (gphi_iterator gpi = gsi_start_phis (bb); + !gsi_end_p (gpi); + gsi_next (&gpi)) { - phi = gsi_stmt (gsi); + gphi *phi, *copy; + phi = gpi.phi (); copy = create_phi_node (NULL_TREE, new_bb); create_new_def_for (gimple_phi_result (phi), copy, gimple_phi_result_ptr (copy)); @@ -5766,11 +5801,14 @@ gimple_duplicate_bb (basic_block bb) } gsi_tgt = gsi_start_bb (new_bb); - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + for (gimple_stmt_iterator gsi = gsi_start_bb (bb); + !gsi_end_p (gsi); + gsi_next (&gsi)) { def_operand_p def_p; ssa_op_iter op_iter; tree lhs; + gimple stmt, copy; stmt = gsi_stmt (gsi); if (gimple_code (stmt) == GIMPLE_LABEL) @@ -5825,9 +5863,9 @@ add_phi_args_after_copy_edge (edge e_copy) basic_block bb, bb_copy = e_copy->src, dest; edge e; edge_iterator ei; - gimple phi, phi_copy; + gphi *phi, *phi_copy; tree def; - gimple_stmt_iterator psi, psi_copy; + gphi_iterator psi, psi_copy; if (gimple_seq_empty_p (phi_nodes (e_copy->dest))) return; @@ -5860,8 +5898,8 @@ add_phi_args_after_copy_edge (edge e_copy) !gsi_end_p (psi); gsi_next (&psi), gsi_next (&psi_copy)) { - phi = gsi_stmt (psi); - phi_copy = gsi_stmt (psi_copy); + phi = psi.phi (); + phi_copy = psi_copy.phi (); def = PHI_ARG_DEF_FROM_EDGE (phi, e); add_phi_arg (phi_copy, def, e_copy, gimple_phi_arg_location_from_edge (phi, e)); @@ -6123,8 +6161,8 @@ gimple_duplicate_sese_tail (edge entry ATTRIBUTE_UNUSED, edge exit ATTRIBUTE_UNU gimple cond_stmt; edge sorig, snew; basic_block exit_bb; - gimple_stmt_iterator psi; - gimple phi; + gphi_iterator psi; + gphi *phi; tree def; struct loop *target, *aloop, *cloop; @@ -6244,7 +6282,7 @@ gimple_duplicate_sese_tail (edge entry ATTRIBUTE_UNUSED, edge exit ATTRIBUTE_UNU !gsi_end_p (psi); gsi_next (&psi)) { - phi = gsi_stmt (psi); + phi = psi.phi (); def = PHI_ARG_DEF (phi, nexits[0]->dest_idx); add_phi_arg (phi, def, e, gimple_phi_arg_location_from_edge (phi, e)); } @@ -6517,17 +6555,19 @@ move_stmt_r (gimple_stmt_iterator *gsi_p, bool *handled_ops_p, case GIMPLE_RESX: { - int r = gimple_resx_region (stmt); + gresx *resx_stmt = as_a <gresx *> (stmt); + int r = gimple_resx_region (resx_stmt); r = move_stmt_eh_region_nr (r, p); - gimple_resx_set_region (stmt, r); + gimple_resx_set_region (resx_stmt, r); } break; case GIMPLE_EH_DISPATCH: { - int r = gimple_eh_dispatch_region (stmt); + geh_dispatch *eh_dispatch_stmt = as_a <geh_dispatch *> (stmt); + int r = gimple_eh_dispatch_region (eh_dispatch_stmt); r = move_stmt_eh_region_nr (r, p); - gimple_eh_dispatch_set_region (stmt, r); + gimple_eh_dispatch_set_region (eh_dispatch_stmt, r); } break; @@ -6619,9 +6659,10 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb, (*cfg->x_basic_block_info)[bb->index] = bb; /* Remap the variables in phi nodes. */ - for (si = gsi_start_phis (bb); !gsi_end_p (si); ) + for (gphi_iterator psi = gsi_start_phis (bb); + !gsi_end_p (psi); ) { - gimple phi = gsi_stmt (si); + gphi *phi = psi.phi (); use_operand_p use; tree op = PHI_RESULT (phi); ssa_op_iter oi; @@ -6631,7 +6672,7 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb, { /* Remove the phi nodes for virtual operands (alias analysis will be run for the new function, anyway). */ - remove_phi_node (&si, true); + remove_phi_node (&psi, true); continue; } @@ -6661,7 +6702,7 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb, } } - gsi_next (&si); + gsi_next (&psi); } for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si)) @@ -6673,9 +6714,9 @@ move_block_to_fn (struct function *dest_cfun, basic_block bb, wi.info = d; walk_gimple_stmt (&si, move_stmt_r, move_stmt_op, &wi); - if (gimple_code (stmt) == GIMPLE_LABEL) + if (glabel *label_stmt = dyn_cast <glabel *> (stmt)) { - tree label = gimple_label_label (stmt); + tree label = gimple_label_label (label_stmt); int uid = LABEL_DECL_UID (label); gcc_assert (uid > -1); @@ -7569,9 +7610,9 @@ need_fake_edge_p (gimple t) return true; } - if (gimple_code (t) == GIMPLE_ASM - && (gimple_asm_volatile_p (t) || gimple_asm_input_p (t))) - return true; + if (gasm *asm_stmt = dyn_cast <gasm *> (t)) + if (gimple_asm_volatile_p (asm_stmt) || gimple_asm_input_p (asm_stmt)) + return true; return false; } @@ -7969,8 +8010,8 @@ static void gimple_lv_adjust_loop_header_phi (basic_block first, basic_block second, basic_block new_head, edge e) { - gimple phi1, phi2; - gimple_stmt_iterator psi1, psi2; + gphi *phi1, *phi2; + gphi_iterator psi1, psi2; tree def; edge e2 = find_edge (new_head, second); @@ -7986,8 +8027,8 @@ gimple_lv_adjust_loop_header_phi (basic_block first, basic_block second, !gsi_end_p (psi2) && !gsi_end_p (psi1); gsi_next (&psi2), gsi_next (&psi1)) { - phi1 = gsi_stmt (psi1); - phi2 = gsi_stmt (psi2); + phi1 = psi1.phi (); + phi2 = psi2.phi (); def = PHI_ARG_DEF (phi2, e2->dest_idx); add_phi_arg (phi1, def, e, gimple_phi_arg_location_from_edge (phi2, e2)); } @@ -8353,8 +8394,9 @@ pass_warn_function_return::execute (function *fun) FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (fun)->preds) { gimple last = last_stmt (e->src); - if (gimple_code (last) == GIMPLE_RETURN - && gimple_return_retval (last) == NULL + greturn *return_stmt = dyn_cast <greturn *> (last); + if (return_stmt + && gimple_return_retval (return_stmt) == NULL && !gimple_no_warning_p (last)) { location = gimple_location (last); @@ -8394,14 +8436,15 @@ do_warn_unused_result (gimple_seq seq) switch (gimple_code (g)) { case GIMPLE_BIND: - do_warn_unused_result (gimple_bind_body (g)); + do_warn_unused_result (gimple_bind_body (as_a <gbind *>(g))); break; case GIMPLE_TRY: do_warn_unused_result (gimple_try_eval (g)); do_warn_unused_result (gimple_try_cleanup (g)); break; case GIMPLE_CATCH: - do_warn_unused_result (gimple_catch_handler (g)); + do_warn_unused_result (gimple_catch_handler ( + as_a <gcatch *> (g))); break; case GIMPLE_EH_FILTER: do_warn_unused_result (gimple_eh_filter_failure (g)); |