]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/system.h
Convert gimple types from a union to C++ inheritance
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 19 Nov 2013 15:50:46 +0000 (15:50 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Tue, 19 Nov 2013 15:50:46 +0000 (15:50 +0000)
commitdaa6e488c2f9611ac88611aac6f49e4090eb4902
tree925852cc0a168d316a3da569b148e3c143e97b54
parent660dca797a8202336a5510ee27a971dda8832ba6
Convert gimple types from a union to C++ inheritance

Patch partially autogenerated by refactor_gimple.py from
https://github.com/davidmalcolm/gcc-refactoring-scripts
revision 05fc808c61bd8ddd2372f29b79ceb2491360d298

* Makefile.in (GIMPLE_H): Add dep on is-a.h.
* coretypes.h (union gimple_statement_d): Remove declaration.
(gimple): Convert from being a "union gimple_statement_d *"
to a "struct gimple_statement_base *".
(const_gimple): Likewise (with "const").
* ggc.h (ggc_alloc_cleared_gimple_statement_d_stat): Replace
with...
(ggc_alloc_cleared_gimple_statement_stat): ...this.
* gimple-pretty-print.c (debug): Change parameter from a
"gimple_statement_d &" to a "gimple_statement_base &".
(debug): Change parameter from a "gimple_statement_d *" to
a "gimple_statement_base *".
* gimple-pretty-print.h (debug): Update declarations as above.
* gimple.c (gimple_alloc_stat): Update for renaming of
ggc_alloc_cleared_gimple_statement_d_stat to
ggc_alloc_cleared_gimple_statement_stat.
* gimple.h: Include "is-a.h" for use by is_a_helper
specializations in followup autogenerated patch.
(struct gimple statement_base): Make this type usable as a base
class by adding "desc", "tag" and "variable_size" to GTY, thus
using opting-in to gengtype's support for simple inheritance.
(gimple_statement_with_ops_base): Convert to a subclass of
gimple_statement_base, dropping initial "gsbase" field.  Note
that this type is abstract, with no GSS_ value, and thus no GTY
tag value.
(gimple_statement_with_ops): Convert to a subclass of
gimple_statement_with_ops_base, dropping initial "opbase" field.
Add tag value to GTY marking.  Update marking of op field to
reflect how num_ops field is accessed via inheritance.
(gimple_statement_with_memory_ops_base): Convert to a subclass of
gimple_statement_with_ops_base, dropping initial "opbase" field.
Add tag value to GTY marking.
(gimple_statement_with_memory_ops): Convert to a subclass of
public gimple_statement_with_memory_ops_base, dropping initial
"membase" field.  Add tag value to GTY marking.  Update marking
of op field to reflect how num_ops field is accessed via
inheritance.
(gimple_statement_call): Analogous changes that also update the
marking of the "u" union.
(gimple_statement_omp): Convert to a subclass of
gimple_statement_base, dropping initial "gsbase" field, adding
tag value to GTY marking.
(gimple_statement_bind): Likewise.
(gimple_statement_catch): Likewise.
(gimple_statement_eh_filter): Likewise.
(gimple_statement_eh_else): Likewise.
(gimple_statement_eh_mnt): Likewise.
(gimple_statement_phi): Likewise.
(gimple_statement_eh_ctrl): Likewise.
(gimple_statement_try): Likewise.
(gimple_statement_wce): Likewise.
(gimple_statement_asm): Convert to a subclass of
gimple_statement_with_memory_ops_base, dropping initial
"membase" field, adding tag value to GTY marking, and updating
marking of op field.
(gimple_statement_omp_critical): Convert to a subclass of
gimple_statement_omp, dropping initial "omp" field, adding tag
value to GTY marking.
(gimple_statement_omp_for): Likewise.
(gimple_statement_omp_parallel): Likewise.
(gimple_statement_omp_task): Convert to a subclass of
gimple_statement_omp_parallel, dropping initial "par" field,
adding tag value to GTY marking.
(gimple_statement_omp_sections): Convert to a subclass of
gimple_statement_omp, dropping initial "omp" field, adding
tag value to GTY marking.
(gimple_statement_omp_continue): Convert to a subclass of
gimple_statement_base, dropping initial "gsbase" field, adding
tag value to GTY marking.
(gimple_statement_omp_single): Convert to a subclass of
gimple_statement_omp, dropping initial "omp" field, adding
tag value to GTY marking.
(gimple_statement_omp_atomic_load): Convert to a subclass of
gimple_statement_base, dropping initial "gsbase" field, adding
tag value to GTY marking.
(gimple_statement_omp_atomic_store): Convert to a subclass of
gimple_statement_base, dropping initial "gsbase" field, adding
tag value to GTY marking.
(gimple_statement_transaction): Convert to a subclass of
gimple_statement_with_memory_ops_base, dropping initial "gsbase"
field, adding tag value to GTY marking.
(union gimple_statement_d): Remove.
* system.h (CONST_CAST_GIMPLE): Update to use
"struct gimple_statement_base *" rather than
"union gimple_statement_d *".
* tree-ssa-ccp.c (gimple_htab): Convert underlying type from
gimple_statement_d to gimple_statement_base.

* gimple.h (gimple_use_ops): Port from union to usage of
dyn_cast.
(gimple_set_use_ops): Port from union to usage of as_a.
(gimple_set_vuse): Likewise.
(gimple_set_vdef): Likewise.
(gimple_call_internal_fn): Port from union to a static_cast,
given that the type has already been asserted.
(gimple_omp_body_ptr): Port from unchecked union usage to
a static_cast.
(gimple_omp_set_body): Likewise.

* gimple-iterator.c (update_bb_for_stmts): Update for conversion of
gimple types to a true class hierarchy.
(update_call_edge_frequencies): Likewise.
(gsi_insert_seq_nodes_before): Likewise.
(gsi_insert_seq_nodes_after): Likewise.
(gsi_split_seq_after): Likewise.
(gsi_set_stmt): Likewise.
(gsi_split_seq_before): Likewise.
(gsi_remove): Likewise.
* gimple-iterator.h (gsi_one_before_end_p): Likewise.
(gsi_next): Likewise.
(gsi_prev): Likewise.
* gimple-pretty-print.c (dump_gimple_debug): Likewise.
* gimple-ssa.h (gimple_vuse_op): Likewise.
(gimple_vdef_op): Likewise.
* gimple-streamer-in.c (input_gimple_stmt): Likewise.
* gimple-streamer-out.c (output_gimple_stmt): Likewise.
* gimple.c (gimple_set_code): Likewise.
(gimple_alloc_stat): Likewise.
(gimple_set_subcode): Likewise.
(gimple_build_call_internal_1): Likewise.
(gimple_check_failed): Likewise.
(gimple_call_flags): Likewise.
(gimple_set_bb): Likewise.
* gimple.h (is_a_helper <gimple_statement_asm> (gimple)): New.
(is_a_helper <gimple_statement_bind> (gimple)): Likewise.
(is_a_helper <gimple_statement_call> (gimple)): Likewise.
(is_a_helper <gimple_statement_catch> (gimple)): Likewise.
(is_a_helper <gimple_statement_eh_ctrl> (gimple)): Likewise.
(is_a_helper <gimple_statement_eh_else> (gimple)): Likewise.
(is_a_helper <gimple_statement_eh_filter> (gimple)): Likewise.
(is_a_helper <gimple_statement_eh_mnt> (gimple)): Likewise.
(is_a_helper <gimple_statement_omp_atomic_load> (gimple)): Likewise.
(is_a_helper <gimple_statement_omp_atomic_store> (gimple)): Likewise.
(is_a_helper <gimple_statement_omp_continue> (gimple)): Likewise.
(is_a_helper <gimple_statement_omp_critical> (gimple)): Likewise.
(is_a_helper <gimple_statement_omp_for> (gimple)): Likewise.
(is_a_helper <gimple_statement_omp_parallel> (gimple)): Likewise.
(is_a_helper <gimple_statement_omp_sections> (gimple)): Likewise.
(is_a_helper <gimple_statement_omp_single> (gimple)): Likewise.
(is_a_helper <gimple_statement_omp_task> (gimple)): Likewise.
(is_a_helper <gimple_statement_phi> (gimple)): Likewise.
(is_a_helper <gimple_statement_transaction> (gimple)): Likewise.
(is_a_helper <gimple_statement_try> (gimple)): Likewise.
(is_a_helper <gimple_statement_wce> (gimple)): Likewise.
(is_a_helper <const gimple_statement_asm> (const_gimple)): Likewise.
(is_a_helper <const gimple_statement_bind> (const_gimple)): Likewise.
(is_a_helper <const gimple_statement_call> (const_gimple)): Likewise.
(is_a_helper <const gimple_statement_catch> (const_gimple)): Likewise.
(is_a_helper <const gimple_statement_eh_ctrl> (const_gimple)):
Likewise.
(is_a_helper <const gimple_statement_eh_filter> (const_gimple)):
Likewise.
(is_a_helper <const gimple_statement_omp_atomic_load> (const_gimple)):
Likewise.
(is_a_helper <const gimple_statement_omp_atomic_store>
(const_gimple)): Likewise.
(is_a_helper <const gimple_statement_omp_continue> (const_gimple)):
Likewise.
(is_a_helper <const gimple_statement_omp_critical> (const_gimple)):
Likewise.
(is_a_helper <const gimple_statement_omp_for> (const_gimple)):
Likewise.
(is_a_helper <const gimple_statement_omp_parallel> (const_gimple)):
Likewise.
(is_a_helper <const gimple_statement_omp_sections> (const_gimple)):
Likewise.
(is_a_helper <const gimple_statement_omp_single> (const_gimple)):
Likewise.
(is_a_helper <const gimple_statement_omp_task> (const_gimple)):
Likewise.
(is_a_helper <const gimple_statement_phi> (const_gimple)): Likewise.
(is_a_helper <const gimple_statement_transaction> (const_gimple)):
Likewise.
(gimple_seq_last): Update for conversion of gimple types to a true
class hierarchy.
(gimple_seq_set_last): Likewise.
(gimple_code): Likewise.
(gimple_bb): Likewise.
(gimple_block): Likewise.
(gimple_set_block): Likewise.
(gimple_location): Likewise.
(gimple_location_ptr): Likewise.
(gimple_set_location): Likewise.
(gimple_no_warning_p): Likewise.
(gimple_set_no_warning): Likewise.
(gimple_set_visited): Likewise.
(gimple_visited_p): Likewise.
(gimple_set_plf): Likewise.
(gimple_plf): Likewise.
(gimple_set_uid): Likewise.
(gimple_uid): Likewise.
(gimple_init_singleton): Likewise.
(gimple_modified_p): Likewise.
(gimple_set_modified): Likewise.
(gimple_expr_code): Likewise.
(gimple_has_volatile_ops): Likewise.
(gimple_set_has_volatile_ops): Likewise.
(gimple_omp_subcode): Likewise.
(gimple_omp_set_subcode): Likewise.
(gimple_omp_return_set_nowait): Likewise.
(gimple_omp_section_set_last): Likewise.
(gimple_omp_parallel_set_combined_p): Likewise.
(gimple_omp_atomic_set_need_value): Likewise.
(gimple_omp_atomic_set_seq_cst): Likewise.
(gimple_num_ops): Likewise.
(gimple_set_num_ops): Likewise.
(gimple_assign_nontemporal_move_p): Likewise.
(gimple_assign_set_nontemporal_move): Likewise.
(gimple_assign_rhs_code): Likewise.
(gimple_assign_set_rhs_code): Likewise.
(gimple_call_internal_p): Likewise.
(gimple_call_with_bounds_p): Likewise.
(gimple_call_set_with_bounds): 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_set_alloca_for_var): Likewise.
(gimple_call_alloca_for_var_p): Likewise.
(gimple_call_copy_flags): Likewise.
(gimple_cond_code): Likewise.
(gimple_cond_set_code): Likewise.
(gimple_cond_make_false): Likewise.
(gimple_cond_make_true): Likewise.
(gimple_asm_volatile_p): Likewise.
(gimple_asm_set_volatile): Likewise.
(gimple_asm_set_input): Likewise.
(gimple_asm_input_p): Likewise.
(gimple_try_kind): Likewise.
(gimple_try_set_kind): Likewise.
(gimple_try_catch_is_cleanup): Likewise.
(gimple_try_set_catch_is_cleanup): Likewise.
(gimple_wce_cleanup_eh_only): Likewise.
(gimple_wce_set_cleanup_eh_only): Likewise.
(gimple_debug_bind_p): Likewise.
(gimple_debug_source_bind_p): Likewise.
(gimple_omp_for_set_kind): Likewise.
(gimple_omp_for_set_combined_p): Likewise.
(gimple_omp_for_set_combined_into_p): Likewise.
(gimple_omp_target_set_kind): Likewise.
(gimple_transaction_subcode): Likewise.
(gimple_transaction_set_subcode): Likewise.
(gimple_predict_predictor): Likewise.
(gimple_predict_set_predictor): Likewise.
(gimple_predict_outcome): Likewise.
(gimple_predict_set_outcome): Likewise.
(gimple_transaction_set_label): Likewise.
(gimple_transaction_set_body): Likewise.
(gimple_transaction_label_ptr): Likewise.
(gimple_transaction_label): Likewise.
(gimple_transaction_body_ptr): Likewise.
(gimple_omp_continue_set_control_use): Likewise.
(gimple_omp_continue_control_use_ptr): Likewise.
(gimple_omp_continue_control_use): Likewise.
(gimple_omp_continue_set_control_def): Likewise.
(gimple_omp_continue_control_def_ptr): Likewise.
(gimple_omp_continue_control_def): Likewise.
(gimple_omp_atomic_load_rhs_ptr): Likewise.
(gimple_omp_atomic_load_rhs): Likewise.
(gimple_omp_atomic_load_set_rhs): Likewise.
(gimple_omp_atomic_load_lhs_ptr): Likewise.
(gimple_omp_atomic_load_lhs): Likewise.
(gimple_omp_atomic_load_set_lhs): Likewise.
(gimple_omp_atomic_store_val_ptr): Likewise.
(gimple_omp_atomic_store_val): Likewise.
(gimple_omp_atomic_store_set_val): Likewise.
(gimple_omp_for_cond): Likewise.
(gimple_omp_for_set_cond): Likewise.
(gimple_omp_sections_set_control): Likewise.
(gimple_omp_sections_control_ptr): Likewise.
(gimple_omp_sections_control): Likewise.
(gimple_omp_sections_set_clauses): Likewise.
(gimple_omp_sections_clauses_ptr): Likewise.
(gimple_omp_sections_clauses): Likewise.
(gimple_omp_teams_set_clauses): Likewise.
(gimple_omp_teams_clauses_ptr): Likewise.
(gimple_omp_teams_clauses): Likewise.
(gimple_omp_target_set_data_arg): Likewise.
(gimple_omp_target_data_arg_ptr): Likewise.
(gimple_omp_target_data_arg): Likewise.
(gimple_omp_target_set_child_fn): Likewise.
(gimple_omp_target_child_fn_ptr): Likewise.
(gimple_omp_target_child_fn): Likewise.
(gimple_omp_target_set_clauses): Likewise.
(gimple_omp_target_clauses_ptr): Likewise.
(gimple_omp_target_clauses): Likewise.
(gimple_omp_single_set_clauses): Likewise.
(gimple_omp_single_clauses_ptr): Likewise.
(gimple_omp_single_clauses): Likewise.
(gimple_omp_task_set_arg_align): Likewise.
(gimple_omp_task_arg_align_ptr): Likewise.
(gimple_omp_task_arg_align): Likewise.
(gimple_omp_task_set_arg_size): Likewise.
(gimple_omp_task_arg_size_ptr): Likewise.
(gimple_omp_task_arg_size): Likewise.
(gimple_omp_task_set_copy_fn): Likewise.
(gimple_omp_task_copy_fn_ptr): Likewise.
(gimple_omp_task_copy_fn): Likewise.
(gimple_omp_task_set_data_arg): Likewise.
(gimple_omp_task_data_arg_ptr): Likewise.
(gimple_omp_task_data_arg): Likewise.
(gimple_omp_task_set_child_fn): Likewise.
(gimple_omp_task_child_fn_ptr): Likewise.
(gimple_omp_task_child_fn): Likewise.
(gimple_omp_task_set_clauses): Likewise.
(gimple_omp_task_clauses_ptr): Likewise.
(gimple_omp_task_clauses): Likewise.
(gimple_omp_parallel_set_data_arg): Likewise.
(gimple_omp_parallel_data_arg_ptr): Likewise.
(gimple_omp_parallel_data_arg): Likewise.
(gimple_omp_parallel_set_child_fn): Likewise.
(gimple_omp_parallel_child_fn_ptr): Likewise.
(gimple_omp_parallel_child_fn): Likewise.
(gimple_omp_parallel_set_clauses): Likewise.
(gimple_omp_parallel_clauses_ptr): Likewise.
(gimple_omp_parallel_clauses): Likewise.
(gimple_omp_for_set_pre_body): Likewise.
(gimple_omp_for_pre_body_ptr): Likewise.
(gimple_omp_for_set_incr): Likewise.
(gimple_omp_for_incr_ptr): Likewise.
(gimple_omp_for_incr): Likewise.
(gimple_omp_for_set_final): Likewise.
(gimple_omp_for_final_ptr): Likewise.
(gimple_omp_for_final): Likewise.
(gimple_omp_for_set_initial): Likewise.
(gimple_omp_for_initial_ptr): Likewise.
(gimple_omp_for_initial): Likewise.
(gimple_omp_for_set_index): Likewise.
(gimple_omp_for_index_ptr): Likewise.
(gimple_omp_for_index): Likewise.
(gimple_omp_for_collapse): Likewise.
(gimple_omp_for_set_clauses): Likewise.
(gimple_omp_for_clauses_ptr): Likewise.
(gimple_omp_for_clauses): Likewise.
(gimple_omp_critical_set_name): Likewise.
(gimple_omp_critical_name_ptr): Likewise.
(gimple_omp_critical_name): Likewise.
(gimple_eh_dispatch_set_region): Likewise.
(gimple_eh_dispatch_region): Likewise.
(gimple_resx_set_region): Likewise.
(gimple_resx_region): Likewise.
(gimple_phi_set_arg): Likewise.
(gimple_phi_arg): Likewise.
(gimple_phi_set_result): Likewise.
(gimple_phi_result_ptr): Likewise.
(gimple_phi_result): Likewise.
(gimple_phi_num_args): Likewise.
(gimple_phi_capacity): Likewise.
(gimple_wce_set_cleanup): Likewise.
(gimple_wce_cleanup_ptr): Likewise.
(gimple_try_set_cleanup): Likewise.
(gimple_try_set_eval): Likewise.
(gimple_try_cleanup_ptr): Likewise.
(gimple_try_eval_ptr): Likewise.
(gimple_eh_else_set_e_body): Likewise.
(gimple_eh_else_set_n_body): Likewise.
(gimple_eh_else_e_body_ptr): Likewise.
(gimple_eh_else_n_body_ptr): Likewise.
(gimple_eh_must_not_throw_set_fndecl): Likewise.
(gimple_eh_must_not_throw_fndecl): Likewise.
(gimple_eh_filter_set_failure): Likewise.
(gimple_eh_filter_set_types): Likewise.
(gimple_eh_filter_failure_ptr): Likewise.
(gimple_eh_filter_types_ptr): Likewise.
(gimple_eh_filter_types): Likewise.
(gimple_catch_set_handler): Likewise.
(gimple_catch_set_types): Likewise.
(gimple_catch_handler_ptr): Likewise.
(gimple_catch_types_ptr): Likewise.
(gimple_catch_types): Likewise.
(gimple_asm_string): Likewise.
(gimple_asm_set_label_op): Likewise.
(gimple_asm_label_op): Likewise.
(gimple_asm_set_clobber_op): Likewise.
(gimple_asm_clobber_op): Likewise.
(gimple_asm_set_output_op): Likewise.
(gimple_asm_output_op_ptr): Likewise.
(gimple_asm_output_op): Likewise.
(gimple_asm_set_input_op): Likewise.
(gimple_asm_input_op_ptr): Likewise.
(gimple_asm_input_op): Likewise.
(gimple_asm_nlabels): Likewise.
(gimple_asm_nclobbers): Likewise.
(gimple_asm_noutputs): Likewise.
(gimple_asm_ninputs): Likewise.
(gimple_bind_set_block): Likewise.
(gimple_bind_block): Likewise.
(gimple_bind_add_seq): Likewise.
(gimple_bind_add_stmt): Likewise.
(gimple_bind_set_body): Likewise.
(gimple_bind_body_ptr): Likewise.
(gimple_bind_append_vars): Likewise.
(gimple_bind_set_vars): Likewise.
(gimple_bind_vars): Likewise.
(gimple_call_clobber_set): Likewise.
(gimple_call_use_set): Likewise.
(gimple_call_set_internal_fn): Likewise.
(gimple_call_set_fntype): Likewise.
(gimple_call_fntype): Likewise.
(gimple_omp_return_lhs_ptr): Likewise.
(gimple_omp_return_lhs): Likewise.
(gimple_omp_return_set_lhs): Likewise.
(gimple_omp_taskreg_set_data_arg): Likewise.
(gimple_omp_taskreg_data_arg_ptr): Likewise.
(gimple_omp_taskreg_data_arg): Likewise.
(gimple_omp_taskreg_set_child_fn): Likewise.
(gimple_omp_taskreg_child_fn_ptr): Likewise.
(gimple_omp_taskreg_child_fn): Likewise.
(gimple_omp_taskreg_set_clauses): Likewise.
(gimple_omp_taskreg_clauses_ptr): Likewise.
(gimple_omp_taskreg_clauses): Likewise.
(gimple_vuse): Likewise.
(gimple_vdef): Likewise.
(gimple_vuse_ptr): Likewise.
(gimple_vdef_ptr): Likewise.
* tree-inline.c (copy_debug_stmt): Likewise.
* tree-phinodes.c (make_phi_node): Likewise.

