aboutsummaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@gcc.gnu.org>2004-09-09 17:19:16 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2004-09-09 17:19:16 +0000
commit41374e13ac15863e80fff7c4b8731ab34b1921f9 (patch)
tree4493ed2091b537830e81c4e1100321bb065757b7 /gcc/stor-layout.c
parent15072eb1299f2e6f415798e4bbaf054ddc905645 (diff)
downloadgcc-41374e13ac15863e80fff7c4b8731ab34b1921f9.zip
gcc-41374e13ac15863e80fff7c4b8731ab34b1921f9.tar.gz
gcc-41374e13ac15863e80fff7c4b8731ab34b1921f9.tar.bz2
ra-build.c (copy_insn_p, [...]): Use gcc_assert and gcc_unreachable instead of abort.
* ra-build.c (copy_insn_p, remember_move, defuse_overlap_p_1, live_out_1, prune_hardregs_for_mode, init_one_web_common, reinit_one_web, add_subweb, add_subweb_2, init_web_parts, record_conflict, compare_and_free_webs, init_webs_defs_uses, parts_to_webs_1, parts_to_webs, reset_conflicts, check_conflict_numbers, remember_web_was_spilled, handle_asm_insn, ra_build_free): Use gcc_assert and gcc_unreachable instead of abort. * ra-colorize.c (push_list, put_web, reset_lists, put_web_at_end, put_move, remove_move, combine, select_spill, colorize_one_web, try_recolor_web, insert_coalesced_conflicts, check_colors, break_precolored_alias, restore_conflicts_from_coalesce, sort_and_combine_web_pairs, check_uncoalesced_moves): Likewise. * ra-rewrite.c (spill_coalescing, slots_overlap_p, emit_loads, reloads_to_loads, rewrite_program2, emit_colors): Likewise. * ra.c (first_hard_reg, create_insn_info, find_subweb, init_ra, check_df): Likewise. * real.c (do_add, do_multiply, do_divide, do_compare, do_fix_trunc, real_arithmetic, real_compare, real_exponent, real_ldexp, real_identical, real_to_integer, real_to_integer2, real_to_decimal, real_to_hexadecimal, real_from_integer, ten_to_ptwo, ten_to_mptwo, real_digit, real_nan, real_maxval, round_for_format, real_convert, real_to_target, real_from_target, real_hash, encode_ieee_single, encode_ieee_double, encode_ieee_extended, encode_ieee_quad, encode_vax_f, encode_vax_d, encode_vax_g, encode_i370_single, encode_i370_double, encode_c4x_single, encode_c4x_extended): Likewise. * recog.c (validate_change, validate_replace_rtx_1, asm_operand_ok, extract_insn, peep2_next_insn, peep2_reg_dead_p, peep2_find_free_register, peephole2_optimize, store_data_bypass_p, if_test_bypass_p): Likewise. * reg-stack.c (record_label_references, get_asm_operand_n_inputs, stack_result, remove_regno_note, get_hard_regnum, emit_pop_insn, emit_swap_insn, swap_to_top, move_for_stack_reg, subst_stack_regs_pat, subst_asm_stack_regs, change_stack, compensate_edge, convert_regs_1): Likewise. * regclass.c (init_reg_sets, init_reg_sets_1, memory_move_secondary_cost): Likewise. * regrename.c (note_sets, clear_dead_regs, scan_rtx_reg, scan_rtx): Likewise. * reload.c (push_secondary_reload, find_valid_class, push_reload, operands_match_p, decompose, immune_p, find_reloads, find_reloads_toplev, find_reloads_address_1, subst_reloads, copy_replacements, refers_to_regno_for_reload_p, reg_overlap_mentioned_for_reload_p): Likewise. * reload1.c (compute_use_by_pseudos, replace_pseudos_in, reload, count_pseudo, find_reg, eliminate_regs, eliminate_regs_in_insn, verify_initial_elim_offsets, finish_spills, clear_reload_reg_in_use, reload_reg_free_p, reload_reg_reaches_end_p, reloads_conflict, choose_reload_regs, merge_assigned_reloads, emit_input_reload_insns, do_output_reload, fixup_abnormal_edges): Likewise. * reorg.c (stop_search_p, emit_delay_sequence, get_jump_flags, fill_slots_from_thread, relax_delay_slots): Likewise. * resource.c (mark_referenced_resources, mark_set_resources): Likewise. * rtl.c (copy_rtx, rtx_equal_p): Likewise. * rtlanal.c (insn_dependent_p, reg_overlap_mentioned_p, dead_or_set_p, find_reg_fusage, remove_note, replace_rtx, subreg_lsb_1, subreg_regno_offset, subreg_offset_representable_p, find_first_parameter_load, can_hoist_insn_p, hoist_update_store, hoist_insn_after, hoist_insn_to_edge, nonzero_bits1): Likewise. * rtlhooks.c (gen_lowpart_general): Likewise. * sbitmap.c (sbitmap_difference): Likewise. * sched-deps.c (add_dependence, sched_analyze_1, sched_analyze_2, sched_analyze, add_forward_dependence): Likewise. * sched-ebb.c (fix_basic_block_boundaries, schedule_ebb): Likewise. * sched-rgn.c (debug_regions, compute_trg_info, schedule_region, schedule_insns): Likewise. * sched-vis.c (print_pattern): Likewise. * sdbout.c (sdbout_symbol, sdbout_toplevel_data): Likewise. * simplify-rtx.c (simplify_unary_operation, simplify_binary_operation, simplify_const_relational_operation, simplify_ternary_operation, simplify_immed_subreg, simplify_subreg, simplify_gen_subreg): Likewise. * sreal.c (copy, sreal_sub, sreal_div): Likewise. * stmt.c (force_label_rtx, expand_goto, expand_asm_operands, resolve_operand_name_1, expand_return, expand_decl, expand_anon_union_decl, emit_case_bit_tests, expand_case): Likewise. * stor-layout.c (put_pending_size, smallest_mode_for_size, int_mode_for_mode, layout_decl, finish_builtin_struct, layout_type, set_sizetype, get_mode_bounds): Likewise. From-SVN: r87244
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c84
1 files changed, 41 insertions, 43 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 01c9947..12d6d48 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -108,9 +108,7 @@ put_pending_size (tree expr)
void
put_pending_sizes (tree chain)
{
- if (pending_sizes)
- abort ();
-
+ gcc_assert (!pending_sizes);
pending_sizes = chain;
}
@@ -220,7 +218,7 @@ smallest_mode_for_size (unsigned int size, enum mode_class class)
if (GET_MODE_PRECISION (mode) >= size)
return mode;
- abort ();
+ gcc_unreachable ();
}
/* Find an integer mode of the exact same size, or BLKmode on failure. */
@@ -250,7 +248,7 @@ int_mode_for_mode (enum machine_mode mode)
case MODE_CC:
default:
- abort ();
+ gcc_unreachable ();
}
return mode;
@@ -302,10 +300,10 @@ layout_decl (tree decl, unsigned int known_align)
if (code == CONST_DECL)
return;
- else if (code != VAR_DECL && code != PARM_DECL && code != RESULT_DECL
- && code != TYPE_DECL && code != FIELD_DECL)
- abort ();
-
+
+ gcc_assert (code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL
+ || code == TYPE_DECL ||code == FIELD_DECL);
+
rtl = DECL_RTL_IF_SET (decl);
if (type == error_mark_node)
@@ -1477,8 +1475,7 @@ finish_builtin_struct (tree type, const char *name, tree fields,
void
layout_type (tree type)
{
- if (type == 0)
- abort ();
+ gcc_assert (type);
if (type == error_mark_node)
return;
@@ -1492,7 +1489,7 @@ layout_type (tree type)
case LANG_TYPE:
/* This kind of type is the responsibility
of the language-specific code. */
- abort ();
+ gcc_unreachable ();
case BOOLEAN_TYPE: /* Used for Java, Pascal, and Chill. */
if (TYPE_PRECISION (type) == 0)
@@ -1536,8 +1533,7 @@ layout_type (tree type)
tree nunits_tree = build_int_cst (NULL_TREE, nunits);
tree innertype = TREE_TYPE (type);
- if (nunits & (nunits - 1))
- abort ();
+ gcc_assert (!(nunits & (nunits - 1)));
/* Find an appropriate mode for the vector type. */
if (TYPE_MODE (type) == VOIDmode)
@@ -1758,33 +1754,37 @@ layout_type (tree type)
break;
case SET_TYPE: /* Used by Chill and Pascal. */
- if (TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (type))) != INTEGER_CST
- || TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) != INTEGER_CST)
- abort ();
- else
- {
+ {
+ unsigned int alignment;
+ HOST_WIDE_INT size_in_bits;
+ HOST_WIDE_INT rounded_size;
+
+ gcc_assert (TREE_CODE (TYPE_MAX_VALUE (TYPE_DOMAIN (type)))
+ == INTEGER_CST);
+ gcc_assert (TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (type)))
+ == INTEGER_CST);
+
#ifndef SET_WORD_SIZE
#define SET_WORD_SIZE BITS_PER_WORD
#endif
- unsigned int alignment
- = set_alignment ? set_alignment : SET_WORD_SIZE;
- HOST_WIDE_INT size_in_bits
- = (tree_low_cst (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), 0)
- - tree_low_cst (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), 0) + 1);
- HOST_WIDE_INT rounded_size
- = ((size_in_bits + alignment - 1) / alignment) * alignment;
-
- if (rounded_size > (int) alignment)
- TYPE_MODE (type) = BLKmode;
- else
- TYPE_MODE (type) = mode_for_size (alignment, MODE_INT, 1);
-
- TYPE_SIZE (type) = bitsize_int (rounded_size);
- TYPE_SIZE_UNIT (type) = size_int (rounded_size / BITS_PER_UNIT);
- TYPE_ALIGN (type) = alignment;
- TYPE_USER_ALIGN (type) = 0;
- TYPE_PRECISION (type) = size_in_bits;
- }
+ alignment = set_alignment ? set_alignment : SET_WORD_SIZE;
+ size_in_bits
+ = (tree_low_cst (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), 0)
+ - tree_low_cst (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), 0) + 1);
+ rounded_size
+ = ((size_in_bits + alignment - 1) / alignment) * alignment;
+
+ if (rounded_size > (int) alignment)
+ TYPE_MODE (type) = BLKmode;
+ else
+ TYPE_MODE (type) = mode_for_size (alignment, MODE_INT, 1);
+
+ TYPE_SIZE (type) = bitsize_int (rounded_size);
+ TYPE_SIZE_UNIT (type) = size_int (rounded_size / BITS_PER_UNIT);
+ TYPE_ALIGN (type) = alignment;
+ TYPE_USER_ALIGN (type) = 0;
+ TYPE_PRECISION (type) = size_in_bits;
+ }
break;
case FILE_TYPE:
@@ -1796,7 +1796,7 @@ layout_type (tree type)
break;
default:
- abort ();
+ gcc_unreachable ();
}
/* Compute the final TYPE_SIZE, TYPE_ALIGN, etc. for TYPE. For
@@ -1886,8 +1886,7 @@ set_sizetype (tree type)
2 * HOST_BITS_PER_WIDE_INT);
tree t;
- if (TYPE_UNSIGNED (type) != TYPE_UNSIGNED (sizetype))
- abort ();
+ gcc_assert (TYPE_UNSIGNED (type) == TYPE_UNSIGNED (sizetype));
t = build_distinct_type_copy (type);
/* We do want to use sizetype's cache, as we will be replacing that
@@ -2109,8 +2108,7 @@ get_mode_bounds (enum machine_mode mode, int sign,
unsigned size = GET_MODE_BITSIZE (mode);
unsigned HOST_WIDE_INT min_val, max_val;
- if (size > HOST_BITS_PER_WIDE_INT)
- abort ();
+ gcc_assert (size <= HOST_BITS_PER_WIDE_INT);
if (sign)
{