diff options
author | Richard Kenner <kenner@vlsi1.ultra.nyu.edu> | 2000-03-25 18:34:13 +0000 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 2000-03-25 13:34:13 -0500 |
commit | 770ae6cc710a7a0f7db4ef7f09941bbe19d0ee78 (patch) | |
tree | 2aa8734829bb9352ea3ee4958179c54a164bfc53 /gcc/reload1.c | |
parent | 370af2d55a9765c7e5796f80dfa97b04283b2ab9 (diff) | |
download | gcc-770ae6cc710a7a0f7db4ef7f09941bbe19d0ee78.zip gcc-770ae6cc710a7a0f7db4ef7f09941bbe19d0ee78.tar.gz gcc-770ae6cc710a7a0f7db4ef7f09941bbe19d0ee78.tar.bz2 |
* Rework fields used to describe positions of bitfields and
modify sizes to be unsigned and use HOST_WIDE_INT.
* alias.c (reg_known_value_size): Now unsigned.
* c-typeck.c (build_unary_op, case ADDR_EXPR): Use byte_position.
(really_start_incremental_init): Use bitsize_zero_node.
(push_init_level, pop_init_level, output_init_element): Likewise.
Use bitsize_unit_node and bitsize_one_node.
(output_pending_init_elements, process_init_element): Likewise.
* combine.c (combine_max_regno, reg_sign_bit_copies): Now unsigned.
(make_extraction): Position and length HOST_WIDE_INT and unsigned
HOST_WIDE_INT, respectively.
(get_pos_from_mask): Passed in value is unsigned HOST_WIDE_INT.
(num_sign_bit_copies): Returns unsigned.
BITWIDTH now unsigned; rework arithmetic.
Remove recursive call from arg to MAX.
(combine_instructions, init_reg_last_arrays): NREGS now unsigned.
(setup_incoming_promotions, can_combine_p, try_combine, simplify_set):
REGNO now unsigned.
(set_nonzero_bit_and_sign_copies): NUM now unsigned.
(find_split_point, expand_compound_operation, make_extraction): LEN
now unsigned HOST_WIDE_INT, POS now HOST_WIDE_INT.
(make_field_assignment): Likewise.
(combine_simplify_rtx): Add cast.
(expand_compound_operation): MODEWIDTH now unsigned; rework arithmetic.
(force_to_mode): WIDTH now unsigned; add cast.
(if_then_else_cond): SIZE now unsigned.
(nonzero_bits): MODE_WIDTH, RESULT_WIDTH, and WIDTH now unsigned.
(extended_count): Now returns unsigned.
(simplify_shift_const): COUNT unsigned; arg is now INPUT_COUNT.
Add SIGNED_COUNT variable; MODE_WORDS and FIRST_COUNT now unsigned.
(simplify_comparison): MODE_WIDTH now unsigned.
(update_table_tick): REGNO and ENDREGNO now unsigned; new var R.
(mark_used_regs_combine): Likewise; rework arithmetic.
(record_value_for_reg): REGNO, ENDREGNO, and I now unsigned.
(record_dead_and_set_regs, reg_dead_at_p, distribute_notes): Likewise.
(record_promoted_value): REGNO now unsigned.
(get_last_value_validate): REGNO, ENDREGNO, and J now unsigned.
(get_last_value): REGNO now unsigned.
(use_crosses_set_p): REGNO and ENDREGNO now unsigned.
(reg_dead_regno, reg_dead_endregno): Now unsigned.
(remove_death): Arg REGNO now unsigned.
(move_deaths): REGNO, DEADREGNO, DEADEND, OUREND, and I now unsigned.
(reg_bitfield_target_p): REGNO, REGNO, ENDREGNO, and ENDTREGNO
now unsigned.
* convert.c (convert_to_integer): INPREC and OUTPREC now unsigned.
* cse.c (struct qty_table_elem): FIRST_REG and LAST_REG now unsigned.
(struct cse_reg_info): REGNO now unsigned.
(cached_regno): Now unsigned.
(REGNO_QTY_VALID_P): Add cast.
(make_new_qty, make_regs_eqv, delete_reg_eqiv): Regno args unsigned.
(remove_invalid_regs): Likewise.
(remove_invalid_subreg_refs): Likewise; arg WORD also unsigned
as are variables END and I.
(get_cse_reg_info, insert): Likewise.
(mention_regs, invalidate_for_call): REGNO, ENDREGNO, and I unsigned.
(canon_hash): Likewise.
(insert_regs, lookup_for_remove): REGNO now unsigned.
(invalidate): REGNO, ENDREGNO, TREGNO, and TENDREGNO now unsigned.
New variable RN.
* dbxout.c (dbxout_parms, dbxout_reg_parms): Don't check for REGNO < 0.
* dwarf2out.c (dwarf2ou_frame_debug_expr): Remove cast.
* emit-rtl.c (subreg_realpart_p): Add cast.
(operand_subword): Arg I is now unsigned as is var PARTWORDS.
(operand_subword_force): Arg I is now unsigned.
* except.c (eh_regs): Variable I is now unsigned.
* explow.c (hard_function_value): BYTES is unsigned HOST_WIDE_INT.
* expmed.c (store_fixed_bit_field): Position is HOST_WIDE_INT;
length is unsigned HOST_WIDE_INT; likewise for internal variables.
(store_split_bit_field, extract_fixed_bit_field): Likewise.
(extract_split_bit_field, store_bit_field, extract_bit_field):
Likewise.
* expr.c (store_constructor_fields, store_constructor, store_field):
Positions are HOST_WIDE_INT and lengths are unsigned HOST_WIDE_INT.
(expand_assignment, expand_expr, expand_expr_unaligned): Likewise.
(do_jump): Likewise.
(move_by_pieces, move_by_pieces_ninsns, clear_by_pieces):
MAX_SIZE is now unsigned.
(emit_group_load): BYTEPOS is HOST_WIDE_INT; BYTELEN is unsigned.
(emit_group_store): Likewise.
(emit_move_insn): I now unsigned.
(store_constructor): Use host_integerp, tree_low_cst, and
bitsize_unit_node.
(get_inner_reference): Return bitpos and bitsize as HOST_WIDE_INT.
Rework all calculations to use trees and new fields.
* expr.h (promoted_input_arg): Regno now unsigned.
(store_bit_field, extract_bit_field): Adjust types of pos and size.
(mark_seen_cases): Arg is HOST_WIDE_INT.
* flow.c (verify_wide_reg_1): REGNO now unsigned.
* fold-const.c (decode_field_reference): Size and pos HOST_WIDE_INT;
precisions and alignments are unsigned.
(optimize_bit_field_compare, fold_truthop): Likewise.
(int_const_binop): Adjust threshold for size_int_type_wide call.
(fold_convert): Likewise.
(size_int_type_wide): Make table larger and fix thinko that only
had half of table used.
(all_ones_mask_p, fold): Precisions are unsigned.
* function.c (put_reg_info_stack): REGNO is unsigned.
(instantiate_decl): Size is HOST_WIDE_INT.
(instantiate_virtual_regs): I is unsigned.
(assign_parms): REGNO, REGNOI, and REGNOR are unsigned.
(promoted_input_arg): REGNO is unsigned.
* function.h (struct function): x_max_parm_reg is now unsigned.
* gcse.c (max_gcse_regno): Now unsigned.
(struct null_pointer_info): min_reg and max_reg now unsigned.
(lookup_set, next_set): REGNO arg now unsigned.
(compute_hash_table): REGNO and I now unsigned.
(handle_avail_expr): regnum_for_replacing now unsigned.
(cprop_insn): REGNO now unsigned.
(delete_null_pointer_checks_1): BLOCK_REG now pointer to unsigned.
* ggc-common.c (ggc_mark_tree_children, case FIELD_DECL): New case.
* global.c (set_preference): SRC_REGNO, DEST_REGNO, and I now unsigned.
* hard-reg-set.h (reg_class_size): Now unsigned.
* integrate.c (mark_stores): LAST_REG and I now unsigned; new UREGNO.
* jump.c (mark_modified_reg): I now unsigned; add cast.
(rtx_equal_for_thread_p): Add cast.
* loop.c (max_reg_before_loop): Now unsigned.
(struct_movable): REGNO now unsigned.
(try_copy_prop): REGNO arg unsigned.
(regs_match_p): XN and YN now unsigned.
(consec_sets_invariant_p, maybe_eliminate_biv): REGNO now unsigned.
(strength_reduce): Likewise; NREGS also unsigned.
(first_increment_giv, last_increment_giv unsigned): Now unsigned.
* loop.h (struct iv_class): REGNO now unsigned.
(max_reg_before_loop, first_increment_giv, last_increment_giv):
Now unsigned.
* machmode.h (mode_size, mode_unit_size): Now unsigned.
(mode_for_size, smallest_mode_for_size): Pass size as unsigned.
* optabs.c (expand_binop): I and NWORDS now unsigned.
(expand_unop): I now unsigned.
* print-tree.c (print_node): Don't print DECL_FIELD_BITPOS, but do
print DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET.
* real.c (significand_size): Now returns unsigned.
* real.h (significand_size): Likewise.
* regclass.c (reg_class_size): Now unsigned.
(choose_hard_reg_mode): Both operands now unsigned.
(record_reg_classes): REGNO and NR now unsigned.
(reg_scan): NREGS now unsigned.
(reg_scan_update): old_max_regno now unsigned.
(reg_scan_mark_refs): Arg MIN_REGNO and var REGNO now unsigned.
* reload.c (find_valid_class): BEST_SIZE now unsigned.
(find_dummy_reload): REGNO, NWORDS, and I now unsigned.
(hard_reg_set_here_p): Args BEG_REGNO and END_REGNO now unsigned.
Likewise for variable R.
(refers_to_regno_for_reload_p): Args REGNO and END_REGNO now unsigned,
as are variables INNER_REGNO and INNER_ENDREGNO; add new variable R.
(find_equiv_reg): Add casts.
(regno_clobbered_p): Arg REGNO now unsigned.
* reload.h (struct reload): NREGS now unsigned.
(refers_to_regno_for_reload_p): Regno args are unsigned.
(regno_clobbered_p): Likewise.
* reload1.c (reg_max_ref_width, spill_stack_slot_width): Now unsigned.
(compute_use_by_pseudos): REGNO now unsigned.
(find_reg): I and J now unsigned, new variable K, and change loop
variables accordingly; THIS_NREGS now unsigned.
(alter_reg): INHERENT_SIZE and TOTAL_SIZE now unsigned.
(spill_hard_reg): REGNO arg now unsigned; add casts.
(forget_old_reloads_1): REGNO, NR, and I now unsigned.
(mark_reload_reg_in_use): Arg REGNO and vars NREGS and I now unsigned.
(clear_reload_reg_in_use): Arg REGNO and vars NREGS, START_REGNO,
END_REGNO, CONFLICT_START, and CONFLICT_END now unsigned.
(reload_reg_free_p, reload_reg_reaches_end_p): Arg REGNO now unsigned.
(choose_reload_regs): MAX_GROUP_SIZE now unsigned.
(emit_reload_insns): REGNO now unsigned.
(reload_cse_move2add): Add cast.
(move2add_note_store): REGNO and I now unsigned; new variable ENDREGNO
and rework loop.
* resource.c (mark_referenced_resources, mark_set_resources): New
variable R; REGNO and LAST_REGNO now unsigned.
(mark_target_live_regs): J and REGNO now unsigned.
* rtl.c (mode_size, mode_unit_size): Now unsigned.
* rtl.h (union rtunion_def): New field rtuint.
(XCUINT): New macro.
(ADDRESSOF_REGNO, REGNO, SUBREG_WORD): New XCUINT.
(operand_subword, operand_subword_force): Word number is unsigned.
(choose_hard_reg_mode): Operands are unsigned.
(refers_to-regno_p, dead_or_set_regno_p): Regno arg is unsigned.
(find_regno_note, find_regno_fusage, replace_regs): Likewise.
(regno_use_in, combine_instructions, remove_death): Likewise.
(reg_scan, reg_scan_update): Likewise.
(extended_count): Return is unsigned.
* rtlanal.c (refers_to_regno_p): Args REGNO and ENDREGNO and vars I,
INNER_REGNO, and INNER_ENDREGNO now unsigned; new variable X_REGNO.
(reg_overlap_mentioned_p): REGNO and ENDREGNO now unsigned.
(reg_set_last_first_regno, reg_set_last_last_regno): Now unsigned.
(reg_reg_last_1): FIRS and LAST now unsigned.
(dead_or_set_p): REGNO, LAST_REGNO, and I now unsigned.
(dead_or_set_regno_p): Arg TEST_REGNO and vars REGNO and ENDREGNO
now unsigned.
(find_regno_note, regno_use_in): Arg REGNO now unsigned.
(find_regno_fusage): Likewise; also var REGNOTE now unsigned.
(find_reg_fusage): Variables REGNO, END_REGNO, and I now unsigned.
(replace_regs): Arg NREGS now unsigned.
* sdbout.c (sdbout_parms, sdbout_reg_parms): Don't check REGNO < 0.
* simplify-rtx.c (simplify_unary_operation): WIDTH now unsigned.
(simplify_binary_operation): Likewise.
(cselib_invalidate_regno): Arg REGNO and variables ENDREGNO, I, and
THIS_LAST now unsigned.
(cselib_record_set): Add cast.
* ssa.c (ssa_max_reg_num): Now unsigned.
(rename_block): REGNO now unsigned.
* stmt.c (expand_return): Bit positions unsigned HOST_WIDE_INT;
sizes now unsigned.
(all_cases_count): Just return -1 not -2.
COUNT, MINVAL, and LASTVAL now HOST_WIDE_INT.
Rework tests to use trees whenever possible.
Use host_integerp and tree_low_cst.
(mark_seen_cases): COUNT arg now HOST_WIDE_INT;
Likewise variable NEXT_NODE_OFFSET; XLO now unsigned.
(check_for_full_enumeration_handing): BYTES_NEEDED, I to HOST_WIDE_INT.
* stor-layout.c (mode_for_size): SIZE arg now unsigned.
(smallest_mode_for_size): Likewise.
(layout_decl): Simplify handing of a specified DECL_SIZE_UNIT.
KNOWN_ALIGN is now an alignment, so simplify code.
Don't turn off DECL_BIT_FIELD if field is BLKmode, but not type.
(start_record_layout): Renamed from new_record_layout_info.
Update to new fields.
(debug_rli, normalize_rli, rli_size_unit_so_far, rli_size_so_far):
New functions.
(place_union_field): Renamed from layout_union_field.
Update to use new fields in rli.
(place_field): Renamed from layout_field.
Major rewrite to use new fields in rli; pass alignment to layout_decl.
(finalize_record_size): Rework to use new fields in rli and handle
union.
(compute_record_mode): Rework to simplify and to use new DECL fields.
(finalize_type_size): Make rounding more consistent.
(finish_union_layout): Deleted.
(layout_type, case VOID_TYPE): Don't set TYPE_SIZE_UNIT either.
(layout_type, case RECORD_TYPE): Call new function names.
(initialize_sizetypes): Set TYPE_IS_SIZETYPE.
(set_sizetype): Set TYPE_IS_SIZETYPE earlier.
(get_best_mode): UNIT is now unsigned; remove casts.
* tree.c (bit_position): Compute from new fields.
(byte_position, int_byte_position): New functions.
(print_type_hash_statistics): Cast to remove warning.
(build_range_type): Use host_integerp and tree_low_cst to try to hash.
(build_index_type): Likewise; make subtype of sizetype.
(build_index_2_type): Pass sizetype to build_range_type.
(build_common_tree_nodes): Use size_int and bitsize_int to
initialize nodes; add bitsize_{zero,one,unit}_node.
* tree.h (DECL_FIELD_CONTEXT): Use FIELD_DECL_CHECK.
(DECL_BIT_FIELD_TYPE, DECL_QUALIFIER, DECL_FCONTEXT): Likewise.
(DECL_PACKED, DECL_BIT_FIELD): Likewise.
(DECL_FIELD_BITPOS): Deleted.
(DECL_FIELD_OFFSET, DECL_FIELD_BIT_OFFSET): New fields.
(DECL_RESULT, DECL_SAVED_INSNS): Use FUNCTION_DECL_CHECK.
(DECL_FRAME_SIZE, DECL_FUNCTION_CODE, DECL_NO_STATIC_CHAIN): Likewise.
(DECL_INLINE, DECL_BUILT_IN_NONANSI, DECL_IS_MALLOC): Likewise.
(DECL_BUILT_IN_CLASS, DECL_STATIC_CONSTRUCTOR): Likewise.
(DECL_STATIC_DESTRUCTOR, DECL_NO_CHECK_MEMORY_USAGE): Likewise.
(DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT, DECL_NO_LIMIT_STACK) Likewise.
(DECL_ORIGINAL_TYPE, TYPE_DECL_SUPPRESS_DEBUG): Use TYPE_DECL_CHECK.
(DECL_ARG_TYPE_AS_WRITEN, DECL_ARG_TYPE): Use PARM_DECL_CHECK.
(DECL_INCOMING_RTL, DECL_TRANSPARENT_UNION): Likewise.
(DECL_ALIGN): Adjust to new field in union.
(DECL_OFFSET_ALIGN): New field.
(DECL_ERROR_ISSUED, DECL_TOO_LATE): Use LABEL_DECL_CHECK.
(DECL_IN_TEXT_SECTION): Use VAR_DECL_CHECK.
(union tree_decl): Add struct for both aligns.
(enum tree_index): Add TI_BITSIZE_{ZERO,ONE,UNIT}.
(bitsize_zero_node, bitsize_one_node, bitsize_unit_node): Added.
(struct record_layout_info): Rework fields to have offset
alignment and byte and bit position.
(start_record_layout, place_field): Renamed from old names.
(rli_size_so_far, rli_size_unit_so_far, normalize_rli): New decls.
(byte_position, int_byte_position): Likewise.
(get_inner_reference): Change types of position and length.
* unroll.c (unroll_loop): New variable R; use for some loops.
MAX_LOCAL_REGNUM and MAXREGNUM now unsigned.
(calculate_giv_inc): Arg REGNO now unsigned.
(copy_loop_body): REGNO and SRC_REGNO now unsigned.
* varasm.c (assemble_variable): Clean up handling of size using
host_integerp and tree_low_cst.
(decode_addr_const): Use byte, not bit, position.
(output_constructor): bitpos and offsets are HOST_WIDE_INT;
use tree_low_cst and int_bit_position.
* objc/objc-act.c (build_ivar_list_initializer): Use byte_position.
* ch/actions.c (check_missing_cases): BYTES_NEEDED is HOST_WIDE_INT.
* ch/typeck.c (expand_constant_to_buffer): Use int_byte_position.
(extract_constant_from_buffer): Likewise.
* cp/class.c (build_vbase_pointer_fields): layout_field now
place_field.
(get_vfield_offset): Use byte_position.
(set_rtti_entry): Set OFFSET to ssizetype zero.
(get_binfo_offset_as_int): Deleted.
(dfs_record_base_offsets): Use tree_low_cst.
(dfs_search_base_offsets): Likewise.
(layout_nonempty_base_or_field): Reflect changes in RLI format
and call byte_position.
(layout_empty_base): Convert offset to ssizetype.
(build_base_field): use rli_size_unit_so_far.
(dfs_propagate_binfo_offsets): Do computation in proper type.
(layout_virtual_bases): Pass ssizetype to propagate_binfo_offsets.
(layout_class_type): Reflect changes in RLI names and fields.
(finish_struct_1): Set DECL_FIELD_OFFSET.
* cp/dump.c (dequeue_and_dump): Call bit_position.
* cp/expr.c (cplus_expand_constant): Use byte_position.
* cp/rtti.c (expand_class_desc): Use bitsize_one_node.
* cp/typeck.c (build_component_addr): Use byte_position and don't
special case for zero offset.
* f/com.c (ffecom_tree_canonize_ptr_): Use bitsize_zero_node.
(ffecom_tree_canonize_ref_): Likewise.
* java/class.c (make_field_value): Use byte_position.
* java/expr.c (JAVA_ARRAY_LENGTH_OFFSET): Use byte_position.
(java_array_data_offset): Likewise.
* java/java-tree.h (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Add case to
bzero call.
From-SVN: r32742
Diffstat (limited to 'gcc/reload1.c')
-rw-r--r-- | gcc/reload1.c | 159 |
1 files changed, 96 insertions, 63 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c index 37670e8..996336c 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -120,7 +120,7 @@ rtx *reg_equiv_address; rtx *reg_equiv_mem; /* Widest width in which each pseudo reg is referred to (via subreg). */ -static int *reg_max_ref_width; +static unsigned int *reg_max_ref_width; /* Element N is the list of insns that initialized reg N from its equivalent constant or memory slot. */ @@ -237,7 +237,7 @@ char double_reg_address_ok; static rtx spill_stack_slot[FIRST_PSEUDO_REGISTER]; /* Width allocated so far for that stack slot. */ -static int spill_stack_slot_width[FIRST_PSEUDO_REGISTER]; +static unsigned int spill_stack_slot_width[FIRST_PSEUDO_REGISTER]; /* Record which pseudos needed to be spilled. */ static regset_head spilled_pseudos; @@ -393,7 +393,7 @@ static void set_initial_label_offsets PARAMS ((void)); static void set_offsets_for_label PARAMS ((rtx)); static void init_elim_table PARAMS ((void)); static void update_eliminables PARAMS ((HARD_REG_SET *)); -static void spill_hard_reg PARAMS ((int, FILE *, int)); +static void spill_hard_reg PARAMS ((unsigned int, FILE *, int)); static int finish_spills PARAMS ((int, FILE *)); static void ior_hard_reg_set PARAMS ((HARD_REG_SET *, HARD_REG_SET *)); static void scan_paradoxical_subregs PARAMS ((rtx)); @@ -402,28 +402,33 @@ static void order_regs_for_reload PARAMS ((struct insn_chain *)); static void reload_as_needed PARAMS ((int)); static void forget_old_reloads_1 PARAMS ((rtx, rtx, void *)); static int reload_reg_class_lower PARAMS ((const PTR, const PTR)); -static void mark_reload_reg_in_use PARAMS ((int, int, enum reload_type, - enum machine_mode)); -static void clear_reload_reg_in_use PARAMS ((int, int, enum reload_type, - enum machine_mode)); -static int reload_reg_free_p PARAMS ((int, int, enum reload_type)); +static void mark_reload_reg_in_use PARAMS ((unsigned int, int, + enum reload_type, + enum machine_mode)); +static void clear_reload_reg_in_use PARAMS ((unsigned int, int, + enum reload_type, + enum machine_mode)); +static int reload_reg_free_p PARAMS ((unsigned int, int, + enum reload_type)); static int reload_reg_free_for_value_p PARAMS ((int, int, enum reload_type, - rtx, rtx, int, int)); -static int reload_reg_reaches_end_p PARAMS ((int, int, enum reload_type)); -static int allocate_reload_reg PARAMS ((struct insn_chain *, int, int)); + rtx, rtx, int, int)); +static int reload_reg_reaches_end_p PARAMS ((unsigned int, int, + enum reload_type)); +static int allocate_reload_reg PARAMS ((struct insn_chain *, int, + int)); static void failed_reload PARAMS ((rtx, int)); static int set_reload_reg PARAMS ((int, int)); static void choose_reload_regs_init PARAMS ((struct insn_chain *, rtx *)); static void choose_reload_regs PARAMS ((struct insn_chain *)); static void merge_assigned_reloads PARAMS ((rtx)); static void emit_input_reload_insns PARAMS ((struct insn_chain *, - struct reload *, rtx, int)); + struct reload *, rtx, int)); static void emit_output_reload_insns PARAMS ((struct insn_chain *, - struct reload *, int)); + struct reload *, int)); static void do_input_reload PARAMS ((struct insn_chain *, - struct reload *, int)); + struct reload *, int)); static void do_output_reload PARAMS ((struct insn_chain *, - struct reload *, int)); + struct reload *, int)); static void emit_reload_insns PARAMS ((struct insn_chain *)); static void delete_output_reload PARAMS ((rtx, int, int)); static void delete_address_reloads PARAMS ((rtx, rtx)); @@ -434,16 +439,16 @@ static void reload_cse_regs_1 PARAMS ((rtx)); static int reload_cse_noop_set_p PARAMS ((rtx)); static int reload_cse_simplify_set PARAMS ((rtx, rtx)); static int reload_cse_simplify_operands PARAMS ((rtx)); -static void reload_combine PARAMS ((void)); -static void reload_combine_note_use PARAMS ((rtx *, rtx)); -static void reload_combine_note_store PARAMS ((rtx, rtx, void *)); -static void reload_cse_move2add PARAMS ((rtx)); -static void move2add_note_store PARAMS ((rtx, rtx, void *)); +static void reload_combine PARAMS ((void)); +static void reload_combine_note_use PARAMS ((rtx *, rtx)); +static void reload_combine_note_store PARAMS ((rtx, rtx, void *)); +static void reload_cse_move2add PARAMS ((rtx)); +static void move2add_note_store PARAMS ((rtx, rtx, void *)); #ifdef AUTO_INC_DEC -static void add_auto_inc_notes PARAMS ((rtx, rtx)); +static void add_auto_inc_notes PARAMS ((rtx, rtx)); #endif static rtx gen_mode_int PARAMS ((enum machine_mode, - HOST_WIDE_INT)); + HOST_WIDE_INT)); static void failed_reload PARAMS ((rtx, int)); static int set_reload_reg PARAMS ((int, int)); extern void dump_needs PARAMS ((struct insn_chain *, FILE *)); @@ -534,17 +539,20 @@ new_insn_chain () /* Small utility function to set all regs in hard reg set TO which are allocated to pseudos in regset FROM. */ + void compute_use_by_pseudos (to, from) HARD_REG_SET *to; regset from; { - int regno; + unsigned int regno; + EXECUTE_IF_SET_IN_REG_SET (from, FIRST_PSEUDO_REGISTER, regno, { int r = reg_renumber[regno]; int nregs; + if (r < 0) { /* reload_combine uses the information from @@ -1475,6 +1483,7 @@ static int spill_cost[FIRST_PSEUDO_REGISTER]; static int spill_add_cost[FIRST_PSEUDO_REGISTER]; /* Update the spill cost arrays, considering that pseudo REG is live. */ + static void count_pseudo (reg) int reg; @@ -1552,6 +1561,7 @@ static HARD_REG_SET used_spill_regs_local; SPILLED_NREGS. Determine how pseudo REG, which is live during the insn, is affected. We will add it to SPILLED_PSEUDOS if necessary, and we will update SPILL_COST/SPILL_ADD_COST. */ + static void count_spilled_pseudo (spilled, spilled_nregs, reg) int spilled, spilled_nregs, reg; @@ -1582,7 +1592,8 @@ find_reg (chain, order, dumpfile) struct reload *rl = rld + rnum; int best_cost = INT_MAX; int best_reg = -1; - int i, j; + unsigned int i, j; + int k; HARD_REG_SET not_usable; HARD_REG_SET used_by_other_reload; @@ -1591,9 +1602,10 @@ find_reg (chain, order, dumpfile) IOR_COMPL_HARD_REG_SET (not_usable, reg_class_contents[rl->class]); CLEAR_HARD_REG_SET (used_by_other_reload); - for (i = 0; i < order; i++) + for (k = 0; k < order; k++) { - int other = reload_order[i]; + int other = reload_order[k]; + if (rld[other].regno >= 0 && reloads_conflict (other, rnum)) for (j = 0; j < rld[other].nregs; j++) SET_HARD_REG_BIT (used_by_other_reload, rld[other].regno + j); @@ -1601,14 +1613,15 @@ find_reg (chain, order, dumpfile) for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) { - int regno = i; + unsigned int regno = i; + if (! TEST_HARD_REG_BIT (not_usable, regno) && ! TEST_HARD_REG_BIT (used_by_other_reload, regno) && HARD_REGNO_MODE_OK (regno, rl->mode)) { int this_cost = spill_cost[regno]; int ok = 1; - int this_nregs = HARD_REGNO_NREGS (regno, rl->mode); + unsigned int this_nregs = HARD_REGNO_NREGS (regno, rl->mode); for (j = 1; j < this_nregs; j++) { @@ -1643,8 +1656,10 @@ find_reg (chain, order, dumpfile) } if (best_reg == -1) return 0; + if (dumpfile) fprintf (dumpfile, "Using reg %d for reload %d\n", best_reg, rnum); + rl->nregs = HARD_REGNO_NREGS (best_reg, rl->mode); rl->regno = best_reg; @@ -1653,6 +1668,7 @@ find_reg (chain, order, dumpfile) { count_spilled_pseudo (best_reg, rl->nregs, j); }); + EXECUTE_IF_SET_IN_REG_SET (&chain->dead_or_set, FIRST_PSEUDO_REGISTER, j, { @@ -1693,7 +1709,8 @@ find_reload_regs (chain, dumpfile) { int regno = REGNO (chain->rld[i].reg_rtx); chain->rld[i].regno = regno; - chain->rld[i].nregs = HARD_REGNO_NREGS (regno, GET_MODE (chain->rld[i].reg_rtx)); + chain->rld[i].nregs + = HARD_REGNO_NREGS (regno, GET_MODE (chain->rld[i].reg_rtx)); } else chain->rld[i].regno = -1; @@ -1868,8 +1885,8 @@ alter_reg (i, from_reg) && reg_equiv_memory_loc[i] == 0) { register rtx x; - int inherent_size = PSEUDO_REGNO_BYTES (i); - int total_size = MAX (inherent_size, reg_max_ref_width[i]); + unsigned int inherent_size = PSEUDO_REGNO_BYTES (i); + unsigned int total_size = MAX (inherent_size, reg_max_ref_width[i]); int adjust = 0; /* Each pseudo reg has an inherent size which comes from its own mode, @@ -1970,6 +1987,7 @@ mark_home_live (regno) int regno; { register int i, lim; + i = reg_renumber[regno]; if (i < 0) return; @@ -3419,7 +3437,7 @@ init_elim_table () static void spill_hard_reg (regno, dumpfile, cant_eliminate) - register int regno; + unsigned int regno; FILE *dumpfile ATTRIBUTE_UNUSED; int cant_eliminate; { @@ -3436,9 +3454,9 @@ spill_hard_reg (regno, dumpfile, cant_eliminate) for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++) if (reg_renumber[i] >= 0 - && reg_renumber[i] <= regno - && (reg_renumber[i] - + HARD_REGNO_NREGS (reg_renumber[i], + && (unsigned int) reg_renumber[i] <= regno + && ((unsigned int) reg_renumber[i] + + HARD_REGNO_NREGS ((unsigned int) reg_renumber[i], PSEUDO_REGNO_MODE (i)) > regno)) SET_REGNO_REG_SET (&spilled_pseudos, i); @@ -3446,6 +3464,7 @@ spill_hard_reg (regno, dumpfile, cant_eliminate) /* I'm getting weird preprocessor errors if I use IOR_HARD_REG_SET from within EXECUTE_IF_SET_IN_REG_SET. Hence this awkwardness. */ + static void ior_hard_reg_set (set1, set2) HARD_REG_SET *set1, *set2; @@ -3956,8 +3975,8 @@ forget_old_reloads_1 (x, ignored, data) rtx ignored ATTRIBUTE_UNUSED; void *data ATTRIBUTE_UNUSED; { - register int regno; - int nr; + unsigned int regno; + unsigned int nr; int offset = 0; /* note_stores does give us subregs of hard regs. */ @@ -3976,7 +3995,8 @@ forget_old_reloads_1 (x, ignored, data) nr = 1; else { - int i; + unsigned int i; + nr = HARD_REGNO_NREGS (regno, GET_MODE (x)); /* Storing into a spilled-reg invalidates its contents. This can happen if a block-local pseudo is allocated to that reg @@ -4045,13 +4065,13 @@ static HARD_REG_SET reg_used_in_insn; static void mark_reload_reg_in_use (regno, opnum, type, mode) - int regno; + unsigned int regno; int opnum; enum reload_type type; enum machine_mode mode; { - int nregs = HARD_REGNO_NREGS (regno, mode); - int i; + unsigned int nregs = HARD_REGNO_NREGS (regno, mode); + unsigned int i; for (i = regno; i < nregs + regno; i++) { @@ -4110,13 +4130,13 @@ mark_reload_reg_in_use (regno, opnum, type, mode) static void clear_reload_reg_in_use (regno, opnum, type, mode) - int regno; + unsigned int regno; int opnum; enum reload_type type; enum machine_mode mode; { - int nregs = HARD_REGNO_NREGS (regno, mode); - int start_regno, end_regno; + unsigned int nregs = HARD_REGNO_NREGS (regno, mode); + unsigned int start_regno, end_regno, r; int i; /* A complication is that for some reload types, inheritance might allow multiple reloads of the same types to share a reload register. @@ -4196,8 +4216,8 @@ clear_reload_reg_in_use (regno, opnum, type, mode) && (check_any || rld[i].opnum == opnum) && rld[i].reg_rtx) { - int conflict_start = true_regnum (rld[i].reg_rtx); - int conflict_end + unsigned int conflict_start = true_regnum (rld[i].reg_rtx); + unsigned int conflict_end = (conflict_start + HARD_REGNO_NREGS (conflict_start, rld[i].mode)); @@ -4212,8 +4232,9 @@ clear_reload_reg_in_use (regno, opnum, type, mode) } } } - for (i = start_regno; i < end_regno; i++) - CLEAR_HARD_REG_BIT (*used_in_set, i); + + for (r = start_regno; r < end_regno; r++) + CLEAR_HARD_REG_BIT (*used_in_set, r); } /* 1 if reg REGNO is free as a reload reg for a reload of the sort @@ -4221,7 +4242,7 @@ clear_reload_reg_in_use (regno, opnum, type, mode) static int reload_reg_free_p (regno, opnum, type) - int regno; + unsigned int regno; int opnum; enum reload_type type; { @@ -4381,7 +4402,7 @@ reload_reg_free_p (regno, opnum, type) static int reload_reg_reaches_end_p (regno, opnum, type) - int regno; + unsigned int regno; int opnum; enum reload_type type; { @@ -5101,7 +5122,7 @@ choose_reload_regs (chain) { rtx insn = chain->insn; register int i, j; - int max_group_size = 1; + unsigned int max_group_size = 1; enum reg_class group_class = NO_REGS; int pass, win, inheritance; @@ -5124,7 +5145,8 @@ choose_reload_regs (chain) if (rld[j].nregs > 1) { max_group_size = MAX (rld[j].nregs, max_group_size); - group_class = reg_class_superunion[(int)rld[j].class][(int)group_class]; + group_class + = reg_class_superunion[(int)rld[j].class][(int)group_class]; } save_reload_reg_rtx[j] = rld[j].reg_rtx; @@ -5146,11 +5168,11 @@ choose_reload_regs (chain) /* Process the reloads in order of preference just found. Beyond this point, subregs can be found in reload_reg_rtx. - This used to look for an existing reloaded home for all - of the reloads, and only then perform any new reloads. - But that could lose if the reloads were done out of reg-class order - because a later reload with a looser constraint might have an old - home in a register needed by an earlier reload with a tighter constraint. + This used to look for an existing reloaded home for all of the + reloads, and only then perform any new reloads. But that could lose + if the reloads were done out of reg-class order because a later + reload with a looser constraint might have an old home in a register + needed by an earlier reload with a tighter constraint. To solve this, we make two passes over the reloads, in the order described above. In the first pass we try to inherit a reload @@ -5873,6 +5895,7 @@ static HARD_REG_SET reg_reloaded_died; /* Generate insns to perform reload RL, which is for the insn in CHAIN and has the number J. OLD contains the value to be used as input. */ + static void emit_input_reload_insns (chain, rl, old, j) struct insn_chain *chain; @@ -5957,7 +5980,7 @@ emit_input_reload_insns (chain, rl, old, j) if (oldequiv) { - int regno = true_regnum (oldequiv); + unsigned int regno = true_regnum (oldequiv); /* Don't use OLDEQUIV if any other reload changes it at an earlier stage of this insn or at this stage. */ @@ -8784,6 +8807,7 @@ reload_combine_note_use (xp, insn) reg_offset[n] / reg_base_reg[n] / reg_mode[n] are only valid if reg_set_luid[n] is larger than last_label_luid[n] . */ static int reg_set_luid[FIRST_PSEUDO_REGISTER]; + /* reg_offset[n] has to be CONST_INT for it and reg_base_reg[n] / reg_mode[n] to be valid. If reg_offset[n] is a CONST_INT and reg_base_reg[n] is negative, register n @@ -8794,12 +8818,14 @@ static int reg_set_luid[FIRST_PSEUDO_REGISTER]; static rtx reg_offset[FIRST_PSEUDO_REGISTER]; static int reg_base_reg[FIRST_PSEUDO_REGISTER]; static enum machine_mode reg_mode[FIRST_PSEUDO_REGISTER]; + /* move2add_luid is linearily increased while scanning the instructions from first to last. It is used to set reg_set_luid in reload_cse_move2add and move2add_note_store. */ static int move2add_luid; /* Generate a CONST_INT and force it in the range of MODE. */ + static rtx gen_mode_int (mode, value) enum machine_mode mode; @@ -8900,7 +8926,7 @@ reload_cse_move2add (first) ... (set (REGX) (plus (REGX) (CONST_INT B-A))) */ else if (GET_CODE (src) == REG - && reg_base_reg[regno] == REGNO (src) + && reg_base_reg[regno] == (int) REGNO (src) && reg_set_luid[regno] > reg_set_luid[REGNO (src)]) { rtx next = next_nonnote_insn (insn); @@ -8985,20 +9011,22 @@ reload_cse_move2add (first) /* SET is a SET or CLOBBER that sets DST. Update reg_set_luid, reg_offset and reg_base_reg accordingly. Called from reload_cse_move2add via note_stores. */ + static void move2add_note_store (dst, set, data) rtx dst, set; void *data ATTRIBUTE_UNUSED; { - int regno = 0; - int i; - + unsigned int regno = 0; + unsigned int i; enum machine_mode mode = GET_MODE (dst); + if (GET_CODE (dst) == SUBREG) { regno = SUBREG_WORD (dst); dst = SUBREG_REG (dst); } + if (GET_CODE (dst) != REG) return; @@ -9017,6 +9045,7 @@ move2add_note_store (dst, set, data) case PLUS: { rtx src0 = XEXP (src, 0); + if (GET_CODE (src0) == REG) { if (REGNO (src0) != regno @@ -9025,9 +9054,11 @@ move2add_note_store (dst, set, data) reg_base_reg[regno] = REGNO (src0); reg_set_luid[regno] = move2add_luid; } + reg_offset[regno] = XEXP (src, 1); break; } + reg_set_luid[regno] = move2add_luid; reg_offset[regno] = set; /* Invalidate contents. */ break; @@ -9048,7 +9079,9 @@ move2add_note_store (dst, set, data) } else { - for (i = regno + HARD_REGNO_NREGS (regno, mode) - 1; i >= regno; i--) + unsigned int endregno = regno + HARD_REGNO_NREGS (regno, mode); + + for (i = regno; i < endregno; i++) { /* Indicate that this register has been recently written to, but the exact contents are not available. */ |