* gimple.h (is_a_helper <const gimple_statement_with_ops>::test): New.
(is_a_helper <gimple_statement_with_ops>::test): New.
(is_a_helper <const gimple_statement_with_memory_ops>::test): New.
(is_a_helper <gimple_statement_with_memory_ops>::test): New.

* gimple-streamer-in.c (input_gimple_stmt): Port from union
access to use of as_a.
* gimple.c (gimple_build_asm_1): Likewise.
(gimple_build_try): Likewise.  Also, return a specific subclass
rather than just gimple.
(gimple_build_resx): Port from union access to use of as_a.
(gimple_build_eh_dispatch): Likewise.
(gimple_build_omp_for): Likewise.  Also, convert allocation of iter
now that gengtype no longer provides a typed allocator function.
(gimple_copy): Likewise.
* gimple.h (gimple_build_try): Return a specific subclass rather
than just gimple.
* gimplify.c (gimplify_cleanup_point_expr): Replace union access
with subclass access by making use of new return type of
gimple_build_try.
* tree-phinodes.c: (allocate_phi_node): Return a
"gimple_statement_phi *" rather than just a gimple.
(resize_phi_node): Likewise.
(make_phi_node): Replace union access with subclass access by
making use of new return type of allocate_phi_node.
(reserve_phi_args_for_new_edge): Replace union access with as_a.
(remove_phi_arg_num): Accept a "gimple_statement_phi *" rather
than just a gimple.
(remove_phi_args): Update for change to remove_phi_arg_num.

* gdbhooks.py (GimplePrinter.to_string): Update lookup of
code field to reflect inheritance, rather than embedding of
the base gimple type.

From-SVN: r205034
19 files changed:
gcc/ChangeLog
gcc/Makefile.in
gcc/coretypes.h
gcc/gdbhooks.py
gcc/ggc.h
gcc/gimple-iterator.c
gcc/gimple-iterator.h
gcc/gimple-pretty-print.c
gcc/gimple-pretty-print.h
gcc/gimple-ssa.h
gcc/gimple-streamer-in.c
gcc/gimple-streamer-out.c
gcc/gimple.c
gcc/gimple.h
gcc/gimplify.c
gcc/system.h
gcc/tree-inline.c
gcc/tree-phinodes.c
gcc/tree-ssa-ccp.c