diff options
author | Ben Elliston <bje@au.ibm.com> | 2009-10-26 21:57:10 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@gcc.gnu.org> | 2009-10-26 21:57:10 +0000 |
commit | d4ebfa65c962f1f0b50223e34184dc5a81d907c6 (patch) | |
tree | 0b006fa60cd37b4bd974ed32a7adc7f005e9eb0b /gcc/reload.c | |
parent | 09e881c9e21a9209b2092e400ea4c38948614f78 (diff) | |
download | gcc-d4ebfa65c962f1f0b50223e34184dc5a81d907c6.zip gcc-d4ebfa65c962f1f0b50223e34184dc5a81d907c6.tar.gz gcc-d4ebfa65c962f1f0b50223e34184dc5a81d907c6.tar.bz2 |
tm.texi (TARGET_ADDR_SPACE_POINTER_MODE): Document.
2009-10-26 Ben Elliston <bje@au.ibm.com>
Michael Meissner <meissner@linux.vnet.ibm.com>
Ulrich Weigand <uweigand@de.ibm.com>
* doc/tm.texi (TARGET_ADDR_SPACE_POINTER_MODE): Document.
(TARGET_ADDR_SPACE_ADDRESS_MODE): Likewise.
(TARGET_ADDR_SPACE_VALID_POINTER_MODE): Likewise.
* target.h (struct target_def): Add pointer_mode, address_mode,
and valid_pointer_mode to addr_space substructure.
* target-def.h (TARGET_ADDR_SPACE_POINTER_MODE): Define.
(TARGET_ADDR_SPACE_ADDRESS_MODE): Likewise.
(TARGET_ADDR_SPACE_VALID_POINTER_MODE): Likewise.
(TARGET_ADDR_SPACE_HOOKS): Add them.
* targhooks.c (target_default_pointer_address_modes_p): New function.
* target.h (target_default_pointer_address_modes_p): Add prototype.
* targhooks.c (default_addr_space_pointer_mode): New function.
(default_addr_space_address_mode): Likewise.
(default_addr_space_valid_pointer_mode): Likewise.
* targhooks.h (default_addr_space_pointer_mode): Add prototype.
(default_addr_space_address_mode): Likewise.
(default_addr_space_valid_pointer_mode): Likewise.
* output.h (default_valid_pointer_mode): Move to ...
* targhooks.h (default_valid_pointer_mode): ... here.
* varasm.c (default_valid_pointer_mode): Move to ...
* targhooks.c (default_valid_pointer_mode): ... here.
* varasm.c (output_constant): Use targetm.addr_space.valid_pointer_mode
instead of targetm.valid_pointer_mode.
* fold-const.c (fit_double_type): Use int_or_pointer_precision.
* tree.c (integer_pow2p): Likewise.
(tree_log2): Likewise.
(tree_floor_log2): Likewise.
(signed_or_unsigned_type_for): Support pointer type of different size.
(int_or_pointer_precision): New function.
* tree.h (int_or_pointer_precision): Add prototype.
* stor-layout.c (layout_type): Set TYPE_PRECISION for offset types.
* varasm.c (initializer_constant_valid_p): Use TYPE_PRECISION of
incoming pointer type instead of POINTER_SIZE.
* tree.c (build_pointer_type): Use appropriate pointer mode
instead of ptr_mode.
(build_reference_type): Likewise.
* expr.c (store_expr): Likewise.
(expand_expr_addr_expr): Likewise.
* tree-vect-data-refs.c (vect_create_data_ref_ptr): Likewise.
* cfgexpand.c (expand_debug_expr): Likewise.
* auto-inc-dec.c: Include "target.h".
(try_merge): Use appropriate address mode instead of Pmode.
(find_inc): Likewise.
* combine.c (find_split_point): Likewise.
* cselib.c (cselib_record_sets): Likewise.
* dse.c (replace_inc_dec): Likewise.
(canon_address): Likewise.
* var-tracking.c (replace_expr_with_values): Likewise.
(count_uses): Likewise.
(add_uses): Likewise.
(add_stores): Likewise.
* emit-rtl.c: Include "target.h".
(adjust_address_1): Use appropriate address mode instead of Pmode.
(offset_address): Likewise.
* explow.c (break_out_memory_refs): Likewise.
(memory_address_addr_space): Likewise.
(promote_mode): Likewise.
* expr.c (move_by_pieces): Likewise.
(emit_block_move_via_loop): Likewise.
(store_by_pieces): Likewise.
(store_by_pieces_1): Likewise.
(expand_assignment): Likewise.
(store_constructor): Likewise.
(expand_expr_addr_expr): Likewise.
(expand_expr_real_1): Likewise.
* cfgexpand.c (expand_debug_expr): Likewise.
* ifcvt.c (noce_try_cmove_arith): Likewise.
* regcprop.c (kill_autoinc_value): Likewise.
* regmove.c (try_auto_increment): Likewise.
* reload.c (find_reloads): Likewise.
(find_reloads_address): Likewise.
(find_reloads_address_1): Likewise.
* sched-deps.c: Include "target.h".
(sched_analyze_1): Use appropriate address mode instead of Pmode.
(sched_analyze_2): Likewise.
* sel-sched-dump.c: Include "target.h".
(debug_mem_addr_value): Use appropriate address mode instead of Pmode.
* stor-layout.c (layout_type): Likewise.
* tree-ssa-loop-ivopts.c (produce_memory_decl_rtl): Likewise.
(multiplier_allowed_in_address_p): Likewise.
(get_address_cost): Likewise.
* varasm.c (make_decl_rtl): Likewise.
* expr.c (expand_assignment): Always convert offsets to appropriate
address mode.
(store_expr): Likewise.
(store_constructor): Likewise.
(expand_expr_real_1): Likewise.
* reload.h (form_sum): Add MODE argument.
* reload.c (form_sum): Add MODE argument, use it instead of Pmode.
Update recursive calls.
(subst_indexed_address): Update calls to form_sum.
* tree-flow.h (addr_for_mem_ref): Add ADDRSPACE argument.
* tree-ssa-address.c: Include "target.h".
(templates): Replace by ...
(mem_addr_template_list): ... this new vector.
(TEMPL_IDX): Handle address space numbers.
(gen_addr_rtx): Add address mode argument, use it instead of Pmode.
(addr_for_mem_ref): Add ADDRSPACE argument. Use per-address-space
instead of global cache. Update call to gen_addr_rtx.
(valid_mem_ref_p): Update call to addr_for_mem_ref.
* expr.c (expand_expr_real_1): Update call to addr_for_mem_ref.
* rtl.h (convert_memory_address_addr_space): Add prototype.
(convert_memory_address): Define as macro.
* explow.c (convert_memory_address): Rename to ...
(convert_memory_address_addr_space): ... this. Add ADDRSPACE argument.
Use appropriate pointer and address modes instead of ptr_mode / Pmode.
Update recursive calls.
(memory_address_addr_space): Call convert_memory_address_addr_space.
* expmed.c (make_tree): Likewise.
* expr.c (expand_assignment): Likewise.
(expand_expr_addr_expr_1): Likewise. Also, add ADDRSPACE argument.
(expand_expr_addr_expr): Likewise. Also, update call.
* alias.c (find_base_value): Guard pointer size optimizations.
(find_base_term): Likewise.
* rtlanal.c (nonzero_bits1): Likewise.
(num_sign_bit_copies1): Likewise.
* simplify-rtx.c (simplify_unary_operation_1): Likewise.
* Makefile.in (tree-ssa-address.o): Add $(TARGET_H) dependency.
(emit-rtl.o): Likewise.
(auto-inc-dec.o): Likewise.
(sched-deps.o): Likewise.
Co-Authored-By: Michael Meissner <meissner@linux.vnet.ibm.com>
Co-Authored-By: Ulrich Weigand <uweigand@de.ibm.com>
From-SVN: r153573
Diffstat (limited to 'gcc/reload.c')
-rw-r--r-- | gcc/reload.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/gcc/reload.c b/gcc/reload.c index 166bcb9..3333697 100644 --- a/gcc/reload.c +++ b/gcc/reload.c @@ -3987,12 +3987,15 @@ find_reloads (rtx insn, int replace, int ind_levels, int live_known, && MEM_P (recog_data.operand[i])) { /* If the address to be reloaded is a VOIDmode constant, - use Pmode as mode of the reload register, as would have - been done by find_reloads_address. */ + use the default address mode as mode of the reload register, + as would have been done by find_reloads_address. */ enum machine_mode address_mode; address_mode = GET_MODE (XEXP (recog_data.operand[i], 0)); if (address_mode == VOIDmode) - address_mode = Pmode; + { + addr_space_t as = MEM_ADDR_SPACE (recog_data.operand[i]); + address_mode = targetm.addr_space.address_mode (as); + } operand_reloadnum[i] = push_reload (XEXP (recog_data.operand[i], 0), NULL_RTX, @@ -5113,7 +5116,7 @@ find_reloads_address (enum machine_mode mode, rtx *memrefloc, rtx ad, That will at least work. */ find_reloads_address_part (ad, loc, base_reg_class (mode, MEM, SCRATCH), - Pmode, opnum, type, ind_levels); + GET_MODE (ad), opnum, type, ind_levels); } return ! removed_and; } @@ -5235,6 +5238,10 @@ find_reloads_address (enum machine_mode mode, rtx *memrefloc, rtx ad, into a register. */ if (CONSTANT_P (ad) && ! strict_memory_address_addr_space_p (mode, ad, as)) { + enum machine_mode address_mode = GET_MODE (ad); + if (ad == VOIDmode) + address_mode = targetm.addr_space.address_mode (as); + /* If AD is an address in the constant pool, the MEM rtx may be shared. Unshare it so we can safely alter it. */ if (memrefloc && GET_CODE (ad) == SYMBOL_REF @@ -5247,7 +5254,7 @@ find_reloads_address (enum machine_mode mode, rtx *memrefloc, rtx ad, } find_reloads_address_part (ad, loc, base_reg_class (mode, MEM, SCRATCH), - Pmode, opnum, type, ind_levels); + address_mode, opnum, type, ind_levels); return ! removed_and; } @@ -5334,16 +5341,12 @@ subst_reg_equivs (rtx ad, rtx insn) This routine assumes both inputs are already in canonical form. */ rtx -form_sum (rtx x, rtx y) +form_sum (enum machine_mode mode, rtx x, rtx y) { rtx tem; - enum machine_mode mode = GET_MODE (x); - - if (mode == VOIDmode) - mode = GET_MODE (y); - if (mode == VOIDmode) - mode = Pmode; + gcc_assert (GET_MODE (x) == mode || GET_MODE (x) == VOIDmode); + gcc_assert (GET_MODE (y) == mode || GET_MODE (y) == VOIDmode); if (CONST_INT_P (x)) return plus_constant (y, INTVAL (x)); @@ -5353,12 +5356,12 @@ form_sum (rtx x, rtx y) tem = x, x = y, y = tem; if (GET_CODE (x) == PLUS && CONSTANT_P (XEXP (x, 1))) - return form_sum (XEXP (x, 0), form_sum (XEXP (x, 1), y)); + return form_sum (mode, XEXP (x, 0), form_sum (mode, XEXP (x, 1), y)); /* Note that if the operands of Y are specified in the opposite order in the recursive calls below, infinite recursion will occur. */ if (GET_CODE (y) == PLUS && CONSTANT_P (XEXP (y, 1))) - return form_sum (form_sum (x, XEXP (y, 0)), XEXP (y, 1)); + return form_sum (mode, form_sum (mode, x, XEXP (y, 0)), XEXP (y, 1)); /* If both constant, encapsulate sum. Otherwise, just form sum. A constant will have been placed second. */ @@ -5425,9 +5428,9 @@ subst_indexed_address (rtx addr) /* Compute the sum. */ if (op2 != 0) - op1 = form_sum (op1, op2); + op1 = form_sum (GET_MODE (addr), op1, op2); if (op1 != 0) - op0 = form_sum (op0, op1); + op0 = form_sum (GET_MODE (addr), op0, op1); return op0; } @@ -5827,7 +5830,8 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, rtx equiv = (MEM_P (XEXP (x, 0)) ? XEXP (x, 0) : reg_equiv_mem[regno]); - int icode = (int) optab_handler (add_optab, Pmode)->insn_code; + int icode + = (int) optab_handler (add_optab, GET_MODE (x))->insn_code; if (insn && NONJUMP_INSN_P (insn) && equiv && memory_operand (equiv, GET_MODE (equiv)) #ifdef HAVE_cc0 @@ -5835,9 +5839,9 @@ find_reloads_address_1 (enum machine_mode mode, rtx x, int context, #endif && ! (icode != CODE_FOR_nothing && ((*insn_data[icode].operand[0].predicate) - (equiv, Pmode)) + (equiv, GET_MODE (x))) && ((*insn_data[icode].operand[1].predicate) - (equiv, Pmode)))) + (equiv, GET_MODE (x))))) { /* We use the original pseudo for loc, so that emit_reload_insns() knows which pseudo this |