770ae6cc71
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
387 lines
14 KiB
C
387 lines
14 KiB
C
/* Communication between reload.c and reload1.c.
|
|
Copyright (C) 1987, 1991, 1992, 1993, 1994, 1995, 1997, 1998,
|
|
1999, 2000 Free Software Foundation, Inc.
|
|
|
|
This file is part of GNU CC.
|
|
|
|
GNU CC is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
any later version.
|
|
|
|
GNU CC is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with GNU CC; see the file COPYING. If not, write to
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
|
|
/* If secondary reloads are the same for inputs and outputs, define those
|
|
macros here. */
|
|
|
|
#ifdef SECONDARY_RELOAD_CLASS
|
|
#define SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \
|
|
SECONDARY_RELOAD_CLASS (CLASS, MODE, X)
|
|
#define SECONDARY_OUTPUT_RELOAD_CLASS(CLASS, MODE, X) \
|
|
SECONDARY_RELOAD_CLASS (CLASS, MODE, X)
|
|
#endif
|
|
|
|
/* If either macro is defined, show that we need secondary reloads. */
|
|
#if defined(SECONDARY_INPUT_RELOAD_CLASS) || defined(SECONDARY_OUTPUT_RELOAD_CLASS)
|
|
#define HAVE_SECONDARY_RELOADS
|
|
#endif
|
|
|
|
/* If MEMORY_MOVE_COST isn't defined, give it a default here. */
|
|
#ifndef MEMORY_MOVE_COST
|
|
#ifdef HAVE_SECONDARY_RELOADS
|
|
#define MEMORY_MOVE_COST(MODE,CLASS,IN) \
|
|
(4 + memory_move_secondary_cost ((MODE), (CLASS), (IN)))
|
|
#else
|
|
#define MEMORY_MOVE_COST(MODE,CLASS,IN) 4
|
|
#endif
|
|
#endif
|
|
extern int memory_move_secondary_cost PARAMS ((enum machine_mode, enum reg_class, int));
|
|
|
|
/* Maximum number of reloads we can need. */
|
|
#define MAX_RELOADS (2 * MAX_RECOG_OPERANDS * (MAX_REGS_PER_ADDRESS + 1))
|
|
|
|
/* Encode the usage of a reload. The following codes are supported:
|
|
|
|
RELOAD_FOR_INPUT reload of an input operand
|
|
RELOAD_FOR_OUTPUT likewise, for output
|
|
RELOAD_FOR_INSN a reload that must not conflict with anything
|
|
used in the insn, but may conflict with
|
|
something used before or after the insn
|
|
RELOAD_FOR_INPUT_ADDRESS reload for parts of the address of an object
|
|
that is an input reload
|
|
RELOAD_FOR_INPADDR_ADDRESS reload needed for RELOAD_FOR_INPUT_ADDRESS
|
|
RELOAD_FOR_OUTPUT_ADDRESS like RELOAD_FOR INPUT_ADDRESS, for output
|
|
RELOAD_FOR_OUTADDR_ADDRESS reload needed for RELOAD_FOR_OUTPUT_ADDRESS
|
|
RELOAD_FOR_OPERAND_ADDRESS reload for the address of a non-reloaded
|
|
operand; these don't conflict with
|
|
any other addresses.
|
|
RELOAD_FOR_OPADDR_ADDR reload needed for RELOAD_FOR_OPERAND_ADDRESS
|
|
reloads; usually secondary reloads
|
|
RELOAD_OTHER none of the above, usually multiple uses
|
|
RELOAD_FOR_OTHER_ADDRESS reload for part of the address of an input
|
|
that is marked RELOAD_OTHER.
|
|
|
|
This used to be "enum reload_when_needed" but some debuggers have trouble
|
|
with an enum tag and variable of the same name. */
|
|
|
|
enum reload_type
|
|
{
|
|
RELOAD_FOR_INPUT, RELOAD_FOR_OUTPUT, RELOAD_FOR_INSN,
|
|
RELOAD_FOR_INPUT_ADDRESS, RELOAD_FOR_INPADDR_ADDRESS,
|
|
RELOAD_FOR_OUTPUT_ADDRESS, RELOAD_FOR_OUTADDR_ADDRESS,
|
|
RELOAD_FOR_OPERAND_ADDRESS, RELOAD_FOR_OPADDR_ADDR,
|
|
RELOAD_OTHER, RELOAD_FOR_OTHER_ADDRESS
|
|
};
|
|
|
|
#ifdef MAX_INSN_CODE
|
|
/* Each reload is recorded with a structure like this. */
|
|
struct reload
|
|
{
|
|
/* The value to reload from */
|
|
rtx in;
|
|
/* Where to store reload-reg afterward if nec (often the same as
|
|
reload_in) */
|
|
rtx out;
|
|
|
|
/* The class of registers to reload into. */
|
|
enum reg_class class;
|
|
|
|
/* The mode this operand should have when reloaded, on input. */
|
|
enum machine_mode inmode;
|
|
/* The mode this operand should have when reloaded, on output. */
|
|
enum machine_mode outmode;
|
|
|
|
/* The mode of the reload register. */
|
|
enum machine_mode mode;
|
|
|
|
/* the largest number of registers this reload will require. */
|
|
unsigned int nregs;
|
|
|
|
/* Positive amount to increment or decrement by if
|
|
reload_in is a PRE_DEC, PRE_INC, POST_DEC, POST_INC.
|
|
Ignored otherwise (don't assume it is zero). */
|
|
int inc;
|
|
/* A reg for which reload_in is the equivalent.
|
|
If reload_in is a symbol_ref which came from
|
|
reg_equiv_constant, then this is the pseudo
|
|
which has that symbol_ref as equivalent. */
|
|
rtx in_reg;
|
|
rtx out_reg;
|
|
|
|
/* Used in find_reload_regs to record the allocated register. */
|
|
int regno;
|
|
/* This is the register to reload into. If it is zero when `find_reloads'
|
|
returns, you must find a suitable register in the class specified by
|
|
reload_reg_class, and store here an rtx for that register with mode from
|
|
reload_inmode or reload_outmode. */
|
|
rtx reg_rtx;
|
|
/* The operand number being reloaded. This is used to group related reloads
|
|
and need not always be equal to the actual operand number in the insn,
|
|
though it current will be; for in-out operands, it is one of the two
|
|
operand numbers. */
|
|
int opnum;
|
|
|
|
/* Gives the reload number of a secondary input reload, when needed;
|
|
otherwise -1. */
|
|
int secondary_in_reload;
|
|
/* Gives the reload number of a secondary output reload, when needed;
|
|
otherwise -1. */
|
|
int secondary_out_reload;
|
|
/* If a secondary input reload is required, gives the INSN_CODE that uses the
|
|
secondary reload as a scratch register, or CODE_FOR_nothing if the
|
|
secondary reload register is to be an intermediate register. */
|
|
enum insn_code secondary_in_icode;
|
|
/* Likewise, for a secondary output reload. */
|
|
enum insn_code secondary_out_icode;
|
|
|
|
/* Classifies reload as needed either for addressing an input reload,
|
|
addressing an output, for addressing a non-reloaded mem ref, or for
|
|
unspecified purposes (i.e., more than one of the above). */
|
|
enum reload_type when_needed;
|
|
|
|
/* Nonzero for an optional reload. Optional reloads are ignored unless the
|
|
value is already sitting in a register. */
|
|
unsigned int optional:1;
|
|
/* nonzero if this reload shouldn't be combined with another reload. */
|
|
unsigned int nocombine:1;
|
|
/* Nonzero if this is a secondary register for one or more reloads. */
|
|
unsigned int secondary_p:1;
|
|
/* Nonzero if this reload must use a register not already allocated to a
|
|
group. */
|
|
unsigned int nongroup:1;
|
|
};
|
|
|
|
extern struct reload rld[MAX_RELOADS];
|
|
extern int n_reloads;
|
|
#endif
|
|
|
|
extern rtx *reg_equiv_constant;
|
|
extern rtx *reg_equiv_memory_loc;
|
|
extern rtx *reg_equiv_address;
|
|
extern rtx *reg_equiv_mem;
|
|
|
|
/* All the "earlyclobber" operands of the current insn
|
|
are recorded here. */
|
|
extern int n_earlyclobbers;
|
|
extern rtx reload_earlyclobbers[MAX_RECOG_OPERANDS];
|
|
|
|
/* Save the number of operands. */
|
|
extern int reload_n_operands;
|
|
|
|
/* First uid used by insns created by reload in this function.
|
|
Used in find_equiv_reg. */
|
|
extern int reload_first_uid;
|
|
|
|
/* Nonzero if indirect addressing is supported when the innermost MEM is
|
|
of the form (MEM (SYMBOL_REF sym)). It is assumed that the level to
|
|
which these are valid is the same as spill_indirect_levels, above. */
|
|
|
|
extern char indirect_symref_ok;
|
|
|
|
/* Nonzero if an address (plus (reg frame_pointer) (reg ...)) is valid. */
|
|
extern char double_reg_address_ok;
|
|
|
|
extern int num_not_at_initial_offset;
|
|
|
|
#ifdef MAX_INSN_CODE
|
|
/* These arrays record the insn_code of insns that may be needed to
|
|
perform input and output reloads of special objects. They provide a
|
|
place to pass a scratch register. */
|
|
extern enum insn_code reload_in_optab[];
|
|
extern enum insn_code reload_out_optab[];
|
|
#endif
|
|
|
|
struct needs
|
|
{
|
|
/* [0] is normal, [1] is nongroup. */
|
|
short regs[2][N_REG_CLASSES];
|
|
short groups[N_REG_CLASSES];
|
|
};
|
|
|
|
#if defined SET_HARD_REG_BIT && defined CLEAR_REG_SET
|
|
/* This structure describes instructions which are relevant for reload.
|
|
Apart from all regular insns, this also includes CODE_LABELs, since they
|
|
must be examined for register elimination. */
|
|
struct insn_chain
|
|
{
|
|
/* Links to the neighbour instructions. */
|
|
struct insn_chain *next, *prev;
|
|
|
|
/* Link through a chains set up by calculate_needs_all_insns, containing
|
|
all insns that need reloading. */
|
|
struct insn_chain *next_need_reload;
|
|
|
|
/* The basic block this insn is in. */
|
|
int block;
|
|
/* The rtx of the insn. */
|
|
rtx insn;
|
|
/* Register life information: record all live hard registers, and all
|
|
live pseudos that have a hard register. */
|
|
regset_head live_throughout;
|
|
regset_head dead_or_set;
|
|
|
|
/* Copies of the global variables computed by find_reloads. */
|
|
struct reload *rld;
|
|
int n_reloads;
|
|
|
|
/* Indicates which registers have already been used for spills. */
|
|
HARD_REG_SET used_spill_regs;
|
|
|
|
/* Describe the needs for reload registers of this insn. */
|
|
struct needs need;
|
|
|
|
/* Nonzero if find_reloads said the insn requires reloading. */
|
|
unsigned int need_reload:1;
|
|
/* Nonzero if find_reloads needs to be run during reload_as_needed to
|
|
perform modifications on any operands. */
|
|
unsigned int need_operand_change:1;
|
|
/* Nonzero if eliminate_regs_in_insn said it requires eliminations. */
|
|
unsigned int need_elim:1;
|
|
/* Nonzero if this insn was inserted by perform_caller_saves. */
|
|
unsigned int is_caller_save_insn:1;
|
|
};
|
|
|
|
/* A chain of insn_chain structures to describe all non-note insns in
|
|
a function. */
|
|
extern struct insn_chain *reload_insn_chain;
|
|
|
|
/* Allocate a new insn_chain structure. */
|
|
extern struct insn_chain *new_insn_chain PARAMS ((void));
|
|
|
|
extern void compute_use_by_pseudos PARAMS ((HARD_REG_SET *, regset));
|
|
#endif
|
|
|
|
/* Functions from reload.c: */
|
|
|
|
/* Return a memory location that will be used to copy X in mode MODE.
|
|
If we haven't already made a location for this mode in this insn,
|
|
call find_reloads_address on the location being returned. */
|
|
extern rtx get_secondary_mem PARAMS ((rtx, enum machine_mode,
|
|
int, enum reload_type));
|
|
|
|
/* Clear any secondary memory locations we've made. */
|
|
extern void clear_secondary_mem PARAMS ((void));
|
|
|
|
/* Transfer all replacements that used to be in reload FROM to be in
|
|
reload TO. */
|
|
extern void transfer_replacements PARAMS ((int, int));
|
|
|
|
/* IN_RTX is the value loaded by a reload that we now decided to inherit,
|
|
or a subpart of it. If we have any replacements registered for IN_RTX,
|
|
chancel the reloads that were supposed to load them.
|
|
Return non-zero if we chanceled any reloads. */
|
|
extern int remove_address_replacements PARAMS ((rtx in_rtx));
|
|
|
|
/* Like rtx_equal_p except that it allows a REG and a SUBREG to match
|
|
if they are the same hard reg, and has special hacks for
|
|
autoincrement and autodecrement. */
|
|
extern int operands_match_p PARAMS ((rtx, rtx));
|
|
|
|
/* Return 1 if altering OP will not modify the value of CLOBBER. */
|
|
extern int safe_from_earlyclobber PARAMS ((rtx, rtx));
|
|
|
|
/* Search the body of INSN for values that need reloading and record them
|
|
with push_reload. REPLACE nonzero means record also where the values occur
|
|
so that subst_reloads can be used. */
|
|
extern int find_reloads PARAMS ((rtx, int, int, int, short *));
|
|
|
|
/* Compute the sum of X and Y, making canonicalizations assumed in an
|
|
address, namely: sum constant integers, surround the sum of two
|
|
constants with a CONST, put the constant as the second operand, and
|
|
group the constant on the outermost sum. */
|
|
extern rtx form_sum PARAMS ((rtx, rtx));
|
|
|
|
/* Substitute into the current INSN the registers into which we have reloaded
|
|
the things that need reloading. */
|
|
extern void subst_reloads PARAMS ((void));
|
|
|
|
/* Make a copy of any replacements being done into X and move those copies
|
|
to locations in Y, a copy of X. We only look at the highest level of
|
|
the RTL. */
|
|
extern void copy_replacements PARAMS ((rtx, rtx));
|
|
|
|
/* Change any replacements being done to *X to be done to *Y */
|
|
extern void move_replacements PARAMS ((rtx *x, rtx *y));
|
|
|
|
/* If LOC was scheduled to be replaced by something, return the replacement.
|
|
Otherwise, return *LOC. */
|
|
extern rtx find_replacement PARAMS ((rtx *));
|
|
|
|
/* Return nonzero if register in range [REGNO, ENDREGNO)
|
|
appears either explicitly or implicitly in X
|
|
other than being stored into. */
|
|
extern int refers_to_regno_for_reload_p PARAMS ((unsigned int, unsigned int,
|
|
rtx, rtx *));
|
|
|
|
/* Nonzero if modifying X will affect IN. */
|
|
extern int reg_overlap_mentioned_for_reload_p PARAMS ((rtx, rtx));
|
|
|
|
/* Return nonzero if anything in X contains a MEM. Look also for pseudo
|
|
registers. */
|
|
extern int refers_to_mem_for_reload_p PARAMS ((rtx));
|
|
|
|
/* Check the insns before INSN to see if there is a suitable register
|
|
containing the same value as GOAL. */
|
|
extern rtx find_equiv_reg PARAMS ((rtx, rtx, enum reg_class, int, short *,
|
|
int, enum machine_mode));
|
|
|
|
/* Return 1 if register REGNO is the subject of a clobber in insn INSN. */
|
|
extern int regno_clobbered_p PARAMS ((unsigned int, rtx));
|
|
|
|
/* Return 1 if X is an operand of an insn that is being earlyclobbered. */
|
|
int earlyclobber_operand_p PARAMS ((rtx));
|
|
|
|
/* Functions in reload1.c: */
|
|
|
|
extern int reloads_conflict PARAMS ((int, int));
|
|
|
|
int count_occurrences PARAMS ((rtx, rtx));
|
|
|
|
/* Initialize the reload pass once per compilation. */
|
|
extern void init_reload PARAMS ((void));
|
|
|
|
/* The reload pass itself. */
|
|
extern int reload PARAMS ((rtx, int, FILE *));
|
|
|
|
/* Mark the slots in regs_ever_live for the hard regs
|
|
used by pseudo-reg number REGNO. */
|
|
extern void mark_home_live PARAMS ((int));
|
|
|
|
/* Scan X and replace any eliminable registers (such as fp) with a
|
|
replacement (such as sp), plus an offset. */
|
|
extern rtx eliminate_regs PARAMS ((rtx, enum machine_mode, rtx));
|
|
|
|
/* Emit code to perform a reload from IN (which may be a reload register) to
|
|
OUT (which may also be a reload register). IN or OUT is from operand
|
|
OPNUM with reload type TYPE. */
|
|
extern rtx gen_reload PARAMS ((rtx, rtx, int, enum reload_type));
|
|
|
|
/* Deallocate the reload register used by reload number R. */
|
|
extern void deallocate_reload_reg PARAMS ((int r));
|
|
|
|
/* Functions in caller-save.c: */
|
|
|
|
/* Initialize for caller-save. */
|
|
extern void init_caller_save PARAMS ((void));
|
|
|
|
/* Initialize save areas by showing that we haven't allocated any yet. */
|
|
extern void init_save_areas PARAMS ((void));
|
|
|
|
/* Allocate save areas for any hard registers that might need saving. */
|
|
extern void setup_save_areas PARAMS ((void));
|
|
|
|
/* Find the places where hard regs are live across calls and save them. */
|
|
extern void save_call_clobbered_regs PARAMS ((void));
|
|
|
|
/* Replace (subreg (reg)) with the appropriate (reg) for any operands. */
|
|
extern void cleanup_subreg_operands PARAMS ((rtx));
|