From 1e128c5f7b58721f49ba367788e518355747dc04 Mon Sep 17 00:00:00 2001 From: Giovanni Bajo Date: Thu, 9 Sep 2004 07:54:12 +0000 Subject: [PATCH] targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell From-SVN: r87223 --- gcc/ChangeLog | 145 ++++++++++++++++++++++++ gcc/Makefile.in | 2 +- gcc/targhooks.c | 4 +- gcc/timevar.c | 18 +-- gcc/toplev.c | 2 +- gcc/tracer.c | 3 +- gcc/tree-alias-common.c | 81 +++++--------- gcc/tree-cfg.c | 121 +++++++------------- gcc/tree-chrec.c | 35 +++--- gcc/tree-complex.c | 19 ++-- gcc/tree-data-ref.c | 36 +++--- gcc/tree-dfa.c | 46 ++------ gcc/tree-dump.c | 4 +- gcc/tree-eh.c | 91 ++++++++------- gcc/tree-flow-inline.h | 76 ++++--------- gcc/tree-if-conv.c | 45 +++----- gcc/tree-inline.c | 66 ++++------- gcc/tree-into-ssa.c | 19 +--- gcc/tree-iterator.c | 36 ++---- gcc/tree-mudflap.c | 3 +- gcc/tree-nested.c | 22 +--- gcc/tree-optimize.c | 3 +- gcc/tree-outof-ssa.c | 122 +++++++++----------- gcc/tree-phinodes.c | 16 +-- gcc/tree-pretty-print.c | 6 +- gcc/tree-profile.c | 20 +++- gcc/tree-sra.c | 43 +++---- gcc/tree-ssa-alias.c | 218 +++++++++++++++++------------------- gcc/tree-ssa-ccp.c | 61 ++++------ gcc/tree-ssa-copy.c | 36 +++--- gcc/tree-ssa-copyrename.c | 12 +- gcc/tree-ssa-dce.c | 50 +++------ gcc/tree-ssa-dom.c | 46 +++----- gcc/tree-ssa-dse.c | 6 +- gcc/tree-ssa-live.c | 54 ++++----- gcc/tree-ssa-live.h | 46 ++------ gcc/tree-ssa-loop-ch.c | 6 +- gcc/tree-ssa-loop-im.c | 13 +-- gcc/tree-ssa-loop-ivopts.c | 84 +++++++------- gcc/tree-ssa-loop-manip.c | 8 +- gcc/tree-ssa-operands.c | 54 +++------ gcc/tree-ssa-pre.c | 65 ++++------- gcc/tree-ssa-propagate.c | 6 +- gcc/tree-ssa-threadupdate.c | 7 +- gcc/tree-ssa.c | 8 +- gcc/tree-ssanames.c | 14 +-- gcc/tree-tailcall.c | 12 +- gcc/tree-vectorizer.c | 122 +++++++------------- gcc/tree-vn.c | 24 ++-- gcc/tree.c | 143 ++++++++++------------- 50 files changed, 920 insertions(+), 1259 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e5160856792..b6050b30373 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,148 @@ +2004-09-09 Giovanni Bajo + Nathan Sidwell + + * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): + Use gcc_assert, gcc_unreachable & internal_error instead of abort. + * timevar.c (timevar_push, timevar_pop, timevar_start, + timevar_stop): Likewise. + * toplev.c (default_pch_valid_p): Likewise. + * tracer.c (tail_duplicate): Likewise. + * tree-alias-common.c (get_alias_var_decl, + get_values_from_constructor, create_alias_var, delete_alias_vars, + empty_points_to_set, same_points_to_set, ptr_may_alias_var): + Likewise. + * tree.c (tree_size, make_node_stat, copy_node_stat, + build_int_cst_wide, integer_all_onesp, list_length, chainon, + tree_node_structure, type_contains_placeholder_p, substitute_in_expr, + substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, + build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, + lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, + build_method_type_directly, decl_type_context, get_callee_fndecl, + get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, + tree_fold_gcd): Likewise. + * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, + make_cond_expr_edges, group_case_labels, tree_merge_blocks, + cleanup_control_expr_graph, find_taken_edge, + find_taken_edge_switch_expr, phi_alternatives_equal, + is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, + stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, + tree_split_edge, tree_verify_flow_info, thread_jumps, + tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. + * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, + chrec_fold_multiply_poly_poly): Likewise. + * tree-complex.c (extract_component, expand_complex_division, + expand_complex_comparison, expand_complex_operations_1, + build_replicated_const, expand_vector_operations_1): Likewise. + * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, + build_classic_dir_vector): Likewise. + * tree-dfa.c (compute_immediate_uses_for_phi, + compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, + create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. + * tree-dump.c (dequeue_and_dump): Likewise. + * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, + record_in_finally_tree, replace_goto_queue_1, + maybe_record_in_goto_queue, verify_norecord_switch_expr, + do_return_redirection): Likewise. + * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, + add_to_dst_predicate_list, find_phi_replacement_condition, + replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): + Likewise. + * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, + initialize_inlined_parameters, declare_return_variable, + estimate_num_insns_1, expand_call_inline, expand_calls_inline, + optimize_inline_calls, copy_tree_r): Likewise. + * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, + ssa_rewrite_stmt, rewrite_into_ssa): Likewise. + * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, + tsi_split_statement_list_after, tsi_split_statement_list_before): + Likewise. + * tree-mudflap.c (mf_varname_tree): Likewise. + * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, + lookup_tramp_for_decl, convert_all_function_calls): Likewise. + * tree-optimize.c (tree_rest_of_compilation): Likewise. + * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, + coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, + free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): + Likewise. + * tree-phinodes.c (resize_phi_node, add_phi_arg, + remove_all_phi_nodes_for): Likewise. + * tree-pretty-print.c (op_prio, print_call_name): Likewise. + * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, + tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. + * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, + sra_elt_eq, sra_walk_expr, instantiate_missing_elements, + generate_one_element_ref, generate_element_copy, + generate_element_zero, scalarize_copy, scalarize_init, + scalarize_ldst): Likewise. + * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, + add_may_alias, add_pointed_to_expr, add_pointed_to_var, + collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. + * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. + * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, + set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, + widen_bitfield, ccp_fold_builtin): Likewise. + * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, + replace_exp_1, propagate_tree_value): Likewise. + * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. + * tree-ssa-dce.c (set_control_dependence_map_bit, + find_control_dependence, find_pdom, mark_operand_necessary, + mark_stmt_if_obviously_necessary, + mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. + * tree-ssa-dom.c (dom_opt_initialize_block_local_data, + simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, + eliminate_redundant_computations, avail_expr_eq): Likewise. + * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. + * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, + duplicate_blocks): Likewise. + * tree-ssa-loop-im.c (for_each_index, set_level, + is_call_clobbered_ref): Likewise. + * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, + stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, + find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, + peel_address, ptr_difference_cost, may_replace_final_value, + determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, + rewrite_use, rewrite_uses): Likewise. + * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, + check_loop_closed_ssa_use): Likewise. + * tree-ssanames.c (make_ssa_name): Likewise. + * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, + finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, + get_stmt_operands, get_expr_operands, get_asm_expr_operands, + get_indirect_ref_operands, add_stmt_operand): Likewise. + * tree-ssa-pre.c (value_exists_in_set_bitmap, + value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, + phi_translate, valid_in_set, compute_antic, + find_or_generate_expression, create_expression_by_pieces, insert_aux, + create_value_expr_from, eliminate): Likewise. + * tree-ssa-propagate.c (cfg_blocks_get): Likewise. + * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): + Likewise. + * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, + eliminate_tail_call): Likewise. + * tree-vectorizer.c (vect_create_index_for_array_ref, + vect_align_data_ref, vect_create_data_ref, + vect_create_destination_var, vect_get_vec_def_for_operand, + vect_finish_stmt_generation, vect_transform_stmt, + vect_transform_loop_bound, vect_transform_loop, + vect_analyze_operations): Likewise. + * tree-vn.c (vn_compute, set_value_handle, get_value_handle): + Likewise. + * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, + get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, + bsi_after_labels, bsi_last): Likewise. + * tree-ssa-live.c (var_union, change_partition_var, + create_ssa_var_map, calculate_live_on_entry, root_var_init, + type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): + Likewise. + * tree-ssa-live.h (partition_is_global, live_entry_blocks, + tpa_find_tree): Likewise. + (register_ssa_partition_check): Declare. + (register_ssa_partition): use it. + * tree-ssa-live.c: Include errors.h. + (register_ssa_partition_check): New. + * tree-ssa-operands.c: Include errors.h. + * Makefile.in (tree-ssa-operands.o): Depend on errors.h. + 2004-09-09 Richard Sandiford Catherine Moore diff --git a/gcc/Makefile.in b/gcc/Makefile.in index e76aa11c2f7..995952ade96 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1700,7 +1700,7 @@ tree-dfa.o : tree-dfa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ tree-alias-common.h convert.h $(TM_H) coretypes.h langhooks.h \ $(TREE_DUMP_H) tree-pass.h params.h tree-ssa-operands.o : tree-ssa-operands.c $(TREE_FLOW_H) $(CONFIG_H) \ - $(SYSTEM_H) $(TREE_H) $(TM_P_H) $(GGC_H) diagnostic.h \ + $(SYSTEM_H) $(TREE_H) $(TM_P_H) $(GGC_H) diagnostic.h errors.h \ tree-inline.h $(FLAGS_H) function.h $(TM_H) $(TIMEVAR_H) tree-pass.h tree-eh.o : tree-eh.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \ $(RTL_H) $(TREE_H) $(TM_H) $(FLAGS_H) function.h except.h langhooks.h \ diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 042c83efb4c..95a4909d43b 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -213,7 +213,7 @@ default_unwind_emit (FILE * stream ATTRIBUTE_UNUSED, rtx insn ATTRIBUTE_UNUSED) { /* Should never happen. */ - abort (); + gcc_unreachable (); } /* True if MODE is valid for the target. By "valid", we mean able to @@ -258,7 +258,7 @@ default_scalar_mode_supported_p (enum machine_mode mode) return false; default: - abort (); + gcc_unreachable (); } } diff --git a/gcc/timevar.c b/gcc/timevar.c index 1b5d2443c19..65323eb4e66 100644 --- a/gcc/timevar.c +++ b/gcc/timevar.c @@ -263,8 +263,7 @@ timevar_push (timevar_id_t timevar) tv->used = 1; /* Can't push a standalone timer. */ - if (tv->standalone) - abort (); + gcc_assert (!tv->standalone); /* What time is it? */ get_time (&now); @@ -309,13 +308,8 @@ timevar_pop (timevar_id_t timevar) if (!timevar_enable) return; - if (&timevars[timevar] != stack->timevar) - { - sorry ("cannot timevar_pop '%s' when top of timevars stack is '%s'", - timevars[timevar].name, stack->timevar->name); - abort (); - } - + gcc_assert (&timevars[timevar] == stack->timevar); + /* What time is it? */ get_time (&now); @@ -352,8 +346,7 @@ timevar_start (timevar_id_t timevar) /* Don't allow the same timing variable to be started more than once. */ - if (tv->standalone) - abort (); + gcc_assert (!tv->standalone); tv->standalone = 1; get_time (&tv->start_time); @@ -372,8 +365,7 @@ timevar_stop (timevar_id_t timevar) return; /* TIMEVAR must have been started via timevar_start. */ - if (!tv->standalone) - abort (); + gcc_assert (tv->standalone); get_time (&now); timevar_accumulate (&tv->elapsed, &tv->start_time, &now); diff --git a/gcc/toplev.c b/gcc/toplev.c index d83d6c5fe90..b0a297b991f 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1502,7 +1502,7 @@ default_pch_valid_p (const void *data_p, size_t len) goto make_message; } } - abort (); + gcc_unreachable (); } data += sizeof (target_flags); len -= sizeof (target_flags); diff --git a/gcc/tracer.c b/gcc/tracer.c index dd263c4fdfd..4fcedca153a 100644 --- a/gcc/tracer.c +++ b/gcc/tracer.c @@ -247,8 +247,7 @@ tail_duplicate (void) if (ignore_bb_p (bb)) continue; - if (seen (bb)) - abort (); + gcc_assert (!seen (bb)); n = find_trace (bb, trace); diff --git a/gcc/tree-alias-common.c b/gcc/tree-alias-common.c index fa47ce6cda0..21b8b497039 100644 --- a/gcc/tree-alias-common.c +++ b/gcc/tree-alias-common.c @@ -139,8 +139,7 @@ static alias_var get_alias_var_decl (tree decl) { alias_var newvar; - if (TREE_CODE (decl) == FIELD_DECL) - abort (); + gcc_assert (TREE_CODE (decl) != FIELD_DECL); if (DECL_P (decl)) { if (DECL_PTA_ALIASVAR (decl)) @@ -361,7 +360,7 @@ get_values_from_constructor (tree constructor, varray_type *vals, } break; default: - abort(); + gcc_unreachable (); } } @@ -944,14 +943,10 @@ create_alias_var (tree decl) { alias_var avar; - if (!DECL_P (decl)) - abort (); + gcc_assert (DECL_P (decl)); - if (DECL_P (decl)) - { - if (DECL_PTA_ALIASVAR (decl)) - return DECL_PTA_ALIASVAR (decl); - } + if (DECL_PTA_ALIASVAR (decl)) + return DECL_PTA_ALIASVAR (decl); if (POINTER_TYPE_P (TREE_TYPE (decl)) && TREE_CODE (TREE_TYPE (TREE_TYPE (decl))) == FUNCTION_TYPE) @@ -1067,10 +1062,8 @@ delete_alias_vars (void) for (i = 0; i < VARRAY_ACTIVE_SIZE (local_alias_vars); i++) { tree key = VARRAY_TREE (local_alias_vars, i); - if (DECL_P (key)) - DECL_PTA_ALIASVAR (key) = NULL; - else - abort (); + gcc_assert (DECL_P (key)); + DECL_PTA_ALIASVAR (key) = NULL; } for (i = 0; i < VARRAY_ACTIVE_SIZE (local_alias_varnums); i ++) @@ -1130,14 +1123,10 @@ empty_points_to_set (tree ptr) ptr = TREE_OPERAND (ptr, 1); #endif - if (DECL_P (ptr)) - { - ptrtv = DECL_PTA_ALIASVAR (ptr); - if (!ptrtv) - return true; - } - else - abort (); + gcc_assert (DECL_P (ptr)); + ptrtv = DECL_PTA_ALIASVAR (ptr); + if (!ptrtv) + return true; return current_alias_ops->empty_points_to_set (current_alias_ops, ptrtv); } @@ -1160,23 +1149,15 @@ same_points_to_set (tree ptr, tree var) if (ptr == var) return true; - if (DECL_P (ptr)) - { - ptrtv = DECL_PTA_ALIASVAR (ptr); - if (!ptrtv) - return false; - } - else - abort (); + gcc_assert (DECL_P (ptr)); + ptrtv = DECL_PTA_ALIASVAR (ptr); + if (!ptrtv) + return false; - if (DECL_P (var)) - { - vartv = DECL_PTA_ALIASVAR (var); - if (!vartv) - return false; - } - else - abort (); + gcc_assert (DECL_P (var)); + vartv = DECL_PTA_ALIASVAR (var); + if (!vartv) + return false; return current_alias_ops->same_points_to_set (current_alias_ops, vartv, ptrtv); } @@ -1200,23 +1181,15 @@ ptr_may_alias_var (tree ptr, tree var) if (ptr == var) return true; - if (DECL_P (ptr)) - { - ptrtv = DECL_PTA_ALIASVAR (ptr); - if (!ptrtv) - return false; - } - else - abort (); + gcc_assert (DECL_P (ptr)); + ptrtv = DECL_PTA_ALIASVAR (ptr); + if (!ptrtv) + return false; - if (DECL_P (var)) - { - vartv = DECL_PTA_ALIASVAR (var); - if (!vartv) - return false; - } - else - abort (); + gcc_assert (DECL_P (var)); + vartv = DECL_PTA_ALIASVAR (var); + if (!vartv) + return false; return current_alias_ops->may_alias (current_alias_ops, ptrtv, vartv); } diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index ce0be966592..9452dff2cbf 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -294,8 +294,7 @@ static void create_block_annotation (basic_block bb) { /* Verify that the tree_annotations field is clear. */ - if (bb->tree_annotations) - abort (); + gcc_assert (!bb->tree_annotations); bb->tree_annotations = ggc_alloc_cleared (sizeof (struct bb_ann_d)); } @@ -374,8 +373,7 @@ create_bb (void *h, void *e, basic_block after) { basic_block bb; - if (e) - abort (); + gcc_assert (!e); /* Create and initialize a new basic block. */ bb = alloc_block (); @@ -462,11 +460,7 @@ make_ctrl_stmt_edges (basic_block bb) { tree last = last_stmt (bb); -#if defined ENABLE_CHECKING - if (last == NULL_TREE) - abort(); -#endif - + gcc_assert (last); switch (TREE_CODE (last)) { case GOTO_EXPR: @@ -493,7 +487,7 @@ make_ctrl_stmt_edges (basic_block bb) break; default: - abort (); + gcc_unreachable (); } } @@ -507,9 +501,7 @@ make_exit_edges (basic_block bb) { tree last = last_stmt (bb), op; - if (last == NULL_TREE) - abort (); - + gcc_assert (last); switch (TREE_CODE (last)) { case CALL_EXPR: @@ -555,7 +547,7 @@ make_exit_edges (basic_block bb) break; default: - abort (); + gcc_unreachable (); } } @@ -570,10 +562,8 @@ make_cond_expr_edges (basic_block bb) basic_block then_bb, else_bb; tree then_label, else_label; -#if defined ENABLE_CHECKING - if (entry == NULL_TREE || TREE_CODE (entry) != COND_EXPR) - abort (); -#endif + gcc_assert (entry); + gcc_assert (TREE_CODE (entry) == COND_EXPR); /* Entry basic blocks for each component. */ then_label = GOTO_DESTINATION (COND_EXPR_THEN (entry)); @@ -955,9 +945,7 @@ group_case_labels (void) tree base_case, base_label, base_high, type; base_case = TREE_VEC_ELT (labels, i); - if (! base_case) - abort (); - + gcc_assert (base_case); base_label = CASE_LABEL (base_case); /* Discard cases that have the same destination as the @@ -1080,12 +1068,8 @@ tree_merge_blocks (basic_block a, basic_block b) /* Ensure that B follows A. */ move_block_after (b, a); - if (!(a->succ->flags & EDGE_FALLTHRU)) - abort (); - - if (last_stmt (a) - && stmt_ends_bb_p (last_stmt (a))) - abort (); + gcc_assert (a->succ->flags & EDGE_FALLTHRU); + gcc_assert (!last_stmt (a) || !stmt_ends_bb_p (last_stmt (a))); /* Remove labels from B and set bb_for_stmt to A for other statements. */ for (bsi = bsi_start (b); !bsi_end_p (bsi);) @@ -1964,7 +1948,7 @@ cleanup_control_expr_graph (basic_block bb, block_stmt_iterator bsi) break; default: - abort (); + gcc_unreachable (); } taken_edge = find_taken_edge (bb, val); @@ -2011,10 +1995,8 @@ find_taken_edge (basic_block bb, tree val) stmt = last_stmt (bb); -#if defined ENABLE_CHECKING - if (stmt == NULL_TREE || !is_ctrl_stmt (stmt)) - abort (); -#endif + gcc_assert (stmt); + gcc_assert (is_ctrl_stmt (stmt)); /* If VAL is a predicate of the form N RELOP N, where N is an SSA_NAME, we can always determine its truth value (except when @@ -2097,8 +2079,7 @@ find_taken_edge_switch_expr (basic_block bb, tree val) dest_bb = label_to_block (CASE_LABEL (taken_case)); e = find_edge (bb, dest_bb); - if (!e) - abort (); + gcc_assert (e); return e; } @@ -2161,10 +2142,8 @@ phi_alternatives_equal (basic_block dest, edge e1, edge e2) n1 = phi_arg_from_edge (phi, e1); n2 = phi_arg_from_edge (phi, e2); -#ifdef ENABLE_CHECKING - if (n1 < 0 || n2 < 0) - abort (); -#endif + gcc_assert (n1 >= 0); + gcc_assert (n2 >= 0); val1 = PHI_ARG_DEF (phi, n1); val2 = PHI_ARG_DEF (phi, n2); @@ -2430,11 +2409,7 @@ is_ctrl_altering_stmt (tree t) { tree call; -#if defined ENABLE_CHECKING - if (t == NULL) - abort (); -#endif - + gcc_assert (t); call = get_call_expr_in (t); if (call) { @@ -2556,7 +2531,7 @@ disband_implicit_edges (void) else if (e->flags & EDGE_FALSE_VALUE) COND_EXPR_ELSE (stmt) = build_empty_stmt (); else - abort (); + gcc_unreachable (); e->flags |= EDGE_FALLTHRU; } @@ -2567,10 +2542,9 @@ disband_implicit_edges (void) { /* Remove the RETURN_EXPR if we may fall though to the exit instead. */ - if (!bb->succ - || bb->succ->succ_next - || bb->succ->dest != EXIT_BLOCK_PTR) - abort (); + gcc_assert (bb->succ); + gcc_assert (!bb->succ->succ_next); + gcc_assert (bb->succ->dest == EXIT_BLOCK_PTR); if (bb->next_bb == EXIT_BLOCK_PTR && !TREE_OPERAND (stmt, 0)) @@ -2594,9 +2568,7 @@ disband_implicit_edges (void) if (!e || e->dest == bb->next_bb) continue; - if (e->dest == EXIT_BLOCK_PTR) - abort (); - + gcc_assert (e->dest != EXIT_BLOCK_PTR); label = tree_block_label (e->dest); stmt = build1 (GOTO_EXPR, void_type_node, label); @@ -2720,14 +2692,9 @@ set_bb_for_stmt (tree t, basic_block bb) VARRAY_GROW (label_to_block_map, 3 * uid / 2); } else - { -#ifdef ENABLE_CHECKING - /* We're moving an existing label. Make sure that we've - removed it from the old block. */ - if (bb && VARRAY_BB (label_to_block_map, uid)) - abort (); -#endif - } + /* We're moving an existing label. Make sure that we've + removed it from the old block. */ + gcc_assert (!bb || !VARRAY_BB (label_to_block_map, uid)); VARRAY_BB (label_to_block_map, uid) = bb; } } @@ -2744,7 +2711,7 @@ stmt_for_bsi (tree stmt) if (bsi_stmt (bsi) == stmt) return bsi; - abort (); + gcc_unreachable (); } /* Insert statement (or statement list) T before the statement @@ -2926,8 +2893,7 @@ tree_find_edge_insert_loc (edge e, block_stmt_iterator *bsi, tree op = TREE_OPERAND (tmp, 0); if (!is_gimple_val (op)) { - if (TREE_CODE (op) != MODIFY_EXPR) - abort (); + gcc_assert (TREE_CODE (op) == MODIFY_EXPR); bsi_insert_before (bsi, op, BSI_NEW_STMT); TREE_OPERAND (tmp, 0) = TREE_OPERAND (op, 0); } @@ -3009,8 +2975,7 @@ bsi_insert_on_edge_immediate (edge e, tree stmt) block_stmt_iterator bsi; basic_block new_bb = NULL; - if (PENDING_STMT (e)) - abort (); + gcc_assert (!PENDING_STMT (e)); if (tree_find_edge_insert_loc (e, &bsi, &new_bb)) bsi_insert_after (&bsi, stmt, BSI_NEW_STMT); @@ -3036,8 +3001,7 @@ tree_split_edge (edge edge_in) int i, num_elem; /* Abnormal edges cannot be split. */ - if (edge_in->flags & EDGE_ABNORMAL) - abort (); + gcc_assert (!(edge_in->flags & EDGE_ABNORMAL)); src = edge_in->src; dest = edge_in->dest; @@ -3070,11 +3034,9 @@ tree_split_edge (edge edge_in) } } - if (!redirect_edge_and_branch (edge_in, new_bb)) - abort (); - - if (PENDING_STMT (edge_in)) - abort (); + e = redirect_edge_and_branch (edge_in, new_bb); + gcc_assert (e); + gcc_assert (!PENDING_STMT (edge_in)); return new_bb; } @@ -3655,8 +3617,7 @@ tree_verify_flow_info (void) tree lab = CASE_LABEL (TREE_VEC_ELT (vec, i)); basic_block label_bb = label_to_block (lab); - if (label_bb->aux && label_bb->aux != (void *)1) - abort (); + gcc_assert (!label_bb->aux || label_bb->aux == (void *)1); label_bb->aux = (void *)1; } @@ -3962,8 +3923,7 @@ thread_jumps (void) for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi)) { arg = phi_arg_from_edge (phi, last); - if (arg < 0) - abort (); + gcc_assert (arg >= 0); add_phi_arg (&phi, PHI_ARG_DEF (phi, arg), e); } } @@ -4130,7 +4090,7 @@ tree_redirect_edge_and_branch (edge e, basic_block dest) case GOTO_EXPR: /* No non-abnormal edges should lead from a non-simple goto, and simple ones should be represented implicitly. */ - abort (); + gcc_unreachable (); case SWITCH_EXPR: { @@ -4154,8 +4114,7 @@ tree_redirect_edge_and_branch (edge e, basic_block dest) default: /* Otherwise it must be a fallthru edge, and we don't need to do anything besides redirecting it. */ - if (!(e->flags & EDGE_FALLTHRU)) - abort (); + gcc_assert (e->flags & EDGE_FALLTHRU); break; } @@ -4174,8 +4133,7 @@ static basic_block tree_redirect_edge_and_branch_force (edge e, basic_block dest) { e = tree_redirect_edge_and_branch (e, dest); - if (!e) - abort (); + gcc_assert (e); return NULL; } @@ -4650,8 +4608,7 @@ tree_flow_call_edges_add (sbitmap blocks) #ifdef ENABLE_CHECKING if (stmt == last_stmt) for (e = bb->succ; e; e = e->succ_next) - if (e->dest == EXIT_BLOCK_PTR) - abort (); + gcc_assert (e->dest != EXIT_BLOCK_PTR); #endif /* Note that the following may create a new basic block diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c index d16522f5fae..0929f69d6df 100644 --- a/gcc/tree-chrec.c +++ b/gcc/tree-chrec.c @@ -56,13 +56,10 @@ chrec_fold_poly_cst (enum tree_code code, tree poly, tree cst) { -#if defined ENABLE_CHECKING - if (poly == NULL_TREE - || cst == NULL_TREE - || TREE_CODE (poly) != POLYNOMIAL_CHREC - || is_not_constant_evolution (cst)) - abort (); -#endif + gcc_assert (poly); + gcc_assert (cst); + gcc_assert (TREE_CODE (poly) == POLYNOMIAL_CHREC); + gcc_assert (!is_not_constant_evolution (cst)); switch (code) { @@ -98,14 +95,11 @@ chrec_fold_plus_poly_poly (enum tree_code code, tree poly1) { tree left, right; - -#if defined ENABLE_CHECKING - if (poly0 == NULL_TREE - || poly1 == NULL_TREE - || TREE_CODE (poly0) != POLYNOMIAL_CHREC - || TREE_CODE (poly1) != POLYNOMIAL_CHREC) - abort (); -#endif + + gcc_assert (poly0); + gcc_assert (poly1); + gcc_assert (TREE_CODE (poly0) == POLYNOMIAL_CHREC); + gcc_assert (TREE_CODE (poly1) == POLYNOMIAL_CHREC); /* {a, +, b}_1 + {c, +, d}_2 -> {{a, +, b}_1 + c, +, d}_2, @@ -171,13 +165,10 @@ chrec_fold_multiply_poly_poly (tree type, tree poly0, tree poly1) { -#if defined ENABLE_CHECKING - if (poly0 == NULL_TREE - || poly1 == NULL_TREE - || TREE_CODE (poly0) != POLYNOMIAL_CHREC - || TREE_CODE (poly1) != POLYNOMIAL_CHREC) - abort (); -#endif + gcc_assert (poly0); + gcc_assert (poly1); + gcc_assert (TREE_CODE (poly0) == POLYNOMIAL_CHREC); + gcc_assert (TREE_CODE (poly1) == POLYNOMIAL_CHREC); /* {a, +, b}_1 * {c, +, d}_2 -> {c*{a, +, b}_1, +, d}_2, {a, +, b}_2 * {c, +, d}_1 -> {a*{c, +, d}_1, +, b}_2, diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c index d0c6c637384..363e3a2d578 100644 --- a/gcc/tree-complex.c +++ b/gcc/tree-complex.c @@ -64,7 +64,7 @@ extract_component (block_stmt_iterator *bsi, tree t, bool imagpart_p) break; default: - abort (); + gcc_unreachable (); } return gimplify_val (bsi, inner_type, ret); @@ -285,7 +285,7 @@ expand_complex_division (block_stmt_iterator *bsi, tree inner_type, break; default: /* C99-like requirements for complex divide (not yet implemented). */ - abort (); + gcc_unreachable (); } } @@ -349,7 +349,7 @@ expand_complex_comparison (block_stmt_iterator *bsi, tree ar, tree ai, TREE_OPERAND (stmt, 0) = cc; break; default: - abort (); + gcc_unreachable (); } modify_stmt (stmt); @@ -472,7 +472,7 @@ expand_complex_operations_1 (block_stmt_iterator *bsi) break; default: - abort (); + gcc_unreachable (); } } @@ -486,8 +486,7 @@ build_replicated_const (tree type, tree inner_type, HOST_WIDE_INT value) unsigned HOST_WIDE_INT low, high, mask; tree ret; - if (n == 0) - abort (); + gcc_assert (n); if (width == HOST_BITS_PER_WIDE_INT) low = value; @@ -504,7 +503,7 @@ build_replicated_const (tree type, tree inner_type, HOST_WIDE_INT value) else if (TYPE_PRECISION (type) == 2 * HOST_BITS_PER_WIDE_INT) high = low; else - abort (); + gcc_unreachable (); ret = build_int_cst_wide (type, low, high); return ret; @@ -783,10 +782,8 @@ expand_vector_operations_1 (block_stmt_iterator *bsi) if (code == NOP_EXPR || code == VIEW_CONVERT_EXPR) return; - - if (code == CONVERT_EXPR) - abort (); - + + gcc_assert (code != CONVERT_EXPR); op = optab_for_tree_code (code, type); /* Optabs will try converting a negation into a subtraction, so diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 57f20bb7307..db5dea62829 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -270,21 +270,19 @@ tree_fold_bezout (tree a1, zs2 = fold (build (MULT_EXPR, integer_type_node, z, s2)); /* row1 -= z * row2. */ + gcc_assert (sign != 0); if (sign < 0) { *u11 = fold (build (PLUS_EXPR, integer_type_node, *u11, zu21)); *u12 = fold (build (PLUS_EXPR, integer_type_node, *u12, zu22)); s1 = fold (build (PLUS_EXPR, integer_type_node, s1, zs2)); } - else if (sign > 0) + else { *u11 = fold (build (MINUS_EXPR, integer_type_node, *u11, zu21)); *u12 = fold (build (MINUS_EXPR, integer_type_node, *u12, zu22)); s1 = fold (build (MINUS_EXPR, integer_type_node, s1, zs2)); } - else - /* Should not happen. */ - abort (); /* Interchange row1 and row2. */ { @@ -1466,8 +1464,8 @@ build_classic_dist_vector (struct data_dependence_relation *ddr, /* If the loop number is still greater than the number of loops we've been asked to analyze, or negative, something is borked. */ - if (loop_nb < 0 || loop_nb >= nb_loops) - abort (); + gcc_assert (loop_nb >= 0); + gcc_assert (loop_nb < nb_loops); dist = int_cst_value (SUB_DISTANCE (subscript)); /* This is the subscript coupling test. @@ -1508,8 +1506,8 @@ build_classic_dist_vector (struct data_dependence_relation *ddr, lca_nb = lca->num; lca_nb -= first_loop; - if (lca_nb < 0 || lca_nb >= nb_loops) - abort (); + gcc_assert (lca_nb >= 0); + gcc_assert (lca_nb < nb_loops); /* For each outer loop where init_v is not set, the accesses are in dependence of distance 1 in the loop. */ if (lca != loop_a @@ -1524,8 +1522,8 @@ build_classic_dist_vector (struct data_dependence_relation *ddr, lca_nb = lca->num - first_loop; while (lca->depth != 0) { - if (lca_nb < 0 || lca_nb >= nb_loops) - abort (); + gcc_assert (lca_nb >= 0); + gcc_assert (lca_nb < nb_loops); if (init_v[lca_nb] == 0) dist_v[lca_nb] = 1; lca = lca->outer; @@ -1575,13 +1573,9 @@ build_classic_dir_vector (struct data_dependence_relation *ddr, /* If the loop number is still greater than the number of loops we've been asked to analyze, or negative, something is borked. */ - if (loop_nb < 0 || loop_nb >= nb_loops) - abort (); - if (chrec_contains_undetermined (SUB_DISTANCE (subscript))) - { - - } - else + gcc_assert (loop_nb >= 0); + gcc_assert (loop_nb < nb_loops); + if (!chrec_contains_undetermined (SUB_DISTANCE (subscript))) { int dist = int_cst_value (SUB_DISTANCE (subscript)); @@ -1632,8 +1626,8 @@ build_classic_dir_vector (struct data_dependence_relation *ddr, lca = find_common_loop (loop_a, loop_b); lca_nb = lca->num - first_loop; - if (lca_nb < 0 || lca_nb >= nb_loops) - abort (); + gcc_assert (lca_nb >= 0); + gcc_assert (lca_nb < nb_loops); /* For each outer loop where init_v is not set, the accesses are in dependence of distance 1 in the loop. */ if (lca != loop_a @@ -1647,8 +1641,8 @@ build_classic_dir_vector (struct data_dependence_relation *ddr, lca_nb = lca->num - first_loop; while (lca->depth != 0) { - if (lca_nb < 0 || lca_nb >= nb_loops) - abort (); + gcc_assert (lca_nb >= 0); + gcc_assert (lca_nb < nb_loops); if (init_v[lca_nb] == 0) dir_v[lca_nb] = dir_positive; lca = lca->outer; diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index 87e0ac865f6..ad14e12bc7a 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -244,10 +244,7 @@ compute_immediate_uses_for_phi (tree phi, bool (*calc_for)(tree)) { int i; -#ifdef ENABLE_CHECKING - if (TREE_CODE (phi) != PHI_NODE) - abort (); -#endif + gcc_assert (TREE_CODE (phi) == PHI_NODE); for (i = 0; i < PHI_NUM_ARGS (phi); i++) { @@ -274,11 +271,8 @@ compute_immediate_uses_for_stmt (tree stmt, int flags, bool (*calc_for)(tree)) tree use; ssa_op_iter iter; -#ifdef ENABLE_CHECKING /* PHI nodes are handled elsewhere. */ - if (TREE_CODE (stmt) == PHI_NODE) - abort (); -#endif + gcc_assert (TREE_CODE (stmt) != PHI_NODE); /* Look at USE_OPS or VUSE_OPS according to FLAGS. */ if (flags & TDFA_USE_OPS) @@ -382,13 +376,9 @@ create_var_ann (tree t) { var_ann_t ann; -#if defined ENABLE_CHECKING - if (t == NULL_TREE - || !DECL_P (t) - || (t->common.ann - && t->common.ann->common.type != VAR_ANN)) - abort (); -#endif + gcc_assert (t); + gcc_assert (DECL_P (t)); + gcc_assert (!t->common.ann || t->common.ann->common.type == VAR_ANN); ann = ggc_alloc (sizeof (*ann)); memset ((void *) ann, 0, sizeof (*ann)); @@ -408,12 +398,8 @@ create_stmt_ann (tree t) { stmt_ann_t ann; -#if defined ENABLE_CHECKING - if ((!is_gimple_stmt (t)) - || (t->common.ann - && t->common.ann->common.type != STMT_ANN)) - abort (); -#endif + gcc_assert (is_gimple_stmt (t)); + gcc_assert (!t->common.ann || t->common.ann->common.type == STMT_ANN); ann = ggc_alloc (sizeof (*ann)); memset ((void *) ann, 0, sizeof (*ann)); @@ -436,12 +422,8 @@ create_tree_ann (tree t) { tree_ann_t ann; -#if defined ENABLE_CHECKING - if (t == NULL_TREE - || (t->common.ann - && t->common.ann->common.type != TREE_ANN_COMMON)) - abort (); -#endif + gcc_assert (t); + gcc_assert (!t->common.ann || t->common.ann->common.type == TREE_ANN_COMMON); ann = ggc_alloc (sizeof (*ann)); memset ((void *) ann, 0, sizeof (*ann)); @@ -750,8 +732,7 @@ collect_dfa_stats (struct dfa_stats_d *dfa_stats_p) basic_block bb; block_stmt_iterator i; - if (dfa_stats_p == NULL) - abort (); + gcc_assert (dfa_stats_p); memset ((void *)dfa_stats_p, 0, sizeof (struct dfa_stats_d)); @@ -906,14 +887,11 @@ get_virtual_var (tree var) || handled_component_p (var)) var = TREE_OPERAND (var, 0); -#ifdef ENABLE_CHECKING /* Treating GIMPLE registers as virtual variables makes no sense. Also complain if we couldn't extract a _DECL out of the original expression. */ - if (!SSA_VAR_P (var) - || is_gimple_reg (var)) - abort (); -#endif + gcc_assert (SSA_VAR_P (var)); + gcc_assert (!is_gimple_reg (var)); return var; } diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c index dfe2ebbae6e..c09fc531a55 100644 --- a/gcc/tree-dump.c +++ b/gcc/tree-dump.c @@ -274,7 +274,7 @@ dequeue_and_dump (dump_info_p di) else if (access == access_private_node) string = "priv"; else - abort (); + gcc_unreachable (); dump_string (di, string); queue_and_dump_index (di, "binf", base, DUMP_BINFO); @@ -309,7 +309,7 @@ dequeue_and_dump (dump_info_p di) break; default: - abort (); + gcc_unreachable (); } } else if (DECL_P (t)) diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index 212604768a5..008632de728 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -103,8 +103,7 @@ record_stmt_eh_region (struct eh_region *region, tree t) n->region_nr = get_eh_region_number (region); slot = htab_find_slot (throw_stmt_table, n, INSERT); - if (*slot) - abort (); + gcc_assert (!*slot); *slot = n; } @@ -114,16 +113,14 @@ add_stmt_to_eh_region (tree t, int num) struct throw_stmt_node *n; void **slot; - if (num < 0) - abort (); + gcc_assert (num >= 0); n = ggc_alloc (sizeof (*n)); n->stmt = t; n->region_nr = num; slot = htab_find_slot (throw_stmt_table, n, INSERT); - if (*slot) - abort (); + gcc_assert (!*slot); *slot = n; } @@ -186,8 +183,7 @@ record_in_finally_tree (tree child, tree parent) n->parent = parent; slot = htab_find_slot (finally_tree, n, INSERT); - if (*slot) - abort (); + gcc_assert (!*slot); *slot = n; } @@ -422,7 +418,7 @@ replace_goto_queue_1 (tree t, struct leh_tf_state *tf, tree_stmt_iterator *tsi) break; case STATEMENT_LIST: - abort (); + gcc_unreachable (); default: /* These won't have gotos in them. */ @@ -505,7 +501,7 @@ maybe_record_in_goto_queue (struct leh_state *state, tree stmt) break; default: - abort (); + gcc_unreachable (); } active = tf->goto_queue_active; @@ -547,8 +543,7 @@ verify_norecord_switch_expr (struct leh_state *state, tree switch_expr) for (i = 0; i < n; ++i) { tree lab = CASE_LABEL (TREE_VEC_ELT (vec, i)); - if (outside_finally_tree (lab, tf->try_finally_expr)) - abort (); + gcc_assert (!outside_finally_tree (lab, tf->try_finally_expr)); } } #else @@ -591,47 +586,51 @@ do_return_redirection (struct goto_queue_node *q, tree finlab, tree mod, depends, I guess, but it does make generation of the switch in lower_try_finally_switch easier. */ - if (TREE_CODE (ret_expr) == RESULT_DECL) + switch (TREE_CODE (ret_expr)) { + case RESULT_DECL: if (!*return_value_p) *return_value_p = ret_expr; - else if (*return_value_p != ret_expr) - abort (); - q->cont_stmt = q->stmt; - } - else if (TREE_CODE (ret_expr) == MODIFY_EXPR) - { - tree result = TREE_OPERAND (ret_expr, 0); - tree new, old = TREE_OPERAND (ret_expr, 1); - - if (!*return_value_p) - { - if (aggregate_value_p (TREE_TYPE (result), - TREE_TYPE (current_function_decl))) - /* If this function returns in memory, copy the argument - into the return slot now. Otherwise, we might need to - worry about magic return semantics, so we need to use a - temporary to hold the value until we're actually ready - to return. */ - new = result; - else - new = create_tmp_var (TREE_TYPE (old), "rettmp"); - *return_value_p = new; - } else - new = *return_value_p; + gcc_assert (*return_value_p == ret_expr); + q->cont_stmt = q->stmt; + break; - x = build (MODIFY_EXPR, TREE_TYPE (new), new, old); - append_to_statement_list (x, &q->repl_stmt); + case MODIFY_EXPR: + { + tree result = TREE_OPERAND (ret_expr, 0); + tree new, old = TREE_OPERAND (ret_expr, 1); + + if (!*return_value_p) + { + if (aggregate_value_p (TREE_TYPE (result), + TREE_TYPE (current_function_decl))) + /* If this function returns in memory, copy the argument + into the return slot now. Otherwise, we might need to + worry about magic return semantics, so we need to use a + temporary to hold the value until we're actually ready + to return. */ + new = result; + else + new = create_tmp_var (TREE_TYPE (old), "rettmp"); + *return_value_p = new; + } + else + new = *return_value_p; + + x = build (MODIFY_EXPR, TREE_TYPE (new), new, old); + append_to_statement_list (x, &q->repl_stmt); + + if (new == result) + x = result; + else + x = build (MODIFY_EXPR, TREE_TYPE (result), result, new); + q->cont_stmt = build1 (RETURN_EXPR, void_type_node, x); + } - if (new == result) - x = result; - else - x = build (MODIFY_EXPR, TREE_TYPE (result), result, new); - q->cont_stmt = build1 (RETURN_EXPR, void_type_node, x); + default: + gcc_unreachable (); } - else - abort (); } else { diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index 423088c9e51..cd2bf9ec082 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -30,13 +30,9 @@ Boston, MA 02111-1307, USA. */ static inline var_ann_t var_ann (tree t) { -#if defined ENABLE_CHECKING - if (t == NULL_TREE - || !DECL_P (t) - || (t->common.ann - && t->common.ann->common.type != VAR_ANN)) - abort (); -#endif + gcc_assert (t); + gcc_assert (DECL_P (t)); + gcc_assert (!t->common.ann || t->common.ann->common.type == VAR_ANN); return (var_ann_t) t->common.ann; } @@ -55,11 +51,9 @@ get_var_ann (tree var) static inline stmt_ann_t stmt_ann (tree t) { -#if defined ENABLE_CHECKING - if (!is_gimple_stmt (t)) - abort (); +#ifdef ENABLE_CHECKING + gcc_assert (is_gimple_stmt (t)); #endif - return (stmt_ann_t) t->common.ann; } @@ -223,10 +217,7 @@ get_def_from_ptr (def_operand_p def) static inline use_operand_p get_use_op_ptr (use_optype uses, unsigned int index) { -#ifdef ENABLE_CHECKING - if (index >= uses->num_uses) - abort(); -#endif + gcc_assert (index < uses->num_uses); return uses->uses[index]; } @@ -234,10 +225,7 @@ get_use_op_ptr (use_optype uses, unsigned int index) static inline def_operand_p get_def_op_ptr (def_optype defs, unsigned int index) { -#ifdef ENABLE_CHECKING - if (index >= defs->num_defs) - abort(); -#endif + gcc_assert (index < defs->num_defs); return defs->defs[index]; } @@ -248,10 +236,7 @@ static inline def_operand_p get_v_may_def_result_ptr(v_may_def_optype v_may_defs, unsigned int index) { def_operand_p op; -#ifdef ENABLE_CHECKING - if (index >= v_may_defs->num_v_may_defs) - abort(); -#endif + gcc_assert (index < v_may_defs->num_v_may_defs); op.def = &(v_may_defs->v_may_defs[index].def); return op; } @@ -262,10 +247,7 @@ static inline use_operand_p get_v_may_def_op_ptr(v_may_def_optype v_may_defs, unsigned int index) { use_operand_p op; -#ifdef ENABLE_CHECKING - if (index >= v_may_defs->num_v_may_defs) - abort(); -#endif + gcc_assert (index < v_may_defs->num_v_may_defs); op.use = &(v_may_defs->v_may_defs[index].use); return op; } @@ -275,10 +257,7 @@ static inline use_operand_p get_vuse_op_ptr(vuse_optype vuses, unsigned int index) { use_operand_p op; -#ifdef ENABLE_CHECKING - if (index >= vuses->num_vuses) - abort(); -#endif + gcc_assert (index < vuses->num_vuses); op.use = &(vuses->vuses[index]); return op; } @@ -289,10 +268,7 @@ static inline def_operand_p get_v_must_def_op_ptr (v_must_def_optype v_must_defs, unsigned int index) { def_operand_p op; -#ifdef ENABLE_CHECKING - if (index >= v_must_defs->num_v_must_defs) - abort(); -#endif + gcc_assert (index < v_must_defs->num_v_must_defs); op.def = &(v_must_defs->v_must_defs[index]); return op; } @@ -358,8 +334,7 @@ immediate_use (dataflow_t df, int num) return NULL_TREE; #ifdef ENABLE_CHECKING - if (num >= num_immediate_uses (df)) - abort (); + gcc_assert (num < num_immediate_uses (df)); #endif if (num < 2) return df->uses[num]; @@ -400,10 +375,8 @@ static inline int phi_arg_from_edge (tree phi, edge e) { int i; -#if defined ENABLE_CHECKING - if (!phi || TREE_CODE (phi) != PHI_NODE) - abort(); -#endif + gcc_assert (phi); + gcc_assert (TREE_CODE (phi) == PHI_NODE); for (i = 0; i < PHI_NUM_ARGS (phi); i++) if (PHI_ARG_EDGE (phi, i) == e) @@ -477,8 +450,7 @@ phi_ssa_name_p (tree t) if (TREE_CODE (t) == SSA_NAME) return true; #ifdef ENABLE_CHECKING - if (!is_gimple_min_invariant (t)) - abort (); + gcc_assert (is_gimple_min_invariant (t)); #endif return false; } @@ -495,10 +467,7 @@ bsi_start (basic_block bb) bsi.tsi = tsi_start (bb->stmt_list); else { -#ifdef ENABLE_CHECKING - if (bb->index >= 0) - abort (); -#endif + gcc_assert (bb->index < 0); bsi.tsi.ptr = NULL; bsi.tsi.container = NULL; } @@ -519,10 +488,7 @@ bsi_after_labels (basic_block bb) if (!bb->stmt_list) { -#ifdef ENABLE_CHECKING - if (bb->index >= 0) - abort (); -#endif + gcc_assert (bb->index < 0); bsi.tsi.ptr = NULL; bsi.tsi.container = NULL; return bsi; @@ -537,8 +503,7 @@ bsi_after_labels (basic_block bb) be placed at the start of the basic block. This would not work if the first statement was not label; rather fail here than enable the user proceed in wrong way. */ - if (TREE_CODE (tsi_stmt (bsi.tsi)) != LABEL_EXPR) - abort (); + gcc_assert (TREE_CODE (tsi_stmt (bsi.tsi)) == LABEL_EXPR); next = bsi.tsi; tsi_next (&next); @@ -563,10 +528,7 @@ bsi_last (basic_block bb) bsi.tsi = tsi_last (bb->stmt_list); else { -#ifdef ENABLE_CHECKING - if (bb->index >= 0) - abort (); -#endif + gcc_assert (bb->index < 0); bsi.tsi.ptr = NULL; bsi.tsi.container = NULL; } diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index 1e2fd76e3a9..0c9a4b6487f 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -257,8 +257,7 @@ tree_if_convert_stmt (struct loop * loop, tree t, tree cond, break; default: - abort (); - break; + gcc_unreachable (); } return cond; } @@ -275,10 +274,7 @@ tree_if_convert_cond_expr (struct loop *loop, tree stmt, tree cond, tree then_clause, else_clause, c, new_cond; new_cond = NULL_TREE; -#ifdef ENABLE_CHECKING - if (TREE_CODE (stmt) != COND_EXPR) - abort (); -#endif + gcc_assert (TREE_CODE (stmt) == COND_EXPR); c = TREE_OPERAND (stmt, 0); then_clause = TREE_OPERAND (stmt, 1); @@ -634,10 +630,7 @@ add_to_dst_predicate_list (struct loop * loop, tree dst, basic_block bb; tree new_cond = NULL_TREE; -#ifdef ENABLE_CHECKING - if (TREE_CODE (dst) != GOTO_EXPR) - abort (); -#endif + gcc_assert (TREE_CODE (dst) == GOTO_EXPR); bb = label_to_block (TREE_OPERAND (dst, 0)); if (!flow_bb_inside_loop_p (loop, bb)) return NULL_TREE; @@ -688,11 +681,11 @@ find_phi_replacement_condition (basic_block bb, tree *cond, { if (p1 == NULL) p1 = e->src; - else if (p2 == NULL) - p2 = e->src; - else - /* More than two predecessors. This is not expected. */ - abort (); + else + { + gcc_assert (!p2); + p2 = e->src; + } } /* Use condition that is not TRUTH_NOT_EXPR in conditional modify expr. */ @@ -722,10 +715,7 @@ find_phi_replacement_condition (basic_block bb, tree *cond, *cond = TREE_OPERAND (new_stmt, 0); } -#ifdef ENABLE_CHECKING - if (*cond == NULL_TREE) - abort (); -#endif + gcc_assert (*cond); return true_bb; } @@ -749,15 +739,11 @@ replace_phi_with_cond_modify_expr (tree phi, tree cond, basic_block true_bb, basic_block bb; tree rhs; tree arg_0, arg_1; - -#ifdef ENABLE_CHECKING - if (TREE_CODE (phi) != PHI_NODE) - abort (); + gcc_assert (TREE_CODE (phi) == PHI_NODE); + /* If this is not filtered earlier, then now it is too late. */ - if (PHI_NUM_ARGS (phi) != 2) - abort (); -#endif + gcc_assert (PHI_NUM_ARGS (phi) == 2); /* Find basic block and initialize iterator. */ bb = bb_for_stmt (phi); @@ -991,11 +977,8 @@ get_loop_body_in_if_conv_order (const struct loop *loop) unsigned int index = 0; unsigned int visited_count = 0; - if (!loop->num_nodes) - abort (); - - if (loop->latch == EXIT_BLOCK_PTR) - abort (); + gcc_assert (loop->num_nodes); + gcc_assert (loop->latch != EXIT_BLOCK_PTR); blocks = xcalloc (loop->num_nodes, sizeof (basic_block)); visited = BITMAP_XMALLOC (); diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 71e9ef2731b..7a80528ecfc 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -206,8 +206,7 @@ remap_decl (tree decl, inline_data *id) { tree member = remap_decl (TREE_VALUE (src), id); - if (TREE_PURPOSE (src)) - abort (); + gcc_assert (!TREE_PURPOSE (src)); members = tree_cons (NULL, member, members); } DECL_ANON_UNION_ELEMS (t) = nreverse (members); @@ -326,7 +325,7 @@ remap_type (tree type, inline_data *id) case OFFSET_TYPE: default: /* Shouldn't have been thought variable sized. */ - abort (); + gcc_unreachable (); } walk_tree (&TYPE_SIZE (new), copy_body_r, id, NULL); @@ -354,12 +353,9 @@ remap_decls (tree decls, inline_data *id) already declared somewhere else, so don't declare it here. */ if (!new_var || new_var == id->retvar) ; -#ifdef ENABLE_CHECKING - else if (!DECL_P (new_var)) - abort (); -#endif else { + gcc_assert (DECL_P (new_var)); TREE_CHAIN (new_var) = new_decls; new_decls = new_var; } @@ -461,8 +457,7 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) what function they come from. */ if ((TREE_CODE (*tp) == VAR_DECL || TREE_CODE (*tp) == LABEL_DECL) && DECL_NAMESPACE_SCOPE_P (*tp)) - if (! DECL_EXTERNAL (*tp) && ! TREE_STATIC (*tp)) - abort (); + gcc_assert (DECL_EXTERNAL (*tp) || TREE_STATIC (*tp)); #endif /* If this is a RETURN_EXPR, change it into a MODIFY_EXPR and a @@ -504,17 +499,11 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) /* Remap the declaration. */ new_decl = remap_decl (*tp, id); - if (! new_decl) - abort (); + gcc_assert (new_decl); /* Replace this variable with the copy. */ STRIP_TYPE_NOPS (new_decl); *tp = new_decl; } -#if 0 - else if (nonstatic_local_decl_p (*tp) - && DECL_CONTEXT (*tp) != VARRAY_TREE (id->fns, 0)) - abort (); -#endif else if (TREE_CODE (*tp) == STATEMENT_LIST) copy_statement_list (tp); else if (TREE_CODE (*tp) == SAVE_EXPR) @@ -536,8 +525,7 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) = splay_tree_lookup (id->decl_map, (splay_tree_key) TREE_OPERAND (*tp, 0)); /* We _must_ have seen the enclosing LABELED_BLOCK_EXPR. */ - if (! n) - abort (); + gcc_assert (n); *tp = copy_node (*tp); TREE_OPERAND (*tp, 0) = (tree) n->value; } @@ -608,10 +596,8 @@ copy_body_r (tree *tp, int *walk_subtrees, void *data) for (node = id->node->next_clone; node; node = node->next_clone) { edge = cgraph_edge (node, old_node); - if (edge) - edge->call_expr = *tp; - else - abort (); + gcc_assert (edge); + edge->call_expr = *tp; } } else @@ -793,11 +779,10 @@ initialize_inlined_parameters (inline_data *id, tree args, tree static_chain, if (p) { /* No static chain? Seems like a bug in tree-nested.c. */ - if (!static_chain) - abort (); + gcc_assert (static_chain); - setup_one_parameter (id, p, static_chain, fn, &init_stmts, &vars, - &gimplify_init_stmts_p); + setup_one_parameter (id, p, static_chain, fn, &init_stmts, &vars, + &gimplify_init_stmts_p); } if (gimplify_init_stmts_p) @@ -841,8 +826,7 @@ declare_return_variable (inline_data *id, tree return_slot_addr, { /* The front end shouldn't have used both return_slot_addr and a modify expression. */ - if (modify_dest) - abort (); + gcc_assert (!modify_dest); if (DECL_BY_REFERENCE (result)) var = return_slot_addr; else @@ -852,8 +836,7 @@ declare_return_variable (inline_data *id, tree return_slot_addr, } /* All types requiring non-trivial constructors should have been handled. */ - if (TREE_ADDRESSABLE (callee_type)) - abort (); + gcc_assert (!TREE_ADDRESSABLE (callee_type)); /* Attempt to avoid creating a new temporary variable. */ if (modify_dest) @@ -886,8 +869,7 @@ declare_return_variable (inline_data *id, tree return_slot_addr, } } - if (TREE_CODE (TYPE_SIZE_UNIT (callee_type)) != INTEGER_CST) - abort (); + gcc_assert (TREE_CODE (TYPE_SIZE_UNIT (callee_type)) == INTEGER_CST); var = copy_decl_for_inlining (result, callee, caller); DECL_SEEN_IN_BIND_EXPR_P (var) = 1; @@ -1359,7 +1341,7 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data) } default: /* Abort here se we know we don't miss any nodes. */ - abort (); + gcc_unreachable (); } return NULL; } @@ -1481,8 +1463,7 @@ expand_call_inline (tree *tp, int *walk_subtrees, void *data) where previous inlining turned indirect call into direct call by constant propagating arguments. In all other cases we hit a bug (incorrect node sharing is most common reason for missing edges. */ - if (!dest->needed) - abort (); + gcc_assert (dest->needed); cgraph_create_edge (id->node, dest, t)->inline_failed = N_("originally indirect function call not considered for inlining"); goto egress; @@ -1585,9 +1566,8 @@ expand_call_inline (tree *tp, int *walk_subtrees, void *data) DECL_CONTEXT (id->ret_label) = VARRAY_TREE (id->fns, 0); insert_decl_map (id, id->ret_label, id->ret_label); - if (! DECL_INITIAL (fn) - || TREE_CODE (DECL_INITIAL (fn)) != BLOCK) - abort (); + gcc_assert (DECL_INITIAL (fn)); + gcc_assert (TREE_CODE (DECL_INITIAL (fn)) == BLOCK); /* Find the lhs to which the result of this call is assigned. */ modify_dest = tsi_stmt (id->tsi); @@ -1725,7 +1705,7 @@ expand_calls_inline (tree *stmt_p, inline_data *id) case COMPOUND_EXPR: /* We're gimple. We should have gotten rid of all these. */ - abort (); + gcc_unreachable (); case RETURN_EXPR: stmt_p = &TREE_OPERAND (stmt, 0); @@ -1817,8 +1797,7 @@ optimize_inline_calls (tree fn) /* Double check that we inlined everything we are supposed to inline. */ for (e = id.node->callees; e; e = e->next_callee) - if (!e->inline_failed) - abort (); + gcc_assert (e->inline_failed); } #endif } @@ -2303,9 +2282,8 @@ copy_tree_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) *walk_subtrees = 0; else if (TREE_CODE_CLASS (code) == 'd') *walk_subtrees = 0; - else if (code == STATEMENT_LIST) - abort (); - + else + gcc_assert (code != STATEMENT_LIST); return NULL_TREE; } diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index 735d71fe0c4..bbec1b2d726 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -649,7 +649,6 @@ rewrite_initialize_block_local_data (struct dom_walk_data *walk_data ATTRIBUTE_U basic_block bb ATTRIBUTE_UNUSED, bool recycled ATTRIBUTE_UNUSED) { -#ifdef ENABLE_CHECKING struct rewrite_block_data *bd = (struct rewrite_block_data *)VARRAY_TOP_GENERIC_PTR (walk_data->block_data_stack); @@ -657,9 +656,7 @@ rewrite_initialize_block_local_data (struct dom_walk_data *walk_data ATTRIBUTE_U not cleared, then we are re-using a previously allocated entry. In that case, we can also re-use the underlying virtual arrays. Just make sure we clear them before using them! */ - if (recycled && bd->block_defs && VARRAY_ACTIVE_SIZE (bd->block_defs) > 0) - abort (); -#endif + gcc_assert (!recycled || !bd->block_defs || !(VARRAY_ACTIVE_SIZE (bd->block_defs) > 0)); } @@ -1064,12 +1061,9 @@ rewrite_stmt (struct dom_walk_data *walk_data, fprintf (dump_file, "\n"); } -#if defined ENABLE_CHECKING /* We have just scanned the code for operands. No statement should be modified. */ - if (ann->modified) - abort (); -#endif + gcc_assert (!ann->modified); /* Step 1. Rewrite USES and VUSES in the statement. */ FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES) @@ -1114,12 +1108,9 @@ ssa_rewrite_stmt (struct dom_walk_data *walk_data, fprintf (dump_file, "\n"); } -#if defined ENABLE_CHECKING /* We have just scanned the code for operands. No statement should be modified. */ - if (ann->modified) - abort (); -#endif + gcc_assert (!ann->modified); /* Step 1. Rewrite USES and VUSES in the statement. */ FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES) @@ -1421,9 +1412,7 @@ rewrite_into_ssa (bool all) else { /* Initialize the array of variables to rename. */ - - if (vars_to_rename == NULL) - abort (); + gcc_assert (vars_to_rename); if (bitmap_first_set_bit (vars_to_rename) < 0) { diff --git a/gcc/tree-iterator.c b/gcc/tree-iterator.c index d13ea960888..1b781609ee2 100644 --- a/gcc/tree-iterator.c +++ b/gcc/tree-iterator.c @@ -52,10 +52,8 @@ alloc_stmt_list (void) void free_stmt_list (tree t) { -#ifdef ENABLE_CHECKING - if (STATEMENT_LIST_HEAD (t) || STATEMENT_LIST_TAIL (t)) - abort (); -#endif + gcc_assert (!STATEMENT_LIST_HEAD (t)); + gcc_assert (!STATEMENT_LIST_TAIL (t)); TREE_CHAIN (t) = stmt_list_cache; stmt_list_cache = t; } @@ -68,8 +66,7 @@ tsi_link_before (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode) struct tree_statement_list_node *head, *tail, *cur; /* Die on looping. */ - if (t == i->container) - abort (); + gcc_assert (t != i->container); if (TREE_CODE (t) == STATEMENT_LIST) { @@ -83,8 +80,7 @@ tsi_link_before (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode) /* Empty statement lists need no work. */ if (!head || !tail) { - if (head != tail) - abort (); + gcc_assert (head == tail); return; } } @@ -114,8 +110,7 @@ tsi_link_before (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode) } else { - if (STATEMENT_LIST_TAIL (i->container)) - abort (); + gcc_assert (!STATEMENT_LIST_TAIL (i->container)); STATEMENT_LIST_HEAD (i->container) = head; STATEMENT_LIST_TAIL (i->container) = tail; } @@ -132,8 +127,7 @@ tsi_link_before (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode) i->ptr = tail; break; case TSI_SAME_STMT: - if (!cur) - abort (); + gcc_assert (cur); break; } } @@ -146,8 +140,7 @@ tsi_link_after (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode) struct tree_statement_list_node *head, *tail, *cur; /* Die on looping. */ - if (t == i->container) - abort (); + gcc_assert (t != i->container); if (TREE_CODE (t) == STATEMENT_LIST) { @@ -161,8 +154,7 @@ tsi_link_after (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode) /* Empty statement lists need no work. */ if (!head || !tail) { - if (head != tail) - abort (); + gcc_assert (head == tail); return; } } @@ -192,8 +184,7 @@ tsi_link_after (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode) } else { - if (STATEMENT_LIST_TAIL (i->container)) - abort (); + gcc_assert (!STATEMENT_LIST_TAIL (i->container)); STATEMENT_LIST_HEAD (i->container) = head; STATEMENT_LIST_TAIL (i->container) = tail; } @@ -210,8 +201,7 @@ tsi_link_after (tree_stmt_iterator *i, tree t, enum tsi_iterator_update mode) i->ptr = tail; break; case TSI_SAME_STMT: - if (!cur) - abort (); + gcc_assert (cur); break; } } @@ -254,8 +244,7 @@ tsi_split_statement_list_after (const tree_stmt_iterator *i) cur = i->ptr; /* How can we possibly split after the end, or before the beginning? */ - if (cur == NULL) - abort (); + gcc_assert (cur); next = cur->next; old_sl = i->container; @@ -282,8 +271,7 @@ tsi_split_statement_list_before (tree_stmt_iterator *i) cur = i->ptr; /* How can we possibly split after the end, or before the beginning? */ - if (cur == NULL) - abort (); + gcc_assert (cur); prev = cur->prev; old_sl = i->container; diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c index 55263e880d0..ba589f9f050 100644 --- a/gcc/tree-mudflap.c +++ b/gcc/tree-mudflap.c @@ -102,8 +102,7 @@ mf_varname_tree (tree decl) const char *buf_contents; tree result; - if (decl == NULL_TREE) - abort (); + gcc_assert (decl); if (!initialized) { diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c index 8d5017b2251..3b7e3c5d7ac 100644 --- a/gcc/tree-nested.c +++ b/gcc/tree-nested.c @@ -132,15 +132,12 @@ create_tmp_var_for (struct nesting_info *info, tree type, const char *prefix) { tree tmp_var; -#if defined ENABLE_CHECKING /* If the type is of variable size or a type which must be created by the frontend, something is wrong. Note that we explicitly allow incomplete types here, since we create them ourselves here. */ - if (TREE_ADDRESSABLE (type) - || (TYPE_SIZE_UNIT (type) - && TREE_CODE (TYPE_SIZE_UNIT (type)) != INTEGER_CST)) - abort (); -#endif + gcc_assert (TREE_ADDRESSABLE (type)); + gcc_assert (!TYPE_SIZE_UNIT (type) + || TREE_CODE (TYPE_SIZE_UNIT (type)) == INTEGER_CST); tmp_var = create_tmp_var_raw (type, prefix); DECL_CONTEXT (tmp_var) = info->context; @@ -249,8 +246,7 @@ lookup_field_for_decl (struct nesting_info *info, tree decl, slot = htab_find_slot (info->var_map, &dummy, insert); if (!slot) { - if (insert == INSERT) - abort (); + gcc_assert (insert != INSERT); return NULL; } elt = *slot; @@ -434,8 +430,7 @@ lookup_tramp_for_decl (struct nesting_info *info, tree decl, slot = htab_find_slot (info->var_map, &dummy, insert); if (!slot) { - if (insert == INSERT) - abort (); + gcc_assert (insert != INSERT); return NULL; } elt = *slot; @@ -1194,12 +1189,7 @@ convert_all_function_calls (struct nesting_info *root) if (root->outer && !root->chain_decl && !root->chain_field) DECL_NO_STATIC_CHAIN (root->context) = 1; else - { -#ifdef ENABLE_CHECKING - if (DECL_NO_STATIC_CHAIN (root->context)) - abort (); -#endif - } + gcc_assert (!DECL_NO_STATIC_CHAIN (root->context)); root = root->next; } diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c index 5ad189139c9..e1687af4fc0 100644 --- a/gcc/tree-optimize.c +++ b/gcc/tree-optimize.c @@ -555,8 +555,7 @@ tree_rest_of_compilation (tree fndecl, bool nested_p) timevar_push (TV_EXPAND); - if (flag_unit_at_a_time && !cgraph_global_info_ready) - abort (); + gcc_assert (!flag_unit_at_a_time || cgraph_global_info_ready); /* Initialize the RTL code for the function. */ current_function_decl = fndecl; diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c index c9403f0dd35..3910501f1ea 100644 --- a/gcc/tree-outof-ssa.c +++ b/gcc/tree-outof-ssa.c @@ -146,10 +146,8 @@ create_temp (tree t) if (TREE_CODE (t) == SSA_NAME) t = SSA_NAME_VAR (t); - - if (TREE_CODE (t) != VAR_DECL - && TREE_CODE (t) != PARM_DECL) - abort (); + + gcc_assert (TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == PARM_DECL); type = TREE_TYPE (t); tmp = DECL_NAME (t); @@ -368,8 +366,7 @@ eliminate_build (elim_graph g, basic_block B, int i) in the same order as all of the other PHI nodes. If they don't match, find the appropriate index here. */ pi = phi_arg_from_edge (phi, g->e); - if (pi == -1) - abort(); + gcc_assert (pi != -1); Ti = PHI_ARG_DEF (phi, pi); } @@ -496,12 +493,8 @@ eliminate_phi (edge e, int i, elim_graph g) int x; basic_block B = e->dest; -#if defined ENABLE_CHECKING - if (i == -1) - abort (); - if (VARRAY_ACTIVE_SIZE (g->const_copies) != 0) - abort (); -#endif + gcc_assert (i != -1); + gcc_assert (VARRAY_ACTIVE_SIZE (g->const_copies) == 0); /* Abnormal edges already have everything coalesced, or the coalescer would have aborted. */ @@ -609,59 +602,71 @@ coalesce_abnormal_edges (var_map map, conflict_graph graph, root_var_p rv) continue; y = phi_arg_from_edge (phi, e); - if (y == -1) - abort (); + gcc_assert (y != -1); tmp = PHI_ARG_DEF (phi, y); +#ifdef ENABLE_CHECKING if (!phi_ssa_name_p (tmp)) { print_exprs_edge (stderr, e, "\nConstant argument in PHI. Can't insert :", var, " = ", tmp); - abort (); + internal_error ("SSA corruption"); } +#else + gcc_assert (phi_ssa_name (tmp)); +#endif y = var_to_partition (map, tmp); - if (x == NO_PARTITION || y == NO_PARTITION) - abort (); + gcc_assert (x != NO_PARTITION); + gcc_assert (y != NO_PARTITION); +#ifdef ENABLE_CHECKING if (root_var_find (rv, x) != root_var_find (rv, y)) { print_exprs_edge (stderr, e, "\nDifferent root vars: ", root_var (rv, root_var_find (rv, x)), " and ", root_var (rv, root_var_find (rv, y))); - abort (); + internal_error ("SSA corruption"); } +#else + gcc_assert (root_var_find (rv, x) == root_var_find (rv, y)); +#endif if (x != y) { - if (!conflict_graph_conflict_p (graph, x, y)) - { - /* Now map the partitions back to their real variables. */ - var = partition_to_var (map, x); - tmp = partition_to_var (map, y); - if (dump_file - && (dump_flags & TDF_DETAILS)) - { - print_exprs_edge (dump_file, e, - "ABNORMAL: Coalescing ", - var, " and ", tmp); - } - if (var_union (map, var, tmp) == NO_PARTITION) - { - print_exprs_edge (stderr, e, "\nUnable to coalesce", - partition_to_var (map, x), " and ", - partition_to_var (map, y)); - abort (); - } - conflict_graph_merge_regs (graph, x, y); - } - else +#ifdef ENABLE_CHECKING + if (conflict_graph_conflict_p (graph, x, y)) { print_exprs_edge (stderr, e, "\n Conflict ", partition_to_var (map, x), " and ", partition_to_var (map, y)); - abort (); + internal_error ("SSA corruption"); } +#else + gcc_assert (!conflict_graph_conflict_p (graph, x, y)); +#endif + + /* Now map the partitions back to their real variables. */ + var = partition_to_var (map, x); + tmp = partition_to_var (map, y); + if (dump_file && (dump_flags & TDF_DETAILS)) + { + print_exprs_edge (dump_file, e, + "ABNORMAL: Coalescing ", + var, " and ", tmp); + } +#ifdef ENABLE_CHECKING + if (var_union (map, var, tmp) == NO_PARTITION) + { + print_exprs_edge (stderr, e, "\nUnable to coalesce", + partition_to_var (map, x), " and ", + partition_to_var (map, y)); + internal_error ("SSA corruption"); + } +#else + gcc_assert (var_union (map, var, tmp) != NO_PARTITION); +#endif + conflict_graph_merge_regs (graph, x, y); } } } @@ -801,12 +806,9 @@ coalesce_ssa_name (var_map map, int flags) /* If these aren't already coalesced... */ if (partition_to_var (map, x) != var) { - if (ann->out_of_ssa_tag) - { - /* This root variable has already been assigned to another - partition which is not coalesced with this one. */ - abort (); - } + /* This root variable should have not already been assigned + to another partition which is not coalesced with this one. */ + gcc_assert (!ann->out_of_ssa_tag); if (dump_file && (dump_flags & TDF_DETAILS)) { @@ -1032,7 +1034,7 @@ eliminate_virtual_phis (void) print_generic_expr (stderr, arg, TDF_SLIM); fprintf (stderr, "), but the result is :"); print_generic_stmt (stderr, phi, TDF_SLIM); - abort(); + internal_error ("SSA corruption"); } } #endif @@ -1279,7 +1281,7 @@ free_temp_expr_table (temp_expr_table_p t) int x; for (x = 0; x <= num_var_partitions (t->map); x++) if (t->partition_dep_list[x] != NULL) - abort(); + gcc_unreachable (); #endif while ((p = t->free_list)) @@ -1438,10 +1440,7 @@ add_dependance (temp_expr_table_p tab, int version, tree var) else { i = var_to_partition (tab->map, var); -#ifdef ENABLE_CHECKING - if (i== NO_PARTITION) - abort (); -#endif + gcc_assert (i != NO_PARTITION); add_value_to_list (tab, &(tab->partition_dep_list[i]), version); add_value_to_list (tab, (value_expr_p *)&(tab->version_info[version]), i); @@ -1548,16 +1547,10 @@ finish_expr (temp_expr_table_p tab, int version, bool replace) for (info = (value_expr_p) tab->version_info[version]; info; info = tmp) { partition = info->value; -#ifdef ENABLE_CHECKING - if (tab->partition_dep_list[partition] == NULL) - abort (); -#endif + gcc_assert (tab->partition_dep_list[partition]); tmp = remove_value_from_list (&(tab->partition_dep_list[partition]), version); -#ifdef ENABLE_CHECKING - if (!tmp) - abort (); -#endif + gcc_assert (tmp); free_value_expr (tab, tmp); /* Only clear the bit when the dependency list is emptied via a replacement. Otherwise kill_expr will take care of it. */ @@ -1575,10 +1568,7 @@ finish_expr (temp_expr_table_p tab, int version, bool replace) } else { -#ifdef ENABLE_CHECKING - if (bitmap_bit_p (tab->replaceable, version)) - abort (); -#endif + gcc_assert (!bitmap_bit_p (tab->replaceable, version)); tab->version_info[version] = NULL; } } @@ -1858,7 +1848,7 @@ rewrite_trees (var_map map, tree *values) print_generic_expr (stderr, arg, TDF_SLIM); fprintf (stderr, "), but the result is not :"); print_generic_stmt (stderr, phi, TDF_SLIM); - abort(); + internal_error ("SSA corruption"); } } } diff --git a/gcc/tree-phinodes.c b/gcc/tree-phinodes.c index 5bf77360601..712e3f91c7a 100644 --- a/gcc/tree-phinodes.c +++ b/gcc/tree-phinodes.c @@ -235,12 +235,9 @@ resize_phi_node (tree *phi, int len) int size, old_size; tree new_phi; int i, old_len, bucket = NUM_BUCKETS - 2; - -#ifdef ENABLE_CHECKING - if (len < PHI_ARG_CAPACITY (*phi)) - abort (); -#endif - + + gcc_assert (len >= PHI_ARG_CAPACITY (*phi)); + /* Note that OLD_SIZE is guaranteed to be smaller than SIZE. */ old_size = (sizeof (struct tree_phi_node) + (PHI_ARG_CAPACITY (*phi) - 1) * sizeof (struct phi_arg_d)); @@ -357,9 +354,7 @@ add_phi_arg (tree *phi, tree def, edge e) p = PHI_CHAIN (p)) ; - if (!p) - abort (); - + gcc_assert (p); PHI_CHAIN (p) = *phi; } } @@ -524,8 +519,7 @@ remove_all_phi_nodes_for (bitmap vars) for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi)) { tree var = SSA_NAME_VAR (PHI_RESULT (phi)); - if (bitmap_bit_p (vars, var_ann (var)->uid)) - abort (); + gcc_assert (!bitmap_bit_p (vars, var_ann (var)->uid)); } #endif } diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 0d1e540a3b8..af3a0294626 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -1744,8 +1744,7 @@ op_prio (tree op) static const char * op_symbol (tree op) { - if (op == NULL) - abort (); + gcc_assert (op); switch (TREE_CODE (op)) { @@ -1882,8 +1881,7 @@ print_call_name (pretty_printer *buffer, tree node) { tree op0; - if (TREE_CODE (node) != CALL_EXPR) - abort (); + gcc_assert (TREE_CODE (node) == CALL_EXPR); op0 = TREE_OPERAND (node, 0); diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c index 582a6ec1d44..29299e53cca 100644 --- a/gcc/tree-profile.c +++ b/gcc/tree-profile.c @@ -99,7 +99,10 @@ tree_gen_interval_profiler (histogram_value value ATTRIBUTE_UNUSED, unsigned base ATTRIBUTE_UNUSED) { /* FIXME implement this. */ - abort (); +#ifdef ENABLE_CHECKING + internal_error ("unimplemented functionality"); +#endif + gcc_unreachable (); } /* Output instructions as GIMPLE trees to increment the power of two histogram @@ -112,7 +115,10 @@ tree_gen_pow2_profiler (histogram_value value ATTRIBUTE_UNUSED, unsigned base ATTRIBUTE_UNUSED) { /* FIXME implement this. */ - abort (); +#ifdef ENABLE_CHECKING + internal_error ("unimplemented functionality"); +#endif + gcc_unreachable (); } /* Output instructions as GIMPLE trees for code to find the most common value. @@ -125,7 +131,10 @@ tree_gen_one_value_profiler (histogram_value value ATTRIBUTE_UNUSED, unsigned base ATTRIBUTE_UNUSED) { /* FIXME implement this. */ - abort (); +#ifdef ENABLE_CHECKING + internal_error ("unimplemented functionality"); +#endif + gcc_unreachable (); } /* Output instructions as GIMPLE trees for code to find the most common value @@ -139,7 +148,10 @@ tree_gen_const_delta_profiler (histogram_value value ATTRIBUTE_UNUSED, unsigned base ATTRIBUTE_UNUSED) { /* FIXME implement this. */ - abort (); +#ifdef ENABLE_CHECKING + internal_error ("unimplemented functionality"); +#endif + gcc_unreachable (); } /* Return 1 if tree-based profiling is in effect, else 0. diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 3e3da790203..b8ec2e1ff89 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -329,7 +329,7 @@ type_can_instantiate_all_elements (tree type) return true; default: - abort (); + gcc_unreachable (); } } @@ -379,7 +379,7 @@ sra_hash_tree (tree t) break; default: - abort (); + gcc_unreachable (); } return h; @@ -446,7 +446,7 @@ sra_elt_eq (const void *x, const void *y) return fields_compatible_p (ae, be); default: - abort (); + gcc_unreachable (); } } @@ -744,8 +744,7 @@ sra_walk_expr (tree *expr_p, block_stmt_iterator *bsi, bool is_output, default: #ifdef ENABLE_CHECKING /* Validate that we're not missing any references. */ - if (walk_tree (&inner, sra_find_candidate_decl, NULL, NULL)) - abort (); + gcc_assert (!walk_tree (&inner, sra_find_candidate_decl, NULL, NULL)); #endif return; } @@ -1246,7 +1245,7 @@ instantiate_missing_elements (struct sra_elt *elt) break; default: - abort (); + gcc_unreachable (); } } @@ -1438,7 +1437,7 @@ generate_one_element_ref (struct sra_elt *elt, tree base) return build (IMAGPART_EXPR, elt->type, base); default: - abort (); + gcc_unreachable (); } } @@ -1495,8 +1494,7 @@ generate_element_copy (struct sra_elt *dst, struct sra_elt *src, tree *list_p) for (dc = dst->children; dc ; dc = dc->sibling) { sc = lookup_element (src, dc->element, NULL, NO_INSERT); - if (sc == NULL) - abort (); + gcc_assert (sc); generate_element_copy (dc, sc, list_p); } @@ -1504,8 +1502,7 @@ generate_element_copy (struct sra_elt *dst, struct sra_elt *src, tree *list_p) { tree t; - if (src->replacement == NULL) - abort (); + gcc_assert (src->replacement); t = build (MODIFY_EXPR, void_type_node, dst->replacement, src->replacement); @@ -1536,11 +1533,8 @@ generate_element_zero (struct sra_elt *elt, tree *list_p) { tree t; - if (elt->is_scalar) - t = build_int_cst (elt->type, 0); - else - /* We generated a replacement for a non-scalar? */ - abort (); + gcc_assert (elt->is_scalar); + t = build_int_cst (elt->type, 0); t = build (MODIFY_EXPR, void_type_node, elt->replacement, t); append_to_statement_list (t, list_p); @@ -1788,12 +1782,9 @@ scalarize_copy (struct sra_elt *lhs_elt, struct sra_elt *rhs_elt, /* If we have two scalar operands, modify the existing statement. */ stmt = bsi_stmt (*bsi); -#ifdef ENABLE_CHECKING /* See the commentary in sra_walk_function concerning RETURN_EXPR, and why we should never see one here. */ - if (TREE_CODE (stmt) != MODIFY_EXPR) - abort (); -#endif + gcc_assert (TREE_CODE (stmt) == MODIFY_EXPR); TREE_OPERAND (stmt, 0) = lhs_elt->replacement; TREE_OPERAND (stmt, 1) = rhs_elt->replacement; @@ -1835,8 +1826,7 @@ scalarize_copy (struct sra_elt *lhs_elt, struct sra_elt *rhs_elt, list = NULL; generate_element_copy (lhs_elt, rhs_elt, &list); - if (list == NULL) - abort (); + gcc_assert (list); sra_replace (bsi, list); } } @@ -1894,8 +1884,7 @@ scalarize_init (struct sra_elt *lhs_elt, tree rhs, block_stmt_iterator *bsi) { /* The LHS is fully instantiated. The list of initializations replaces the original structure assignment. */ - if (!list) - abort (); + gcc_assert (list); mark_all_v_defs (bsi_stmt (*bsi)); sra_replace (bsi, list); } @@ -1929,8 +1918,7 @@ scalarize_ldst (struct sra_elt *elt, tree other, block_stmt_iterator *bsi, bool is_output) { /* Shouldn't have gotten called for a scalar. */ - if (elt->replacement) - abort (); + gcc_assert (!elt->replacement); if (elt->use_block_copy) { @@ -1948,8 +1936,7 @@ scalarize_ldst (struct sra_elt *elt, tree other, mark_all_v_defs (stmt); generate_copy_inout (elt, is_output, other, &list); - if (list == NULL) - abort (); + gcc_assert (list); /* Preserve EH semantics. */ if (stmt_ends_bb_p (stmt)) diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 4bd438b9439..70a45257066 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -486,10 +486,7 @@ delete_alias_info (struct alias_info *ai) static void collect_points_to_info_for (struct alias_info *ai, tree ptr) { -#if defined ENABLE_CHECKING - if (!POINTER_TYPE_P (TREE_TYPE (ptr))) - abort (); -#endif + gcc_assert (POINTER_TYPE_P (TREE_TYPE (ptr))); if (!bitmap_bit_p (ai->ssa_names_visited, SSA_NAME_VERSION (ptr))) { @@ -1207,10 +1204,8 @@ group_aliases (struct alias_info *ai) { tree new_alias; -#if defined ENABLE_CHECKING - if (VARRAY_ACTIVE_SIZE (ann->may_aliases) != 1) - abort (); -#endif + gcc_assert (VARRAY_ACTIVE_SIZE (ann->may_aliases) == 1); + new_alias = VARRAY_TREE (ann->may_aliases, 0); replace_may_alias (name_tag, j, new_alias); } @@ -1546,10 +1541,7 @@ may_alias_p (tree ptr, HOST_WIDE_INT mem_alias_set, v_ann = var_ann (var); m_ann = var_ann (mem); -#if defined ENABLE_CHECKING - if (m_ann->mem_tag_kind != TYPE_TAG) - abort (); -#endif + gcc_assert (m_ann->mem_tag_kind == TYPE_TAG); alias_stats.tbaa_queries++; @@ -1652,10 +1644,7 @@ add_may_alias (tree var, tree alias) var_ann_t v_ann = get_var_ann (var); var_ann_t a_ann = get_var_ann (alias); -#if defined ENABLE_CHECKING - if (var == alias) - abort (); -#endif + gcc_assert (var != alias); if (v_ann->may_aliases == NULL) VARRAY_TREE_INIT (v_ann->may_aliases, 2, "aliases"); @@ -1790,12 +1779,9 @@ add_pointed_to_expr (tree ptr, tree value) if (TREE_CODE (value) == WITH_SIZE_EXPR) value = TREE_OPERAND (value, 0); -#if defined ENABLE_CHECKING /* Pointer variables should have been handled by merge_pointed_to_info. */ - if (TREE_CODE (value) == SSA_NAME - && POINTER_TYPE_P (TREE_TYPE (value))) - abort (); -#endif + gcc_assert (TREE_CODE (value) != SSA_NAME + || !POINTER_TYPE_P (TREE_TYPE (value))); get_ptr_info (ptr); @@ -1835,10 +1821,7 @@ add_pointed_to_var (struct alias_info *ai, tree ptr, tree value) tree pt_var; size_t uid; -#if defined ENABLE_CHECKING - if (TREE_CODE (value) != ADDR_EXPR) - abort (); -#endif + gcc_assert (TREE_CODE (value) == ADDR_EXPR); pt_var = TREE_OPERAND (value, 0); if (TREE_CODE_CLASS (TREE_CODE (pt_var)) == 'r') @@ -1883,95 +1866,109 @@ collect_points_to_info_r (tree var, tree stmt, void *data) fprintf (dump_file, "\n"); } - if (TREE_CODE (stmt) == MODIFY_EXPR) + switch (TREE_CODE (stmt)) { - tree rhs = TREE_OPERAND (stmt, 1); - STRIP_NOPS (rhs); - - /* Found P_i = ADDR_EXPR */ - if (TREE_CODE (rhs) == ADDR_EXPR) - add_pointed_to_var (ai, var, rhs); - - /* Found P_i = Q_j. */ - else if (TREE_CODE (rhs) == SSA_NAME - && POINTER_TYPE_P (TREE_TYPE (rhs))) - merge_pointed_to_info (ai, var, rhs); + case MODIFY_EXPR: + { + tree rhs = TREE_OPERAND (stmt, 1); + STRIP_NOPS (rhs); - /* Found P_i = PLUS_EXPR or P_i = MINUS_EXPR */ - else if (TREE_CODE (rhs) == PLUS_EXPR - || TREE_CODE (rhs) == MINUS_EXPR) - { - tree op0 = TREE_OPERAND (rhs, 0); - tree op1 = TREE_OPERAND (rhs, 1); + /* Found P_i = ADDR_EXPR */ + if (TREE_CODE (rhs) == ADDR_EXPR) + add_pointed_to_var (ai, var, rhs); - /* Both operands may be of pointer type. FIXME: Shouldn't - we just expect PTR + OFFSET always? */ - if (POINTER_TYPE_P (TREE_TYPE (op0))) - { - if (TREE_CODE (op0) == SSA_NAME) - merge_pointed_to_info (ai, var, op0); - else if (TREE_CODE (op0) == ADDR_EXPR) - add_pointed_to_var (ai, var, op0); - else - add_pointed_to_expr (var, op0); - } - - if (POINTER_TYPE_P (TREE_TYPE (op1))) - { - if (TREE_CODE (op1) == SSA_NAME) - merge_pointed_to_info (ai, var, op1); - else if (TREE_CODE (op1) == ADDR_EXPR) - add_pointed_to_var (ai, var, op1); - else - add_pointed_to_expr (var, op1); - } + /* Found P_i = Q_j. */ + else if (TREE_CODE (rhs) == SSA_NAME + && POINTER_TYPE_P (TREE_TYPE (rhs))) + merge_pointed_to_info (ai, var, rhs); - /* Neither operand is a pointer? VAR can be pointing - anywhere. FIXME: Is this right? If we get here, we - found PTR = INT_CST + INT_CST. */ - if (!POINTER_TYPE_P (TREE_TYPE (op0)) - && !POINTER_TYPE_P (TREE_TYPE (op1))) - add_pointed_to_expr (var, rhs); - } + /* Found P_i = PLUS_EXPR or P_i = MINUS_EXPR */ + else if (TREE_CODE (rhs) == PLUS_EXPR + || TREE_CODE (rhs) == MINUS_EXPR) + { + tree op0 = TREE_OPERAND (rhs, 0); + tree op1 = TREE_OPERAND (rhs, 1); + + /* Both operands may be of pointer type. FIXME: Shouldn't + we just expect PTR + OFFSET always? */ + if (POINTER_TYPE_P (TREE_TYPE (op0))) + { + if (TREE_CODE (op0) == SSA_NAME) + merge_pointed_to_info (ai, var, op0); + else if (TREE_CODE (op0) == ADDR_EXPR) + add_pointed_to_var (ai, var, op0); + else + add_pointed_to_expr (var, op0); + } + + if (POINTER_TYPE_P (TREE_TYPE (op1))) + { + if (TREE_CODE (op1) == SSA_NAME) + merge_pointed_to_info (ai, var, op1); + else if (TREE_CODE (op1) == ADDR_EXPR) + add_pointed_to_var (ai, var, op1); + else + add_pointed_to_expr (var, op1); + } + + /* Neither operand is a pointer? VAR can be pointing + anywhere. FIXME: Is this right? If we get here, we + found PTR = INT_CST + INT_CST. */ + if (!POINTER_TYPE_P (TREE_TYPE (op0)) + && !POINTER_TYPE_P (TREE_TYPE (op1))) + add_pointed_to_expr (var, rhs); + } - /* Something else. */ - else - add_pointed_to_expr (var, rhs); - } - else if (TREE_CODE (stmt) == ASM_EXPR) - { + /* Something else. */ + else + add_pointed_to_expr (var, rhs); + break; + } + case ASM_EXPR: /* Pointers defined by __asm__ statements can point anywhere. */ set_pt_anything (var); - } - else if (IS_EMPTY_STMT (stmt)) - { - tree decl = SSA_NAME_VAR (var); + break; - if (TREE_CODE (decl) == PARM_DECL) - add_pointed_to_expr (var, decl); - else if (DECL_INITIAL (decl)) - add_pointed_to_var (ai, var, DECL_INITIAL (decl)); - else - add_pointed_to_expr (var, decl); - } - else if (TREE_CODE (stmt) == PHI_NODE) - { - /* It STMT is a PHI node, then VAR is one of its arguments. The - variable that we are analyzing is the LHS of the PHI node. */ - tree lhs = PHI_RESULT (stmt); - - if (TREE_CODE (var) == ADDR_EXPR) - add_pointed_to_var (ai, lhs, var); - else if (TREE_CODE (var) == SSA_NAME) - merge_pointed_to_info (ai, lhs, var); - else if (is_gimple_min_invariant (var)) - add_pointed_to_expr (lhs, var); - else - abort (); - } - else - abort (); + case NOP_EXPR: + if (IS_EMPTY_STMT (stmt)) + { + tree decl = SSA_NAME_VAR (var); + + if (TREE_CODE (decl) == PARM_DECL) + add_pointed_to_expr (var, decl); + else if (DECL_INITIAL (decl)) + add_pointed_to_var (ai, var, DECL_INITIAL (decl)); + else + add_pointed_to_expr (var, decl); + } + break; + case PHI_NODE: + { + /* It STMT is a PHI node, then VAR is one of its arguments. The + variable that we are analyzing is the LHS of the PHI node. */ + tree lhs = PHI_RESULT (stmt); + switch (TREE_CODE (var)) + { + case ADDR_EXPR: + add_pointed_to_var (ai, lhs, var); + break; + + case SSA_NAME: + merge_pointed_to_info (ai, lhs, var); + break; + + default: + gcc_assert (is_gimple_min_invariant (var)); + add_pointed_to_expr (lhs, var); + break; + } + break; + } + default: + gcc_unreachable (); + } + return false; } @@ -2154,13 +2151,9 @@ get_tmt_for (tree ptr, struct alias_info *ai) ai->pointers[ai->num_pointers++] = alias_map; } -#if defined ENABLE_CHECKING /* Make sure that the type tag has the same alias set as the pointed-to type. */ - if (tag_set != get_alias_set (tag)) - abort (); -#endif - + gcc_assert (tag_set == get_alias_set (tag)); return tag; } @@ -2297,10 +2290,7 @@ get_ptr_info (tree t) { struct ptr_info_def *pi; -#if defined ENABLE_CHECKING - if (!POINTER_TYPE_P (TREE_TYPE (t))) - abort (); -#endif + gcc_assert (POINTER_TYPE_P (TREE_TYPE (t))); pi = SSA_NAME_PTR_INFO (t); if (pi == NULL) diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index b1b74b1e68f..ddde45ddc5e 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -99,7 +99,7 @@ dump_lattice_value (FILE *outf, const char *prefix, value val) print_generic_expr (outf, val.const_val, dump_flags); break; default: - abort (); + gcc_unreachable (); } } @@ -128,10 +128,7 @@ get_default_value (tree var) sym = SSA_NAME_VAR (var); else { -#ifdef ENABLE_CHECKING - if (!DECL_P (var)) - abort (); -#endif + gcc_assert (DECL_P (var)); sym = var; } @@ -188,10 +185,7 @@ get_value (tree var) { value *val; -#if defined ENABLE_CHECKING - if (TREE_CODE (var) != SSA_NAME) - abort (); -#endif + gcc_assert (TREE_CODE (var) == SSA_NAME); val = &value_vector[SSA_NAME_VERSION (var)]; if (val->lattice_val == UNINITIALIZED) @@ -209,32 +203,24 @@ set_lattice_value (tree var, value val) { value *old = get_value (var); -#ifdef ENABLE_CHECKING if (val.lattice_val == UNDEFINED) { /* CONSTANT->UNDEFINED is never a valid state transition. */ - if (old->lattice_val == CONSTANT) - abort (); + gcc_assert (old->lattice_val != CONSTANT); /* UNKNOWN_VAL->UNDEFINED is never a valid state transition. */ - if (old->lattice_val == UNKNOWN_VAL) - abort (); + gcc_assert (old->lattice_val != UNKNOWN_VAL); /* VARYING->UNDEFINED is generally not a valid state transition, except for values which are initialized to VARYING. */ - if (old->lattice_val == VARYING - && get_default_value (var).lattice_val != VARYING) - abort (); + gcc_assert (old->lattice_val != VARYING + || get_default_value (var).lattice_val == VARYING); } else if (val.lattice_val == CONSTANT) - { - /* VARYING -> CONSTANT is an invalid state transition, except - for objects which start off in a VARYING state. */ - if (old->lattice_val == VARYING - && get_default_value (var).lattice_val != VARYING) - abort (); - } -#endif + /* VARYING -> CONSTANT is an invalid state transition, except + for objects which start off in a VARYING state. */ + gcc_assert (old->lattice_val == VARYING + || get_default_value (var).lattice_val != VARYING); /* If the constant for VAR has changed, then this VAR is really varying. */ if (old->lattice_val == CONSTANT @@ -326,11 +312,8 @@ likely_value (tree stmt) if (val->lattice_val == UNKNOWN_VAL) return UNKNOWN_VAL; -#ifdef ENABLE_CHECKING - /* There should be no VUSE operands that are UNDEFINED. */ - if (val->lattice_val == UNDEFINED) - abort (); -#endif + /* There should be no VUSE operands that are UNDEFINED. */ + gcc_assert (val->lattice_val != UNDEFINED); if (val->lattice_val == CONSTANT) found_constant = 1; @@ -719,7 +702,7 @@ ccp_visit_phi_node (tree phi) break; default: - abort (); + gcc_unreachable (); } for (i = 0; i < PHI_NUM_ARGS (phi); i++) @@ -1016,12 +999,9 @@ visit_assignment (tree stmt, tree *output_p) vuses = STMT_VUSE_OPS (stmt); v_must_defs = STMT_V_MUST_DEF_OPS (stmt); -#if defined ENABLE_CHECKING - if (NUM_V_MAY_DEFS (STMT_V_MAY_DEF_OPS (stmt)) > 0 - || (NUM_V_MUST_DEFS (v_must_defs) != 1 - && TREE_CODE (lhs) != SSA_NAME)) - abort (); -#endif + gcc_assert (NUM_V_MAY_DEFS (STMT_V_MAY_DEF_OPS (stmt)) == 0); + gcc_assert (NUM_V_MUST_DEFS (v_must_defs) == 1 + || TREE_CODE (lhs) == SSA_NAME); /* We require the SSA version number of the lhs for the value_vector. Make sure we have it. */ @@ -1250,10 +1230,7 @@ widen_bitfield (tree val, tree field, tree var) if (field_size > HOST_BITS_PER_WIDE_INT || var_size > HOST_BITS_PER_WIDE_INT) return NULL_TREE; -#if defined ENABLE_CHECKING - if (var_size < field_size) - abort (); -#endif + gcc_assert (var_size >= field_size); /* If the sign bit of the value is not set or the field's type is unsigned, just mask off the high order bits of the value. */ @@ -2000,7 +1977,7 @@ ccp_fold_builtin (tree stmt, tree fn) break; default: - abort (); + gcc_unreachable (); } if (result && ignore) diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c index 1a760ecf2ee..7b27c68b1bd 100644 --- a/gcc/tree-ssa-copy.c +++ b/gcc/tree-ssa-copy.c @@ -131,8 +131,7 @@ may_propagate_copy (tree dest, tree orig) #ifdef ENABLE_CHECKING /* If we have one real and one virtual operand, then something has gone terribly wrong. */ - if (is_gimple_reg (orig)) - abort (); + gcc_assert (!is_gimple_reg (orig)); #endif } @@ -170,18 +169,17 @@ merge_alias_info (tree orig, tree new) var_ann_t new_ann = var_ann (new_sym); var_ann_t orig_ann = var_ann (orig_sym); + gcc_assert (POINTER_TYPE_P (TREE_TYPE (orig))); + gcc_assert (POINTER_TYPE_P (TREE_TYPE (new))); #if defined ENABLE_CHECKING - if (!POINTER_TYPE_P (TREE_TYPE (orig)) - || !POINTER_TYPE_P (TREE_TYPE (new)) - || !lang_hooks.types_compatible_p (TREE_TYPE (orig), TREE_TYPE (new))) - abort (); + gcc_assert (lang_hooks.types_compatible_p (TREE_TYPE (orig), + TREE_TYPE (new))); /* If the pointed-to alias sets are different, these two pointers would never have the same memory tag. In this case, NEW should not have been propagated into ORIG. */ - if (get_alias_set (TREE_TYPE (TREE_TYPE (new_sym))) - != get_alias_set (TREE_TYPE (TREE_TYPE (orig_sym)))) - abort (); + gcc_assert (get_alias_set (TREE_TYPE (TREE_TYPE (new_sym))) + == get_alias_set (TREE_TYPE (TREE_TYPE (orig_sym)))); #endif /* Merge type-based alias info. */ @@ -189,8 +187,8 @@ merge_alias_info (tree orig, tree new) new_ann->type_mem_tag = orig_ann->type_mem_tag; else if (orig_ann->type_mem_tag == NULL_TREE) orig_ann->type_mem_tag = new_ann->type_mem_tag; - else if (new_ann->type_mem_tag != orig_ann->type_mem_tag) - abort (); + else + gcc_assert (new_ann->type_mem_tag == orig_ann->type_mem_tag); } @@ -206,11 +204,10 @@ replace_exp_1 (use_operand_p op_p, tree val, tree op = USE_FROM_PTR (op_p); #if defined ENABLE_CHECKING - if (for_propagation - && TREE_CODE (op) == SSA_NAME - && TREE_CODE (val) == SSA_NAME - && !may_propagate_copy (op, val)) - abort (); + gcc_assert (!(for_propagation + && TREE_CODE (op) == SSA_NAME + && TREE_CODE (val) == SSA_NAME + && !may_propagate_copy (op, val))); #endif if (TREE_CODE (val) == SSA_NAME) @@ -249,10 +246,9 @@ void propagate_tree_value (tree *op_p, tree val) { #if defined ENABLE_CHECKING - if (TREE_CODE (val) == SSA_NAME - && TREE_CODE (*op_p) == SSA_NAME - && !may_propagate_copy (*op_p, val)) - abort (); + gcc_assert (!(TREE_CODE (val) == SSA_NAME + && TREE_CODE (*op_p) == SSA_NAME + && !may_propagate_copy (*op_p, val))); #endif if (TREE_CODE (val) == SSA_NAME) diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c index db85d9c0162..e38b77ac494 100644 --- a/gcc/tree-ssa-copyrename.c +++ b/gcc/tree-ssa-copyrename.c @@ -120,10 +120,8 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) var_ann_t ann1, ann2, ann3; bool ign1, ign2; -#ifdef ENABLE_CHECKING - if (TREE_CODE (var1) != SSA_NAME || TREE_CODE (var2) != SSA_NAME) - abort (); -#endif + gcc_assert (TREE_CODE (var1) == SSA_NAME); + gcc_assert (TREE_CODE (var2) == SSA_NAME); register_ssa_partition (map, var1, false); register_ssa_partition (map, var2, true); @@ -140,10 +138,8 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) fprintf (debug, "(P%d)", p2); } -#ifdef ENABLE_CHECKING - if (p1 == NO_PARTITION || p2 == NO_PARTITION) - abort (); -#endif + gcc_assert (p1 != NO_PARTITION); + gcc_assert (p2 != NO_PARTITION); root1 = SSA_NAME_VAR (partition_to_var (map, p1)); root2 = SSA_NAME_VAR (partition_to_var (map, p2)); diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index b1d9365a8cb..ccfa0f5c324 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -127,8 +127,7 @@ set_control_dependence_map_bit (basic_block bb, int edge_index) { if (bb == ENTRY_BLOCK_PTR) return; - if (bb == EXIT_BLOCK_PTR) - abort (); + gcc_assert (bb != EXIT_BLOCK_PTR); bitmap_set_bit (control_dependence_map[bb->index], edge_index); } @@ -160,10 +159,7 @@ find_control_dependence (struct edge_list *el, int edge_index) basic_block current_block; basic_block ending_block; -#ifdef ENABLE_CHECKING - if (INDEX_EDGE_PRED_BB (el, edge_index) == EXIT_BLOCK_PTR) - abort (); -#endif + gcc_assert (INDEX_EDGE_PRED_BB (el, edge_index) != EXIT_BLOCK_PTR); if (INDEX_EDGE_PRED_BB (el, edge_index) == ENTRY_BLOCK_PTR) ending_block = ENTRY_BLOCK_PTR->next_bb; @@ -192,9 +188,9 @@ find_control_dependence (struct edge_list *el, int edge_index) static inline basic_block find_pdom (basic_block block) { - if (block == ENTRY_BLOCK_PTR) - abort (); - else if (block == EXIT_BLOCK_PTR) + gcc_assert (block != ENTRY_BLOCK_PTR); + + if (block == EXIT_BLOCK_PTR) return EXIT_BLOCK_PTR; else { @@ -212,12 +208,9 @@ find_pdom (basic_block block) static inline void mark_stmt_necessary (tree stmt, bool add_to_worklist) { -#ifdef ENABLE_CHECKING - if (stmt == NULL - || stmt == error_mark_node - || (stmt && DECL_P (stmt))) - abort (); -#endif + gcc_assert (stmt); + gcc_assert (stmt != error_mark_node); + gcc_assert (!DECL_P (stmt)); if (NECESSARY (stmt)) return; @@ -242,10 +235,7 @@ mark_operand_necessary (tree op) tree stmt; int ver; -#ifdef ENABLE_CHECKING - if (op == NULL) - abort (); -#endif + gcc_assert (op); ver = SSA_NAME_VERSION (op); if (TEST_BIT (processed, ver)) @@ -253,10 +243,7 @@ mark_operand_necessary (tree op) SET_BIT (processed, ver); stmt = SSA_NAME_DEF_STMT (op); -#ifdef ENABLE_CHECKING - if (stmt == NULL) - abort (); -#endif + gcc_assert (stmt); if (NECESSARY (stmt) || IS_EMPTY_STMT (stmt)) @@ -387,10 +374,7 @@ mark_stmt_if_obviously_necessary (tree stmt, bool aggressive) { tree lhs; -#if defined ENABLE_CHECKING - if (TREE_CODE (stmt) != MODIFY_EXPR) - abort (); -#endif + gcc_assert (TREE_CODE (stmt) == MODIFY_EXPR); /* Note that we must not check the individual virtual operands here. In particular, if this is an aliased store, we could @@ -451,7 +435,7 @@ mark_stmt_if_obviously_necessary (tree stmt, bool aggressive) } } else - abort (); + gcc_unreachable (); } return; @@ -526,10 +510,7 @@ mark_control_dependent_edges_necessary (basic_block bb, struct edge_list *el) { int edge_number; -#ifdef ENABLE_CHECKING - if (bb == EXIT_BLOCK_PTR) - abort (); -#endif + gcc_assert (bb != EXIT_BLOCK_PTR); if (bb == ENTRY_BLOCK_PTR) return; @@ -742,11 +723,8 @@ remove_dead_stmt (block_stmt_iterator *i, basic_block bb) { basic_block post_dom_bb; edge e; -#ifdef ENABLE_CHECKING /* The post dominance info has to be up-to-date. */ - if (dom_computed[CDI_POST_DOMINATORS] != DOM_OK) - abort (); -#endif + gcc_assert (dom_computed[CDI_POST_DOMINATORS] == DOM_OK); /* Get the immediate post dominator of bb. */ post_dom_bb = get_immediate_dominator (CDI_POST_DOMINATORS, bb); /* Some blocks don't have an immediate post dominator. This can happen diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index c644e4a786d..7b1c3ac783f 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -715,7 +715,6 @@ dom_opt_initialize_block_local_data (struct dom_walk_data *walk_data ATTRIBUTE_U basic_block bb ATTRIBUTE_UNUSED, bool recycled ATTRIBUTE_UNUSED) { -#ifdef ENABLE_CHECKING struct dom_walk_block_data *bd = (struct dom_walk_block_data *)VARRAY_TOP_GENERIC_PTR (walk_data->block_data_stack); @@ -725,20 +724,19 @@ dom_opt_initialize_block_local_data (struct dom_walk_data *walk_data ATTRIBUTE_U make sure we clear them before using them! */ if (recycled) { - if (bd->avail_exprs && VARRAY_ACTIVE_SIZE (bd->avail_exprs) > 0) - abort (); - if (bd->const_and_copies && VARRAY_ACTIVE_SIZE (bd->const_and_copies) > 0) - abort (); - if (bd->nonzero_vars && VARRAY_ACTIVE_SIZE (bd->nonzero_vars) > 0) - abort (); - if (bd->stmts_to_rescan && VARRAY_ACTIVE_SIZE (bd->stmts_to_rescan) > 0) - abort (); - if (bd->vrp_variables && VARRAY_ACTIVE_SIZE (bd->vrp_variables) > 0) - abort (); - if (bd->block_defs && VARRAY_ACTIVE_SIZE (bd->block_defs) > 0) - abort (); + gcc_assert (!bd->avail_exprs + || VARRAY_ACTIVE_SIZE (bd->avail_exprs) == 0); + gcc_assert (!bd->const_and_copies + || VARRAY_ACTIVE_SIZE (bd->const_and_copies) == 0); + gcc_assert (!bd->nonzero_vars + || VARRAY_ACTIVE_SIZE (bd->nonzero_vars) == 0); + gcc_assert (!bd->stmts_to_rescan + || VARRAY_ACTIVE_SIZE (bd->stmts_to_rescan) == 0); + gcc_assert (!bd->vrp_variables + || VARRAY_ACTIVE_SIZE (bd->vrp_variables) == 0); + gcc_assert (!bd->block_defs + || VARRAY_ACTIVE_SIZE (bd->block_defs) == 0); } -#endif } /* Initialize local stacks for this optimizer and record equivalences @@ -2216,8 +2214,7 @@ simplify_switch_and_lookup_avail_expr (tree stmt, #ifdef ENABLE_CHECKING /* ??? Why was Jeff testing this? We are gimple... */ - if (!is_gimple_val (def)) - abort (); + gcc_assert (is_gimple_val (def)); #endif to = TREE_TYPE (cond); @@ -2316,12 +2313,9 @@ cprop_into_successor_phis (basic_block bb, hint = i; } -#ifdef ENABLE_CHECKING /* If we did not find the proper alternative, then something is horribly wrong. */ - if (hint == phi_num_args) - abort (); -#endif + gcc_assert (hint != phi_num_args); /* The alternative may be associated with a constant, so verify it is an SSA_NAME before doing anything with it. */ @@ -2447,9 +2441,8 @@ eliminate_redundant_computations (struct dom_walk_data *walk_data, opt_stats.num_re++; #if defined ENABLE_CHECKING - if (TREE_CODE (cached_lhs) != SSA_NAME - && !is_gimple_min_invariant (cached_lhs)) - abort (); + gcc_assert (TREE_CODE (cached_lhs) == SSA_NAME + || is_gimple_min_invariant (cached_lhs)); #endif if (TREE_CODE (cached_lhs) == ADDR_EXPR @@ -3333,11 +3326,8 @@ avail_expr_eq (const void *p1, const void *p2) if (VUSE_OP (ops1, i) != VUSE_OP (ops2, i)) return false; -#ifdef ENABLE_CHECKING - if (((struct expr_hash_elt *)p1)->hash - != ((struct expr_hash_elt *)p2)->hash) - abort (); -#endif + gcc_assert (((struct expr_hash_elt *)p1)->hash + == ((struct expr_hash_elt *)p2)->hash); return true; } diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c index 558d50d75c7..820b2c6378c 100644 --- a/gcc/tree-ssa-dse.c +++ b/gcc/tree-ssa-dse.c @@ -169,13 +169,9 @@ fix_stmt_v_may_defs (tree stmt1, tree stmt2) } } -#ifdef ENABLE_CHECKING /* If we did not find a corresponding V_MAY_DEF_RESULT, then something has gone terribly wrong. */ - if (j == NUM_V_MAY_DEFS (v_may_defs2)) - abort (); -#endif - + gcc_assert (j != NUM_V_MAY_DEFS (v_may_defs2)); } } diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index 014ec2d5526..d65d6fb20d8 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -38,6 +38,7 @@ Boston, MA 02111-1307, USA. */ #include "hashtab.h" #include "tree-dump.h" #include "tree-ssa-live.h" +#include "errors.h" static void live_worklist (tree_live_info_p, varray_type, int); static tree_live_info_p new_tree_live_info (var_map); @@ -144,8 +145,8 @@ var_union (var_map map, tree var1, tree var2) other_var = var2; } - if (p1 == NO_PARTITION || p2 == NO_PARTITION) - abort (); + gcc_assert (p1 != NO_PARTITION); + gcc_assert (p2 != NO_PARTITION); if (p1 == p2) p3 = p1; @@ -274,8 +275,7 @@ change_partition_var (var_map map, tree var, int part) { var_ann_t ann; - if (TREE_CODE (var) == SSA_NAME) - abort(); + gcc_assert (TREE_CODE (var) != SSA_NAME); ann = var_ann (var); ann->out_of_ssa_tag = 1; @@ -415,7 +415,7 @@ create_ssa_var_map (int flags) EXECUTE_IF_SET_IN_SBITMAP (both, 0, i, fprintf (stderr, "Variable %s used in real and virtual operands\n", get_name (referenced_var (i)))); - abort (); + internal_error ("SSA corruption"); } sbitmap_free (used_in_real_ops); @@ -715,8 +715,7 @@ calculate_live_on_entry (var_map map) } } } - if (num > 0) - abort (); + gcc_assert (num <= 0); #endif BITMAP_XFREE (saw_def); @@ -943,10 +942,7 @@ root_var_init (var_map map) p = var_to_partition (map, t); -#ifdef ENABLE_CHECKING - if (p == NO_PARTITION) - abort (); -#endif + gcc_assert (p != NO_PARTITION); /* Make sure we only put coalesced partitions into the list once. */ if (TEST_BIT (seen, p)) @@ -1019,10 +1015,7 @@ type_var_init (var_map map) p = var_to_partition (map, t); -#ifdef ENABLE_CHECKING - if (p == NO_PARTITION) - abort (); -#endif + gcc_assert (p != NO_PARTITION); /* If partitions have been coalesced, only add the representative for the partition to the list once. */ @@ -1143,10 +1136,7 @@ add_coalesce (coalesce_list_p cl, int p1, int p2, int value) { partition_pair_p node; -#ifdef ENABLE_CHECKING - if (!cl->add_mode) - abort(); -#endif + gcc_assert (cl->add_mode); if (p1 == p2) return; @@ -1177,8 +1167,7 @@ sort_coalesce_list (coalesce_list_p cl) partition_pair_p chain, p; partition_pair_p *list; - if (!cl->add_mode) - abort(); + gcc_assert (cl->add_mode); cl->add_mode = false; @@ -1204,10 +1193,7 @@ sort_coalesce_list (coalesce_list_p cl) for (p = chain; p != NULL; p = p->next) list[count++] = p; -#ifdef ENABLE_CHECKING - if (count != num) - abort (); -#endif + gcc_assert (count == num); qsort (list, count, sizeof (partition_pair_p), compare_pairs); @@ -1248,8 +1234,7 @@ pop_best_coalesce (coalesce_list_p cl, int *p1, int *p2) partition_pair_p node; int ret; - if (cl->add_mode) - abort(); + gcc_assert (!cl->add_mode); node = cl->list[0]; if (!node) @@ -1793,3 +1778,18 @@ dump_live_info (FILE *f, tree_live_info_p live, int flag) } } } + +#ifdef ENABLE_CHECKING +void +register_ssa_partition_check (tree ssa_var) +{ + gcc_assert (TREE_CODE (ssa_var) == SSA_NAME); + if (!is_gimple_reg (SSA_NAME_VAR (ssa_var))) + { + fprintf (stderr, "Illegally registering a virtual SSA name :"); + print_generic_expr (stderr, ssa_var, TDF_SLIM); + fprintf (stderr, " in the SSA->Normal phase.\n"); + internal_error ("SSA corruption"); + } +} +#endif diff --git a/gcc/tree-ssa-live.h b/gcc/tree-ssa-live.h index b8637950496..eb93305ffd9 100644 --- a/gcc/tree-ssa-live.h +++ b/gcc/tree-ssa-live.h @@ -65,6 +65,9 @@ extern int var_union (var_map, tree, tree); extern void change_partition_var (var_map, tree, int); extern void compact_var_map (var_map, int); extern tree make_ssa_temp (tree); +#ifdef ENABLE_CHECKING +extern void register_ssa_partition_check (tree ssa_var); +#endif static inline int num_var_partitions (var_map); static inline tree var_to_partition_to_var (var_map, tree); @@ -77,7 +80,6 @@ static inline void register_ssa_partition (var_map, tree, bool); #define SSA_VAR_MAP_REF_COUNT 0x01 extern var_map create_ssa_var_map (int); - /* Number of partitions in MAP. */ static inline int @@ -93,10 +95,7 @@ static inline int version_ref_count (var_map map, tree ssa_var) { int version = SSA_NAME_VERSION (ssa_var); -#ifdef ENABLE_CHECKING - if (!map->ref_count) - abort (); -#endif + gcc_assert (map->ref_count); return map->ref_count[version]; } @@ -182,16 +181,7 @@ register_ssa_partition (var_map map, tree ssa_var, bool is_use) int version; #if defined ENABLE_CHECKING - if (TREE_CODE (ssa_var) != SSA_NAME) - abort (); - - if (!is_gimple_reg (SSA_NAME_VAR (ssa_var))) - { - fprintf (stderr, "Illegally registering a virtual SSA name :"); - print_generic_expr (stderr, ssa_var, TDF_SLIM); - fprintf (stderr, " in the SSA->Normal phase.\n"); - abort(); - } + register_ssa_partition_check (ssa_var); #endif version = SSA_NAME_VERSION (ssa_var); @@ -274,9 +264,7 @@ static inline void make_live_on_entry (tree_live_info_p, basic_block, int); static inline int partition_is_global (tree_live_info_p live, int p) { - if (!live->global) - abort (); - + gcc_assert (live->global); return bitmap_bit_p (live->global, p); } @@ -287,9 +275,7 @@ partition_is_global (tree_live_info_p live, int p) static inline bitmap live_entry_blocks (tree_live_info_p live, int p) { - if (!live->livein) - abort (); - + gcc_assert (live->livein); return live->livein[p]; } @@ -300,12 +286,10 @@ live_entry_blocks (tree_live_info_p live, int p) static inline bitmap live_on_exit (tree_live_info_p live, basic_block bb) { - if (!live->liveout) - abort(); + gcc_assert (live->liveout); + gcc_assert (bb != ENTRY_BLOCK_PTR); + gcc_assert (bb != EXIT_BLOCK_PTR); - if (bb == ENTRY_BLOCK_PTR || bb == EXIT_BLOCK_PTR) - abort (); - return live->liveout[bb->index]; } @@ -428,10 +412,7 @@ tpa_find_tree (tpa_p tpa, int i) a compressed element, so return TPA_NONE. */ if (index != TPA_NONE && index >= tpa_num_trees (tpa)) { -#ifdef ENABLE_CHECKING - if (tpa->uncompressed_num == -1) - abort (); -#endif + gcc_assert (tpa->uncompressed_num != -1); index = TPA_NONE; } @@ -444,10 +425,7 @@ tpa_find_tree (tpa_p tpa, int i) static inline void tpa_decompact(tpa_p tpa) { -#ifdef ENABLE_CHECKING - if (tpa->uncompressed_num == -1) - abort (); -#endif + gcc_assert (tpa->uncompressed_num != -1); tpa->num_trees = tpa->uncompressed_num; } diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c index f815c3c938e..a03dabd1fd1 100644 --- a/gcc/tree-ssa-loop-ch.c +++ b/gcc/tree-ssa-loop-ch.c @@ -59,8 +59,7 @@ should_duplicate_loop_header_p (basic_block header, struct loop *loop, if (header->aux) return false; - if (!header->succ) - abort (); + gcc_assert (header->succ); if (!header->succ->succ_next) return false; if (header->succ->succ_next->succ_next) @@ -118,8 +117,7 @@ duplicate_blocks (varray_type bbs_to_duplicate) preheader_edge = VARRAY_GENERIC_PTR_NOGC (bbs_to_duplicate, i); header = preheader_edge->dest; - if (!header->aux) - abort (); + gcc_assert (header->aux); header->aux = NULL; new_header = duplicate_block (header, preheader_edge); diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index d05617db09e..c0d2c00ad9e 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -150,7 +150,7 @@ for_each_index (tree *addr_p, bool (*cbck) (tree, tree *, void *), void *data) return true; default: - abort (); + gcc_unreachable (); } } } @@ -438,12 +438,9 @@ set_level (tree stmt, struct loop *orig_loop, struct loop *level) if (flow_loop_nested_p (stmt_loop, level)) return; - if (!LIM_DATA (stmt)) - abort (); - - if (level != LIM_DATA (stmt)->max_loop - && !flow_loop_nested_p (LIM_DATA (stmt)->max_loop, level)) - abort (); + gcc_assert (LIM_DATA (stmt)); + gcc_assert (level == LIM_DATA (stmt)->max_loop + || flow_loop_nested_p (LIM_DATA (stmt)->max_loop, level)); LIM_DATA (stmt)->tgt_loop = level; for (dep = LIM_DATA (stmt)->depends; dep; dep = dep->next) @@ -1106,7 +1103,7 @@ is_call_clobbered_ref (tree ref) return false; } - abort (); + gcc_unreachable (); } /* Determine whether all memory references inside LOOP corresponding to the diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index c5b6e404e3b..fd0250bf778 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -355,7 +355,7 @@ dump_use (FILE *file, struct iv_use *use) break; default: - abort (); + gcc_unreachable (); } fprintf (file, " in statement "); @@ -513,8 +513,7 @@ divide (unsigned bits, unsigned HOST_WIDE_INT a, unsigned HOST_WIDE_INT b, val = (a * inv) & mask; - if (((val * b) & mask) != a) - abort (); + gcc_assert (((val * b) & mask) == a); if ((val >> (bits - 1)) & 1) val |= ~mask; @@ -532,8 +531,7 @@ stmt_after_ip_normal_pos (struct loop *loop, tree stmt) { basic_block bb = ip_normal_pos (loop), sbb = bb_for_stmt (stmt); - if (!bb) - abort (); + gcc_assert (bb); if (sbb == loop->latch) return true; @@ -589,7 +587,7 @@ stmt_after_increment (struct loop *loop, struct iv_cand *cand, tree stmt) return stmt_after_ip_original_pos (cand, stmt); default: - abort (); + gcc_unreachable (); } } @@ -644,8 +642,7 @@ set_iv (struct ivopts_data *data, tree iv, tree base, tree step) { struct version_info *info = name_info (data, iv); - if (info->iv) - abort (); + gcc_assert (!info->iv); bitmap_set_bit (data->relevant, SSA_NAME_VERSION (iv)); info->iv = alloc_iv (base, step); @@ -741,7 +738,7 @@ contains_abnormal_ssa_name_p (tree expr) break; default: - abort (); + gcc_unreachable (); } return false; @@ -1030,9 +1027,8 @@ find_interesting_uses_outer_or_nonlin (struct ivopts_data *data, tree op, { use = iv_use (data, iv->use_id); - if (use->type != USE_NONLINEAR_EXPR - && use->type != USE_OUTER) - abort (); + gcc_assert (use->type == USE_NONLINEAR_EXPR + || use->type == USE_OUTER); if (type == USE_NONLINEAR_EXPR) use->type = USE_NONLINEAR_EXPR; @@ -1050,9 +1046,8 @@ find_interesting_uses_outer_or_nonlin (struct ivopts_data *data, tree op, *civ = *iv; stmt = SSA_NAME_DEF_STMT (op); - if (TREE_CODE (stmt) != PHI_NODE - && TREE_CODE (stmt) != MODIFY_EXPR) - abort (); + gcc_assert (TREE_CODE (stmt) == PHI_NODE + || TREE_CODE (stmt) == MODIFY_EXPR); use = record_use (data, NULL, civ, stmt, type); iv->use_id = use->id; @@ -1742,7 +1737,7 @@ add_derived_ivs_candidates (struct ivopts_data *data) break; default: - abort (); + gcc_unreachable (); } } } @@ -2531,8 +2526,7 @@ peel_address (tree addr, unsigned HOST_WIDE_INT *diff) off = DECL_FIELD_BIT_OFFSET (TREE_OPERAND (addr, 1)); bit_offset = TREE_INT_CST_LOW (off); - if (bit_offset % BITS_PER_UNIT) - abort (); + gcc_assert ((bit_offset % BITS_PER_UNIT) == 0); if (diff) *diff += bit_offset / BITS_PER_UNIT; @@ -2557,7 +2551,7 @@ peel_address (tree addr, unsigned HOST_WIDE_INT *diff) return TREE_OPERAND (addr, 0); default: - abort (); + gcc_unreachable (); } } @@ -2647,8 +2641,7 @@ ptr_difference_cost (struct ivopts_data *data, unsigned HOST_WIDE_INT diff = 0; unsigned cost; - if (TREE_CODE (e1) != ADDR_EXPR) - abort (); + gcc_assert (TREE_CODE (e1) == ADDR_EXPR); if (TREE_CODE (e2) == ADDR_EXPR && ptr_difference_const (TREE_OPERAND (e1, 0), @@ -3041,9 +3034,8 @@ may_replace_final_value (struct loop *loop, struct iv_use *use, tree *value) if (!exit) return false; - if (!dominated_by_p (CDI_DOMINATORS, exit->src, - bb_for_stmt (use->stmt))) - abort (); + gcc_assert (dominated_by_p (CDI_DOMINATORS, exit->src, + bb_for_stmt (use->stmt))); niter = &loop_data (loop)->niter; if (!niter->niter @@ -3129,7 +3121,7 @@ determine_use_iv_cost (struct ivopts_data *data, break; default: - abort (); + gcc_unreachable (); } } @@ -3790,8 +3782,9 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data, tree op, stmts, tgt, ass; block_stmt_iterator bsi, pbsi; - if (TREE_CODE (use->stmt) == PHI_NODE) + switch (TREE_CODE (use->stmt)) { + case PHI_NODE: tgt = PHI_RESULT (use->stmt); /* If we should keep the biv, do not replace it. */ @@ -3805,14 +3798,16 @@ rewrite_use_nonlinear_expr (struct ivopts_data *data, bsi = pbsi; bsi_next (&pbsi); } - } - else if (TREE_CODE (use->stmt) == MODIFY_EXPR) - { + break; + + case MODIFY_EXPR: tgt = TREE_OPERAND (use->stmt, 0); bsi = stmt_for_bsi (use->stmt); + break; + + default: + gcc_unreachable (); } - else - abort (); op = force_gimple_operand (comp, &stmts, false, SSA_NAME_VAR (tgt)); @@ -4102,20 +4097,26 @@ rewrite_use_outer (struct ivopts_data *data, tree value, op, stmts, tgt; tree phi; - if (TREE_CODE (use->stmt) == PHI_NODE) - tgt = PHI_RESULT (use->stmt); - else if (TREE_CODE (use->stmt) == MODIFY_EXPR) - tgt = TREE_OPERAND (use->stmt, 0); - else - abort (); + switch (TREE_CODE (use->stmt)) + { + case PHI_NODE: + tgt = PHI_RESULT (use->stmt); + break; + case MODIFY_EXPR: + tgt = TREE_OPERAND (use->stmt, 0); + break; + default: + gcc_unreachable (); + } + exit = single_dom_exit (data->current_loop); if (exit) { if (!cand->iv) { - if (!may_replace_final_value (data->current_loop, use, &value)) - abort (); + bool ok = may_replace_final_value (data->current_loop, use, &value); + gcc_assert (ok); } else value = get_computation_at (data->current_loop, @@ -4180,7 +4181,7 @@ rewrite_use (struct ivopts_data *data, break; default: - abort (); + gcc_unreachable (); } modify_stmt (use->stmt); } @@ -4198,8 +4199,7 @@ rewrite_uses (struct ivopts_data *data) { use = iv_use (data, i); cand = use->selected; - if (!cand) - abort (); + gcc_assert (cand); rewrite_use (data, use, cand); } diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c index 51e29fd844b..cde3ce8fb4d 100644 --- a/gcc/tree-ssa-loop-manip.c +++ b/gcc/tree-ssa-loop-manip.c @@ -310,8 +310,7 @@ rewrite_into_loop_closed_ssa (void) unsigned i; bitmap names_to_rename; - if (any_marked_for_rewrite_p ()) - abort (); + gcc_assert (!any_marked_for_rewrite_p ()); use_blocks = xcalloc (num_ssa_names, sizeof (bitmap)); @@ -346,9 +345,8 @@ check_loop_closed_ssa_use (basic_block bb, tree use) def = SSA_NAME_DEF_STMT (use); def_bb = bb_for_stmt (def); - if (def_bb - && !flow_bb_inside_loop_p (def_bb->loop_father, bb)) - abort (); + gcc_assert (!def_bb + || flow_bb_inside_loop_p (def_bb->loop_father, bb)); } /* Checks invariants of loop closed ssa form in statement STMT in BB. */ diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c index c11360d94ac..6b234c13f89 100644 --- a/gcc/tree-ssa-operands.c +++ b/gcc/tree-ssa-operands.c @@ -26,6 +26,7 @@ Boston, MA 02111-1307, USA. */ #include "flags.h" #include "function.h" #include "diagnostic.h" +#include "errors.h" #include "tree-flow.h" #include "tree-inline.h" #include "tree-pass.h" @@ -322,11 +323,8 @@ finalize_ssa_defs (def_optype *old_ops_p, tree stmt ATTRIBUTE_UNUSED) if (num == 0) return NULL; -#ifdef ENABLE_CHECKING /* There should only be a single real definition per assignment. */ - if (TREE_CODE (stmt) == MODIFY_EXPR && num > 1) - abort (); -#endif + gcc_assert (TREE_CODE (stmt) != MODIFY_EXPR || num <= 1); old_ops = *old_ops_p; @@ -382,8 +380,7 @@ finalize_ssa_uses (use_optype *old_ops_p, tree stmt ATTRIBUTE_UNUSED) initial call to get_stmt_operands does not pass a pointer to a statement). */ for (x = 0; x < num; x++) - if (*(VARRAY_TREE_PTR (build_uses, x)) == stmt) - abort (); + gcc_assert (*(VARRAY_TREE_PTR (build_uses, x)) != stmt); } #endif old_ops = *old_ops_p; @@ -639,11 +636,8 @@ finalize_ssa_v_must_defs (v_must_def_optype *old_ops_p, if (num == 0) return NULL; -#ifdef ENABLE_CHECKING /* There should only be a single V_MUST_DEF per assignment. */ - if (TREE_CODE (stmt) == MODIFY_EXPR && num > 1) - abort (); -#endif + gcc_assert (TREE_CODE (stmt) != MODIFY_EXPR || num <= 1); old_ops = *old_ops_p; @@ -721,14 +715,11 @@ finalize_ssa_stmt_operands (tree stmt, stmt_operands_p old_ops, static inline void start_ssa_stmt_operands (void) { -#ifdef ENABLE_CHECKING - if (VARRAY_ACTIVE_SIZE (build_defs) > 0 - || VARRAY_ACTIVE_SIZE (build_uses) > 0 - || VARRAY_ACTIVE_SIZE (build_vuses) > 0 - || VARRAY_ACTIVE_SIZE (build_v_may_defs) > 0 - || VARRAY_ACTIVE_SIZE (build_v_must_defs) > 0) - abort (); -#endif + gcc_assert (VARRAY_ACTIVE_SIZE (build_defs) == 0); + gcc_assert (VARRAY_ACTIVE_SIZE (build_uses) == 0); + gcc_assert (VARRAY_ACTIVE_SIZE (build_vuses) == 0); + gcc_assert (VARRAY_ACTIVE_SIZE (build_v_may_defs) == 0); + gcc_assert (VARRAY_ACTIVE_SIZE (build_v_must_defs) == 0); } @@ -935,12 +926,9 @@ get_stmt_operands (tree stmt) stmt_ann_t ann; stmt_operands_t old_operands; -#if defined ENABLE_CHECKING /* The optimizers cannot handle statements that are nothing but a _DECL. This indicates a bug in the gimplifier. */ - if (SSA_VAR_P (stmt)) - abort (); -#endif + gcc_assert (!SSA_VAR_P (stmt)); /* Ignore error statements. */ if (TREE_CODE (stmt) == ERROR_MARK) @@ -1189,10 +1177,13 @@ get_expr_operands (tree stmt, tree *expr_p, int flags) } /* If we get here, something has gone wrong. */ +#ifdef ENABLE_CHECKING fprintf (stderr, "unhandled expression in get_expr_operands():\n"); debug_tree (expr); fputs ("\n", stderr); - abort (); + internal_error ("internal error"); +#endif + gcc_unreachable (); } @@ -1217,11 +1208,8 @@ get_asm_expr_operands (tree stmt) parse_output_constraint (&constraint, i, 0, 0, &allows_mem, &allows_reg, &is_inout); -#if defined ENABLE_CHECKING /* This should have been split in gimplify_asm_expr. */ - if (allows_reg && is_inout) - abort (); -#endif + gcc_assert (!allows_reg || !is_inout); /* Memory operands are addressable. Note that STMT needs the address of this operand. */ @@ -1379,7 +1367,7 @@ get_indirect_ref_operands (tree stmt, tree expr, int flags) /* Ok, this isn't even is_gimple_min_invariant. Something's broke. */ else - abort (); + gcc_unreachable (); /* Add a USE operand for the base pointer. */ get_expr_operands (stmt, pptr, opf_none); @@ -1489,12 +1477,9 @@ add_stmt_operand (tree *var_p, tree stmt, int flags) { if (flags & opf_kill_def) { -#if defined ENABLE_CHECKING /* Only regular variables may get a V_MUST_DEF operand. */ - if (v_ann->mem_tag_kind != NOT_A_TAG) - abort (); -#endif + gcc_assert (v_ann->mem_tag_kind == NOT_A_TAG); /* V_MUST_DEF for non-aliased, non-GIMPLE register variable definitions. */ append_v_must_def (var); @@ -1519,10 +1504,7 @@ add_stmt_operand (tree *var_p, tree stmt, int flags) /* The variable is aliased. Add its aliases to the virtual operands. */ -#if defined ENABLE_CHECKING - if (VARRAY_ACTIVE_SIZE (aliases) == 0) - abort (); -#endif + gcc_assert (VARRAY_ACTIVE_SIZE (aliases) != 0); if (flags & opf_is_def) { diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c index ec12f62c008..b3227555f22 100644 --- a/gcc/tree-ssa-pre.c +++ b/gcc/tree-ssa-pre.c @@ -444,10 +444,7 @@ value_exists_in_set_bitmap (value_set_t set, tree v) static void value_remove_from_set_bitmap (value_set_t set, tree v) { -#ifdef ENABLE_CHECKING - if (!set->indexed) - abort (); -#endif + gcc_assert (set->indexed); if (!set->values) return; @@ -462,10 +459,7 @@ value_remove_from_set_bitmap (value_set_t set, tree v) static inline void value_insert_into_set_bitmap (value_set_t set, tree v) { -#ifdef ENABLE_CHECKING - if (!set->indexed) - abort (); -#endif + gcc_assert (set->indexed); if (set->values == NULL) { @@ -511,12 +505,10 @@ bitmap_insert_into_set (bitmap_set_t set, tree expr) { tree val; /* XXX: For now, we only let SSA_NAMES into the bitmap sets. */ - if (TREE_CODE (expr) != SSA_NAME) - abort (); + gcc_assert (TREE_CODE (expr) == SSA_NAME); val = get_value_handle (expr); - if (val == NULL) - abort (); + gcc_assert (val); if (!is_gimple_min_invariant (val)) bitmap_set_bit (set->values, VALUE_HANDLE_ID (val)); bitmap_set_bit (set->expressions, SSA_NAME_VERSION (expr)); @@ -529,9 +521,7 @@ insert_into_set (value_set_t set, tree expr) { value_set_node_t newnode = pool_alloc (value_set_node_pool); tree val = get_value_handle (expr); - - if (val == NULL) - abort (); + gcc_assert (val); /* For indexed sets, insert the value into the set value bitmap. For all sets, add it to the linked list and increment the list @@ -923,13 +913,12 @@ phi_translate (tree expr, value_set_t set, basic_block pred, } break; case 'd': - abort (); + gcc_unreachable (); case 'x': { tree phi = NULL; int i; - if (TREE_CODE (expr) != SSA_NAME) - abort (); + gcc_assert (TREE_CODE (expr) == SSA_NAME); if (TREE_CODE (SSA_NAME_DEF_STMT (expr)) == PHI_NODE) phi = SSA_NAME_DEF_STMT (expr); else @@ -1078,12 +1067,11 @@ valid_in_set (value_set_t set, tree expr) } case 'x': { - if (TREE_CODE (expr) == SSA_NAME) - return true; - abort (); + gcc_assert (TREE_CODE (expr) == SSA_NAME); + return true; } case 'c': - abort (); + gcc_unreachable (); } return false; } @@ -1258,8 +1246,7 @@ compute_antic (void) FOR_ALL_BB (bb) { ANTIC_IN (bb) = set_new (true); - if (bb->flags & BB_VISITED) - abort (); + gcc_assert (!(bb->flags & BB_VISITED)); } while (changed) @@ -1304,10 +1291,9 @@ find_or_generate_expression (basic_block block, tree expr, tree stmts) if (genop == NULL) { genop = VALUE_HANDLE_EXPR_SET (expr)->head->expr; - if (TREE_CODE_CLASS (TREE_CODE (genop)) != '1' - && TREE_CODE_CLASS (TREE_CODE (genop)) != '2' - && TREE_CODE_CLASS (TREE_CODE (genop)) != 'r') - abort (); + gcc_assert (TREE_CODE_CLASS (TREE_CODE (genop)) == '1' + || TREE_CODE_CLASS (TREE_CODE (genop)) == '2' + || TREE_CODE_CLASS (TREE_CODE (genop)) == 'r'); genop = create_expression_by_pieces (block, genop, stmts); } return genop; @@ -1381,7 +1367,7 @@ create_expression_by_pieces (basic_block block, tree expr, tree stmts) break; } default: - abort (); + gcc_unreachable (); } v = get_value_handle (expr); @@ -1497,8 +1483,7 @@ insert_aux (basic_block block) } vprime = get_value_handle (eprime); - if (!vprime) - abort (); + gcc_assert (vprime); edoubleprime = bitmap_find_leader (AVAIL_OUT (bprime), vprime); if (edoubleprime == NULL) @@ -1514,9 +1499,9 @@ insert_aux (basic_block block) first_s = edoubleprime; else if (first_s != edoubleprime) all_same = false; - if (first_s != edoubleprime - && operand_equal_p (first_s, edoubleprime, 0)) - abort (); + gcc_assert (first_s == edoubleprime + || !operand_equal_p + (first_s, edoubleprime, 0)); } } /* If we can insert it, it's not the same value @@ -1683,12 +1668,9 @@ create_value_expr_from (tree expr, basic_block block, vuse_optype vuses) enum tree_code code = TREE_CODE (expr); tree vexpr; -#if defined ENABLE_CHECKING - if (TREE_CODE_CLASS (code) != '1' - && TREE_CODE_CLASS (code) != '2' - && TREE_CODE_CLASS (code) != 'r') - abort (); -#endif + gcc_assert (TREE_CODE_CLASS (code) == '1' + || TREE_CODE_CLASS (code) == '2' + || TREE_CODE_CLASS (code) == 'r'); if (TREE_CODE_CLASS (code) == '1') vexpr = pool_alloc (unary_node_pool); @@ -1887,8 +1869,7 @@ eliminate (void) && (TREE_CODE (*rhs_p) != SSA_NAME || may_propagate_copy (*rhs_p, sprime))) { - if (sprime == *rhs_p) - abort (); + gcc_assert (sprime != *rhs_p); if (dump_file && (dump_flags & TDF_DETAILS)) { diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index b72c789476e..8e65f6444a4 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -215,10 +215,8 @@ cfg_blocks_get (void) bb = VARRAY_BB (cfg_blocks, cfg_blocks_head); -#ifdef ENABLE_CHECKING - if (cfg_blocks_empty_p () || !bb) - abort (); -#endif + gcc_assert (!cfg_blocks_empty_p ()); + gcc_assert (bb); cfg_blocks_head = (cfg_blocks_head + 1) % VARRAY_SIZE (cfg_blocks); --cfg_blocks_num; diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c index 36b8f335a8e..50c5b320da0 100644 --- a/gcc/tree-ssa-threadupdate.c +++ b/gcc/tree-ssa-threadupdate.c @@ -145,11 +145,8 @@ remove_last_stmt_and_useless_edges (basic_block bb, basic_block dest_bb) bsi = bsi_last (bb); -#ifdef ENABLE_CHECKING - if (TREE_CODE (bsi_stmt (bsi)) != COND_EXPR - && TREE_CODE (bsi_stmt (bsi)) != SWITCH_EXPR) - abort (); -#endif + gcc_assert (TREE_CODE (bsi_stmt (bsi)) == COND_EXPR + || TREE_CODE (bsi_stmt (bsi)) == SWITCH_EXPR); bsi_remove (&bsi); diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 2f077856538..4d8096b2294 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -845,10 +845,7 @@ walk_use_def_chains (tree var, walk_use_def_chains_fn fn, void *data, { tree def_stmt; -#if defined ENABLE_CHECKING - if (TREE_CODE (var) != SSA_NAME) - abort (); -#endif + gcc_assert (TREE_CODE (var) == SSA_NAME); def_stmt = SSA_NAME_DEF_STMT (var); @@ -1047,8 +1044,7 @@ check_phi_redundancy (tree phi, tree *eq_to) /* At least one of the arguments should not be equal to the result, or something strange is happening. */ - if (!val) - abort (); + gcc_assert (val); if (get_eq_name (eq_to, res) == val) return; diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c index 12664bbf09c..d138a793ebf 100644 --- a/gcc/tree-ssanames.c +++ b/gcc/tree-ssanames.c @@ -181,14 +181,12 @@ make_ssa_name (tree var, tree stmt) { tree t; -#if defined ENABLE_CHECKING - if ((!DECL_P (var) - && TREE_CODE (var) != INDIRECT_REF) - || (stmt - && !IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (stmt))) - && TREE_CODE (stmt) != PHI_NODE)) - abort (); -#endif + gcc_assert (DECL_P (var) + || TREE_CODE (var) == INDIRECT_REF); + + gcc_assert (!stmt + || IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (stmt))) + || TREE_CODE (stmt) == PHI_NODE); /* If our free list has an element, then use it. Also reuse the SSA version number of the element on the free list which helps diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c index ee2103d8372..e3f491e2be1 100644 --- a/gcc/tree-tailcall.c +++ b/gcc/tree-tailcall.c @@ -233,8 +233,7 @@ independent_of_stmt_p (tree expr, tree at, block_stmt_iterator bsi) for (e = bb->pred; e; e = e->pred_next) if (e->src->aux) break; - if (!e) - abort (); + gcc_assert (e); expr = PHI_ARG_DEF_FROM_EDGE (at, e); if (TREE_CODE (expr) != SSA_NAME) @@ -592,8 +591,7 @@ adjust_return_value (basic_block bb, tree m, tree a) tree ret_type = TREE_TYPE (DECL_RESULT (current_function_decl)); block_stmt_iterator bsi = bsi_last (bb); - if (TREE_CODE (ret_stmt) != RETURN_EXPR) - abort (); + gcc_assert (TREE_CODE (ret_stmt) == RETURN_EXPR); ret_var = TREE_OPERAND (ret_stmt, 0); if (!ret_var) @@ -691,8 +689,7 @@ eliminate_tail_call (struct tailcall *t) /* Replace the call by a jump to the start of function. */ e = redirect_edge_and_branch (t->call_block->succ, first); - if (!e) - abort (); + gcc_assert (e); PENDING_STMT (e) = NULL_TREE; /* Add phi node entries for arguments. Not every PHI node corresponds to @@ -751,8 +748,7 @@ eliminate_tail_call (struct tailcall *t) /* For all calls the same set of variables should be clobbered. This means that there always should be the appropriate phi node except for the first time we eliminate the call. */ - if (first->pred->pred_next->pred_next) - abort (); + gcc_assert (!first->pred->pred_next->pred_next); } add_phi_arg (&phi, V_MAY_DEF_OP (v_may_defs, i), e); diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c index f229fd45452..65214cc7ebe 100644 --- a/gcc/tree-vectorizer.c +++ b/gcc/tree-vectorizer.c @@ -540,25 +540,18 @@ vect_create_index_for_array_ref (tree stmt, block_stmt_iterator *bsi) varray_type access_fns = DR_ACCESS_FNS (dr); /* FORNOW: handling only one dimensional arrays. */ - if (VARRAY_ACTIVE_SIZE (access_fns) != 1) - abort (); - - if (!vectorization_factor) - abort (); + gcc_assert (VARRAY_ACTIVE_SIZE (access_fns) == 1); + gcc_assert (vectorization_factor); #endif access_fn = DR_ACCESS_FN (dr, 0); ok = vect_is_simple_iv_evolution (loopnum, access_fn, &init, &step, true) && vect_get_first_index (expr, &array_first_index); -#ifdef ENABLE_CHECKING - if (!ok) - abort (); + gcc_assert (ok); /* FORNOW: Handling only constant 'init'. */ - if (TREE_CODE (init) != INTEGER_CST) - abort (); -#endif + gcc_assert (TREE_CODE (init) == INTEGER_CST); vf = build_int_cst (unsigned_type_node, vectorization_factor); @@ -636,8 +629,7 @@ vect_align_data_ref (tree stmt) /* FORNOW: can't handle misaligned accesses; all accesses expected to be aligned. */ - if (!aligned_access_p (dr)) - abort (); + gcc_assert (aligned_access_p (dr)); } @@ -706,12 +698,9 @@ vect_create_data_ref (tree stmt, block_stmt_iterator *bsi) get_name (addr_ref)); add_referenced_tmp_var (vect_ptr); -#ifdef ENABLE_CHECKING - if (TREE_CODE (addr_ref) != VAR_DECL - && TREE_CODE (addr_ref) != COMPONENT_REF - && TREE_CODE (addr_ref) != SSA_NAME) - abort (); -#endif + gcc_assert (TREE_CODE (addr_ref) == VAR_DECL + || TREE_CODE (addr_ref) == COMPONENT_REF + || TREE_CODE (addr_ref) == SSA_NAME); if (vect_debug_details (NULL)) { @@ -732,10 +721,7 @@ vect_create_data_ref (tree stmt, block_stmt_iterator *bsi) /* Handle aliasing: */ tag = STMT_VINFO_MEMTAG (stmt_info); -#ifdef ENABLE_CHECKING - if (!tag) - abort (); -#endif + gcc_assert (tag); get_var_ann (vect_ptr)->type_mem_tag = tag; /* Mark for renaming all aliased variables @@ -794,10 +780,7 @@ vect_create_destination_var (tree scalar_dest, tree vectype) tree vec_dest; const char *new_name; -#ifdef ENABLE_CHECKING - if (TREE_CODE (scalar_dest) != SSA_NAME) - abort (); -#endif + gcc_assert (TREE_CODE (scalar_dest) == SSA_NAME); new_name = get_name (scalar_dest); if (!new_name) @@ -907,10 +890,7 @@ vect_get_vec_def_for_operand (tree op, tree stmt) return vect_init_vector (stmt, vec_cst); } -#ifdef ENABLE_CHECKING - if (TREE_CODE (op) != SSA_NAME) - abort (); -#endif + gcc_assert (TREE_CODE (op) == SSA_NAME); /** ===> Case 2: operand is an SSA_NAME - find the stmt that defines it. **/ @@ -931,10 +911,7 @@ vect_get_vec_def_for_operand (tree op, tree stmt) /* Get the def from the vectorized stmt. */ vec_stmt = STMT_VINFO_VEC_STMT (def_stmt_info); -#ifdef ENABLE_CHECKING - if (!vec_stmt) - abort (); -#endif + gcc_assert (vec_stmt); vec_oprnd = TREE_OPERAND (vec_stmt, 0); return vec_oprnd; } @@ -948,7 +925,7 @@ vect_get_vec_def_for_operand (tree op, tree stmt) { if (vect_debug_details (NULL)) fprintf (dump_file, "reduction/induction - unsupported."); - abort (); /* FORNOW no support for reduction/induction. */ + internal_error ("no support for reduction/induction"); /* FORNOW */ } @@ -965,10 +942,7 @@ vect_get_vec_def_for_operand (tree op, tree stmt) break; case NOP_EXPR: def = TREE_OPERAND (def_stmt, 0); -#ifdef ENABLE_CHECKING - if (!IS_EMPTY_STMT (def_stmt)) - abort (); -#endif + gcc_assert (IS_EMPTY_STMT (def_stmt)); def = op; break; default: @@ -977,7 +951,7 @@ vect_get_vec_def_for_operand (tree op, tree stmt) fprintf (dump_file, "unsupported defining stmt: "); print_generic_expr (dump_file, def_stmt, TDF_SLIM); } - abort (); + internal_error ("unsupported defining stmt"); } /* Build a tree with vector elements. Create 'vec_inv = {inv,inv,..,inv}' */ @@ -1017,10 +991,7 @@ vect_finish_stmt_generation (tree stmt, tree vec_stmt, block_stmt_iterator *bsi) while (stmt != bsi_stmt (*bsi) && !bsi_end_p (*bsi)) bsi_next (bsi); -#ifdef ENABLE_CHECKING - if (stmt != bsi_stmt (*bsi)) - abort (); -#endif + gcc_assert (stmt == bsi_stmt (*bsi)); } @@ -1352,33 +1323,34 @@ vect_transform_stmt (tree stmt, block_stmt_iterator *bsi) bool is_store = false; tree vec_stmt = NULL_TREE; stmt_vec_info stmt_info = vinfo_for_stmt (stmt); + bool done; switch (STMT_VINFO_TYPE (stmt_info)) { case op_vec_info_type: - if (!vectorizable_operation (stmt, bsi, &vec_stmt)) - abort (); + done = vectorizable_operation (stmt, bsi, &vec_stmt); + gcc_assert (done); break; case assignment_vec_info_type: - if (!vectorizable_assignment (stmt, bsi, &vec_stmt)) - abort (); + done = vectorizable_assignment (stmt, bsi, &vec_stmt); + gcc_assert (done); break; case load_vec_info_type: - if (!vectorizable_load (stmt, bsi, &vec_stmt)) - abort (); + done = vectorizable_load (stmt, bsi, &vec_stmt); + gcc_assert (done); break; case store_vec_info_type: - if (!vectorizable_store (stmt, bsi, &vec_stmt)) - abort (); + done = vectorizable_store (stmt, bsi, &vec_stmt); + gcc_assert (done); is_store = true; break; default: if (vect_debug_details (NULL)) fprintf (dump_file, "stmt not supported."); - abort (); + gcc_unreachable (); } STMT_VINFO_VEC_STMT (stmt_info) = vec_stmt; @@ -1406,27 +1378,17 @@ vect_transform_loop_bound (loop_vec_info loop_vinfo) tree cond; tree lb_type; -#ifdef ENABLE_CHECKING - if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)) - abort (); -#endif + gcc_assert (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo)); old_N = LOOP_VINFO_NITERS (loop_vinfo); vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo); -#ifdef ENABLE_CHECKING /* FORNOW: assuming number-of-iterations divides by the vectorization factor. */ - if (old_N % vf) - abort (); -#endif + gcc_assert (!(old_N % vf)); orig_cond_expr = LOOP_VINFO_EXIT_COND (loop_vinfo); -#ifdef ENABLE_CHECKING - if (!orig_cond_expr) - abort (); -#endif - if (orig_cond_expr != bsi_stmt (loop_exit_bsi)) - abort (); + gcc_assert (orig_cond_expr); + gcc_assert (orig_cond_expr == bsi_stmt (loop_exit_bsi)); create_iv (integer_zero_node, integer_one_node, NULL_TREE, loop, &loop_exit_bsi, false, &indx_before_incr, &indx_after_incr); @@ -1434,8 +1396,7 @@ vect_transform_loop_bound (loop_vec_info loop_vinfo) /* bsi_insert is using BSI_NEW_STMT. We need to bump it back to point to the exit condition. */ bsi_next (&loop_exit_bsi); - if (bsi_stmt (loop_exit_bsi) != orig_cond_expr) - abort (); + gcc_assert (bsi_stmt (loop_exit_bsi) == orig_cond_expr); /* new loop exit test: */ lb_type = TREE_TYPE (TREE_OPERAND (TREE_OPERAND (orig_cond_expr, 0), 1)); @@ -1484,9 +1445,8 @@ vect_transform_loop (loop_vec_info loop_vinfo, /* 1) Make sure the loop header has exactly two entries 2) Make sure we have a preheader basic block. */ - if (!loop->header->pred->pred_next - || loop->header->pred->pred_next->pred_next) - abort (); + gcc_assert (loop->header->pred->pred_next); + gcc_assert (!loop->header->pred->pred_next->pred_next); loop_split_edge_with (loop_preheader_edge (loop), NULL); @@ -1515,10 +1475,7 @@ vect_transform_loop (loop_vec_info loop_vinfo, print_generic_expr (dump_file, stmt, TDF_SLIM); } stmt_info = vinfo_for_stmt (stmt); -#ifdef ENABLE_CHECKING - if (!stmt_info) - abort (); -#endif + gcc_assert (stmt_info); if (!STMT_VINFO_RELEVANT_P (stmt_info)) { bsi_next (&si); @@ -1528,8 +1485,8 @@ vect_transform_loop (loop_vec_info loop_vinfo, /* FORNOW: Verify that all stmts operate on the same number of units and no inner unrolling is necessary. */ vectype = STMT_VINFO_VECTYPE (stmt_info); - if (GET_MODE_NUNITS (TYPE_MODE (vectype)) != vectorization_factor) - abort (); + gcc_assert (GET_MODE_NUNITS (TYPE_MODE (vectype)) + == vectorization_factor); #endif /* -------- vectorize statement ------------ */ if (vect_debug_details (NULL)) @@ -1668,10 +1625,9 @@ vect_analyze_operations (loop_vec_info loop_vinfo) fprintf (dump_file, "==> examining statement: "); print_generic_expr (dump_file, stmt, TDF_SLIM); } -#ifdef ENABLE_CHECKING - if (!stmt_info) - abort (); -#endif + + gcc_assert (stmt_info); + /* skip stmts which do not need to be vectorized. this is expected to include: - the COND_EXPR which is the loop exit condition diff --git a/gcc/tree-vn.c b/gcc/tree-vn.c index 061a7ac9104..0f65c8a26aa 100644 --- a/gcc/tree-vn.c +++ b/gcc/tree-vn.c @@ -87,14 +87,11 @@ vn_compute (tree expr, hashval_t val, vuse_optype vuses) { size_t i; -#if defined ENABLE_CHECKING /* EXPR must not be a statement. We are only interested in value numbering expressions on the RHS of assignments. */ - if (expr == NULL_TREE - || (expr->common.ann - && expr->common.ann->common.type == STMT_ANN)) - abort (); -#endif + gcc_assert (expr); + gcc_assert (!expr->common.ann + || expr->common.ann->common.type != STMT_ANN); val = iterative_hash_expr (expr, val); @@ -177,11 +174,9 @@ set_value_handle (tree e, tree v) SSA_NAME_VALUE (e) = v; else if (EXPR_P (e) || DECL_P (e)) get_tree_ann (e)->common.value_handle = v; - else if (is_gimple_min_invariant (e)) - /* Do nothing. Constants are their own value handles. */ - ; else - abort (); + /* Do nothing. Constants are their own value handles. */ + gcc_assert (is_gimple_min_invariant (e)); } @@ -284,10 +279,11 @@ get_value_handle (tree expr) tree_ann_t ann = tree_ann (expr); return ((ann) ? ann->common.value_handle : NULL_TREE); } - else if (is_gimple_min_invariant (expr)) - return expr; - - abort (); + else + { + gcc_assert (is_gimple_min_invariant (expr)); + return expr; + } } diff --git a/gcc/tree.c b/gcc/tree.c index 157d7f2d15a..7b9c53f31a7 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -205,7 +205,7 @@ tree_size (tree node) } default: - abort (); + gcc_unreachable (); } } @@ -228,8 +228,8 @@ make_node_stat (enum tree_code code MEM_STAT_DECL) /* We can't allocate a TREE_VEC, PHI_NODE, or STRING_CST without knowing how many elements it will have. */ - if (code == TREE_VEC || code == PHI_NODE) - abort (); + gcc_assert (code != TREE_VEC); + gcc_assert (code != PHI_NODE); TREE_SET_CODE ((tree)&ttmp, code); length = tree_size ((tree)&ttmp); @@ -282,7 +282,7 @@ make_node_stat (enum tree_code code MEM_STAT_DECL) break; default: - abort (); + gcc_unreachable (); } tree_node_counts[(int) kind]++; @@ -366,10 +366,7 @@ copy_node_stat (tree node MEM_STAT_DECL) enum tree_code code = TREE_CODE (node); size_t length; -#ifdef ENABLE_CHECKING - if (code == STATEMENT_LIST) - abort (); -#endif + gcc_assert (code != STATEMENT_LIST); length = tree_size (node); t = ggc_alloc_zone_stat (length, tree_zone PASS_MEM_STAT); @@ -547,10 +544,9 @@ build_int_cst_wide (tree type, unsigned HOST_WIDE_INT low, HOST_WIDE_INT hi) if (t) { /* Make sure no one is clobbering the shared constant. */ - if (TREE_TYPE (t) != type) - abort (); - if (TREE_INT_CST_LOW (t) != low || TREE_INT_CST_HIGH (t) != hi) - abort (); + gcc_assert (TREE_TYPE (t) == type); + gcc_assert (TREE_INT_CST_LOW (t) == low); + gcc_assert (TREE_INT_CST_HIGH (t) == hi); return t; } } @@ -840,10 +836,9 @@ integer_all_onesp (tree expr) shift_amount = prec - HOST_BITS_PER_WIDE_INT; - if (shift_amount > HOST_BITS_PER_WIDE_INT) - /* Can not handle precisions greater than twice the host int size. */ - abort (); - else if (shift_amount == HOST_BITS_PER_WIDE_INT) + /* Can not handle precisions greater than twice the host int size. */ + gcc_assert (shift_amount <= HOST_BITS_PER_WIDE_INT); + if (shift_amount == HOST_BITS_PER_WIDE_INT) /* Shifting by the host word size is undefined according to the ANSI standard, so we must handle this as a special case. */ high_value = -1; @@ -1133,8 +1128,7 @@ list_length (tree t) #ifdef ENABLE_TREE_CHECKING if (len % 2) q = TREE_CHAIN (q); - if (p == q) - abort (); + gcc_assert (p != q); #endif len++; } @@ -1179,8 +1173,7 @@ chainon (tree op1, tree op2) { tree t2; for (t2 = op2; t2; t2 = TREE_CHAIN (t2)) - if (t2 == t1) - abort (); /* Circularity created. */ + gcc_assert (t2 != t1); } #endif @@ -1632,7 +1625,7 @@ tree_node_structure (tree t) case VALUE_HANDLE: return TS_VALUE_HANDLE; default: - abort (); + gcc_unreachable (); } } @@ -1799,7 +1792,7 @@ type_contains_placeholder_p (tree type) } default: - abort (); + gcc_unreachable (); } } @@ -1960,12 +1953,12 @@ substitute_in_expr (tree exp, tree f, tree r) break; default: - abort (); + gcc_unreachable (); } break; default: - abort (); + gcc_unreachable (); } TREE_READONLY (new) = TREE_READONLY (exp); @@ -2090,12 +2083,12 @@ substitute_placeholder_in_expr (tree exp, tree obj) return fold (build4 (code, TREE_TYPE (exp), op0, op1, op2, op3)); default: - abort (); + gcc_unreachable (); } break; default: - abort (); + gcc_unreachable (); } } @@ -2255,7 +2248,7 @@ stabilize_reference_1 (tree e) break; default: - abort (); + gcc_unreachable (); } TREE_TYPE (result) = TREE_TYPE (e); @@ -2369,10 +2362,7 @@ build0_stat (enum tree_code code, tree tt MEM_STAT_DECL) { tree t; -#ifdef ENABLE_CHECKING - if (TREE_CODE_LENGTH (code) != 0) - abort (); -#endif + gcc_assert (TREE_CODE_LENGTH (code) == 0); t = make_node_stat (code PASS_MEM_STAT); TREE_TYPE (t) = tt; @@ -2407,10 +2397,7 @@ build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL) tree_node_sizes[(int) kind] += length; #endif -#ifdef ENABLE_CHECKING - if (TREE_CODE_LENGTH (code) != 1) - abort (); -#endif /* ENABLE_CHECKING */ + gcc_assert (TREE_CODE_LENGTH (code) == 1); t = ggc_alloc_zone_stat (length, tree_zone PASS_MEM_STAT); @@ -2498,10 +2485,7 @@ build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL) tree t; int fro; -#ifdef ENABLE_CHECKING - if (TREE_CODE_LENGTH (code) != 2) - abort (); -#endif + gcc_assert (TREE_CODE_LENGTH (code) == 2); t = make_node_stat (code PASS_MEM_STAT); TREE_TYPE (t) = tt; @@ -2541,10 +2525,7 @@ build3_stat (enum tree_code code, tree tt, tree arg0, tree arg1, tree t; int fro; -#ifdef ENABLE_CHECKING - if (TREE_CODE_LENGTH (code) != 3) - abort (); -#endif + gcc_assert (TREE_CODE_LENGTH (code) == 3); t = make_node_stat (code PASS_MEM_STAT); TREE_TYPE (t) = tt; @@ -2592,10 +2573,7 @@ build4_stat (enum tree_code code, tree tt, tree arg0, tree arg1, tree t; int fro; -#ifdef ENABLE_CHECKING - if (TREE_CODE_LENGTH (code) != 4) - abort (); -#endif + gcc_assert (TREE_CODE_LENGTH (code) == 4); t = make_node_stat (code PASS_MEM_STAT); TREE_TYPE (t) = tt; @@ -2654,7 +2632,7 @@ tree t = build4 (code, tt, arg0, arg1, arg2, arg3); break; default: - abort (); + gcc_unreachable (); } va_end (p); @@ -2973,10 +2951,10 @@ is_attribute_p (const char *attr, tree ident) /* If ATTR is `__text__', IDENT must be `text'; and vice versa. */ if (attr[0] == '_') { - if (attr[1] != '_' - || attr[attr_len - 2] != '_' - || attr[attr_len - 1] != '_') - abort (); + gcc_assert (attr[1] == '_'); + gcc_assert (attr[attr_len - 2] == '_'); + gcc_assert (attr[attr_len - 1] == '_'); + gcc_assert (attr[1] == '_'); if (ident_len == attr_len - 4 && strncmp (attr + 2, p, attr_len - 4) == 0) return 1; @@ -3006,8 +2984,7 @@ lookup_attribute (const char *attr_name, tree list) for (l = list; l; l = TREE_CHAIN (l)) { - if (TREE_CODE (TREE_PURPOSE (l)) != IDENTIFIER_NODE) - abort (); + gcc_assert (TREE_CODE (TREE_PURPOSE (l)) == IDENTIFIER_NODE); if (is_attribute_p (attr_name, TREE_PURPOSE (l))) return l; } @@ -3491,8 +3468,7 @@ type_hash_canon (unsigned int hashcode, tree type) /* The hash table only contains main variants, so ensure that's what we're being passed. */ - if (TYPE_MAIN_VARIANT (type) != type) - abort (); + gcc_assert (TYPE_MAIN_VARIANT (type) == type); if (!lang_hooks.types.hash_types) return type; @@ -3743,10 +3719,8 @@ host_integerp (tree t, int pos) HOST_WIDE_INT tree_low_cst (tree t, int pos) { - if (host_integerp (t, pos)) - return TREE_INT_CST_LOW (t); - else - abort (); + gcc_assert (host_integerp (t, pos)); + return TREE_INT_CST_LOW (t); } /* Return the most significant bit of the integer constant T. */ @@ -4107,7 +4081,7 @@ iterative_hash_expr (tree t, hashval_t val) val = iterative_hash_expr (TREE_OPERAND (t, i), val); } else - abort (); + gcc_unreachable (); return val; break; } @@ -4487,8 +4461,7 @@ build_method_type_directly (tree basetype, tree build_method_type (tree basetype, tree type) { - if (TREE_CODE (type) != FUNCTION_TYPE) - abort (); + gcc_assert (TREE_CODE (type) == FUNCTION_TYPE); return build_method_type_directly (basetype, TREE_TYPE (type), @@ -5047,7 +5020,7 @@ decl_type_context (tree decl) break; default: - abort (); + gcc_unreachable (); } return NULL_TREE; @@ -5064,8 +5037,7 @@ get_callee_fndecl (tree call) /* It's invalid to call this function with anything but a CALL_EXPR. */ - if (TREE_CODE (call) != CALL_EXPR) - abort (); + gcc_assert (TREE_CODE (call) == CALL_EXPR); /* The first operand to the CALL is the address of the function called. */ @@ -5265,9 +5237,10 @@ get_set_constructor_bits (tree init, char *buffer, int bit_size) HOST_WIDE_INT hi_index = tree_low_cst (TREE_VALUE (vals), 0) - domain_min; - if (lo_index < 0 || lo_index >= bit_size - || hi_index < 0 || hi_index >= bit_size) - abort (); + gcc_assert (lo_index >= 0); + gcc_assert (lo_index < bit_size); + gcc_assert (hi_index >= 0); + gcc_assert (hi_index < bit_size); for (; lo_index <= hi_index; lo_index++) buffer[lo_index] = 1; } @@ -5703,21 +5676,25 @@ build_vector_type_for_mode (tree innertype, enum machine_mode mode) { int nunits; - if (GET_MODE_CLASS (mode) == MODE_VECTOR_INT - || GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT) - nunits = GET_MODE_NUNITS (mode); - - else if (GET_MODE_CLASS (mode) == MODE_INT) + switch (GET_MODE_CLASS (mode)) { + case MODE_VECTOR_INT: + case MODE_VECTOR_FLOAT: + nunits = GET_MODE_NUNITS (mode); + break; + + case MODE_INT: /* Check that there are no leftover bits. */ - if (GET_MODE_BITSIZE (mode) % TREE_INT_CST_LOW (TYPE_SIZE (innertype))) - abort (); + gcc_assert (GET_MODE_BITSIZE (mode) + % TREE_INT_CST_LOW (TYPE_SIZE (innertype)) == 0); nunits = GET_MODE_BITSIZE (mode) / TREE_INT_CST_LOW (TYPE_SIZE (innertype)); + break; + + default: + gcc_unreachable (); } - else - abort (); return make_vector_type (innertype, nunits, mode); } @@ -5903,8 +5880,7 @@ int_cst_value (tree x) unsigned HOST_WIDE_INT val = TREE_INT_CST_LOW (x); bool negative = ((val >> (bits - 1)) & 1) != 0; - if (bits > HOST_BITS_PER_WIDE_INT) - abort (); + gcc_assert (bits <= HOST_BITS_PER_WIDE_INT); if (negative) val |= (~(unsigned HOST_WIDE_INT) 0) << (bits - 1) << 1; @@ -5923,11 +5899,8 @@ tree_fold_gcd (tree a, tree b) tree a_mod_b; tree type = TREE_TYPE (a); -#if defined ENABLE_CHECKING - if (TREE_CODE (a) != INTEGER_CST - || TREE_CODE (b) != INTEGER_CST) - abort (); -#endif + gcc_assert (TREE_CODE (a) == INTEGER_CST); + gcc_assert (TREE_CODE (b) == INTEGER_CST); if (integer_zerop (a)) return b; -- 2.30.2