PR middle-end/53249
* dwarf2out.h (get_address_mode): Move declaration to...
* rtl.h: ...here.
* dwarf2out.c (get_address_mode): Move definition to...
* rtlanal.c: ...here.
* var-tracking.c (get_address_mode): Delete.
* combine.c (find_split_point): Use get_address_mode instead of
targetm.addr_space.address_mode.
* cselib.c (cselib_record_sets): Likewise.
* dse.c (canon_address, record_store): Likewise.
* emit-rtl.c (adjust_address_1, offset_address): Likewise.
* expr.c (move_by_pieces, emit_block_move_via_loop, store_by_pieces)
(store_by_pieces_1, expand_assignment, store_expr, store_constructor)
(expand_expr_real_1): Likewise.
* ifcvt.c (noce_try_cmove_arith): Likewise.
* optabs.c (maybe_legitimize_operand_same_code): Likewise.
* reload.c (find_reloads): Likewise.
* sched-deps.c (sched_analyze_1, sched_analyze_2): Likewise.
* sel-sched-dump.c (debug_mem_addr_value): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187320
138bc75d-0d04-0410-961f-
82ee72b054a4
+2012-05-09 Richard Sandiford <rdsandiford@googlemail.com>
+
+ PR middle-end/53249
+ * dwarf2out.h (get_address_mode): Move declaration to...
+ * rtl.h: ...here.
+ * dwarf2out.c (get_address_mode): Move definition to...
+ * rtlanal.c: ...here.
+ * var-tracking.c (get_address_mode): Delete.
+ * combine.c (find_split_point): Use get_address_mode instead of
+ targetm.addr_space.address_mode.
+ * cselib.c (cselib_record_sets): Likewise.
+ * dse.c (canon_address, record_store): Likewise.
+ * emit-rtl.c (adjust_address_1, offset_address): Likewise.
+ * expr.c (move_by_pieces, emit_block_move_via_loop, store_by_pieces)
+ (store_by_pieces_1, expand_assignment, store_expr, store_constructor)
+ (expand_expr_real_1): Likewise.
+ * ifcvt.c (noce_try_cmove_arith): Likewise.
+ * optabs.c (maybe_legitimize_operand_same_code): Likewise.
+ * reload.c (find_reloads): Likewise.
+ * sched-deps.c (sched_analyze_1, sched_analyze_2): Likewise.
+ * sel-sched-dump.c (debug_mem_addr_value): Likewise.
+
2012-05-09 Maciej W. Rozycki <macro@codesourcery.com>
* config/mips/mips.c (mips16_gp_pseudo_reg): Remove line
if (GET_CODE (XEXP (x, 0)) == CONST
|| GET_CODE (XEXP (x, 0)) == SYMBOL_REF)
{
- enum machine_mode address_mode
- = targetm.addr_space.address_mode (MEM_ADDR_SPACE (x));
+ enum machine_mode address_mode = get_address_mode (x);
SUBST (XEXP (x, 0),
gen_rtx_LO_SUM (address_mode,
sets[i].src_elt = cselib_lookup (src, GET_MODE (dest), 1, VOIDmode);
if (MEM_P (dest))
{
- enum machine_mode address_mode
- = targetm.addr_space.address_mode (MEM_ADDR_SPACE (dest));
+ enum machine_mode address_mode = get_address_mode (dest);
sets[i].dest_addr_elt = cselib_lookup (XEXP (dest, 0),
address_mode, 1,
HOST_WIDE_INT *offset,
cselib_val **base)
{
- enum machine_mode address_mode
- = targetm.addr_space.address_mode (MEM_ADDR_SPACE (mem));
+ enum machine_mode address_mode = get_address_mode (mem);
rtx mem_address = XEXP (mem, 0);
rtx expanded_address, address;
int expanded;
cselib_val *base = NULL;
insn_info_t ptr, last, redundant_reason;
bool store_is_unused;
- enum machine_mode address_mode;
if (GET_CODE (body) != SET && GET_CODE (body) != CLOBBER)
return 0;
return 0;
}
- address_mode = targetm.addr_space.address_mode (MEM_ADDR_SPACE (mem));
-
if (GET_MODE (mem) == BLKmode)
width = MEM_SIZE (mem);
else
mem_addr = group->canon_base_addr;
}
if (offset)
- mem_addr = plus_constant (address_mode, mem_addr, offset);
+ mem_addr = plus_constant (get_address_mode (mem), mem_addr, offset);
}
while (ptr)
mem_addr = group->canon_base_addr;
}
if (offset)
- {
- enum machine_mode address_mode
- = targetm.addr_space.address_mode (MEM_ADDR_SPACE (mem));
- mem_addr = plus_constant (address_mode, mem_addr, offset);
- }
+ mem_addr = plus_constant (get_address_mode (mem), mem_addr, offset);
}
/* We ignore the clobbers in store_info. The is mildly aggressive,
return ret;
}
-/* Helper function to get mode of MEM's address. */
-
-enum machine_mode
-get_address_mode (rtx mem)
-{
- enum machine_mode mode = GET_MODE (XEXP (mem, 0));
- if (mode != VOIDmode)
- return mode;
- return targetm.addr_space.address_mode (MEM_ADDR_SPACE (mem));
-}
-
/* The following routine converts the RTL for a variable or parameter
(resident in memory) into an equivalent Dwarf representation of a
mechanism for getting the address of that same variable onto the top of a
(rtx, enum machine_mode mode, enum machine_mode mem_mode,
enum var_init_status);
extern bool loc_descr_equal_p (dw_loc_descr_ref, dw_loc_descr_ref);
-extern enum machine_mode get_address_mode (rtx mem);
extern dw_fde_ref dwarf2out_alloc_current_fde (void);
extern unsigned long size_of_locs (dw_loc_descr_ref);
/* Convert a possibly large offset to a signed value within the
range of the target address space. */
- address_mode = targetm.addr_space.address_mode (attrs.addrspace);
+ address_mode = get_address_mode (memref);
pbits = GET_MODE_BITSIZE (address_mode);
if (HOST_BITS_PER_WIDE_INT > pbits)
{
struct mem_attrs attrs, *defattrs;
attrs = *get_mem_attrs (memref);
- address_mode = targetm.addr_space.address_mode (attrs.addrspace);
+ address_mode = get_address_mode (memref);
new_rtx = simplify_gen_binary (PLUS, address_mode, addr, offset);
/* At this point we don't know _why_ the address is invalid. It
unsigned int align, int endp)
{
struct move_by_pieces_d data;
- enum machine_mode to_addr_mode, from_addr_mode
- = targetm.addr_space.address_mode (MEM_ADDR_SPACE (from));
+ enum machine_mode to_addr_mode;
+ enum machine_mode from_addr_mode = get_address_mode (from);
rtx to_addr, from_addr = XEXP (from, 0);
unsigned int max_size = MOVE_MAX_PIECES + 1;
enum insn_code icode;
data.from_addr = from_addr;
if (to)
{
- to_addr_mode = targetm.addr_space.address_mode (MEM_ADDR_SPACE (to));
+ to_addr_mode = get_address_mode (to);
to_addr = XEXP (to, 0);
data.to = to;
data.autinc_to
unsigned int align ATTRIBUTE_UNUSED)
{
rtx cmp_label, top_label, iter, x_addr, y_addr, tmp;
- enum machine_mode x_addr_mode
- = targetm.addr_space.address_mode (MEM_ADDR_SPACE (x));
- enum machine_mode y_addr_mode
- = targetm.addr_space.address_mode (MEM_ADDR_SPACE (y));
+ enum machine_mode x_addr_mode = get_address_mode (x);
+ enum machine_mode y_addr_mode = get_address_mode (y);
enum machine_mode iter_mode;
iter_mode = GET_MODE (size);
rtx (*constfun) (void *, HOST_WIDE_INT, enum machine_mode),
void *constfundata, unsigned int align, bool memsetp, int endp)
{
- enum machine_mode to_addr_mode
- = targetm.addr_space.address_mode (MEM_ADDR_SPACE (to));
+ enum machine_mode to_addr_mode = get_address_mode (to);
struct store_by_pieces_d data;
if (len == 0)
store_by_pieces_1 (struct store_by_pieces_d *data ATTRIBUTE_UNUSED,
unsigned int align ATTRIBUTE_UNUSED)
{
- enum machine_mode to_addr_mode
- = targetm.addr_space.address_mode (MEM_ADDR_SPACE (data->to));
+ enum machine_mode to_addr_mode = get_address_mode (data->to);
rtx to_addr = XEXP (data->to, 0);
unsigned int max_size = STORE_MAX_PIECES + 1;
enum insn_code icode;
}
offset_rtx = expand_expr (offset, NULL_RTX, VOIDmode, EXPAND_SUM);
- address_mode
- = targetm.addr_space.address_mode (MEM_ADDR_SPACE (to_rtx));
+ address_mode = get_address_mode (to_rtx);
if (GET_MODE (offset_rtx) != address_mode)
offset_rtx = convert_to_mode (address_mode, offset_rtx, 0);
{
enum machine_mode pointer_mode
= targetm.addr_space.pointer_mode (MEM_ADDR_SPACE (target));
- enum machine_mode address_mode
- = targetm.addr_space.address_mode (MEM_ADDR_SPACE (target));
+ enum machine_mode address_mode = get_address_mode (target);
/* Compute the size of the data to copy from the string. */
tree copy_size
offset_rtx = expand_normal (offset);
gcc_assert (MEM_P (to_rtx));
- address_mode
- = targetm.addr_space.address_mode (MEM_ADDR_SPACE (to_rtx));
+ address_mode = get_address_mode (to_rtx);
if (GET_MODE (offset_rtx) != address_mode)
offset_rtx = convert_to_mode (address_mode, offset_rtx, 0);
gcc_assert (MEM_P (op0));
- address_mode
- = targetm.addr_space.address_mode (MEM_ADDR_SPACE (op0));
+ address_mode = get_address_mode (op0);
if (GET_MODE (offset_rtx) != address_mode)
offset_rtx = convert_to_mode (address_mode, offset_rtx, 0);
&& MEM_ADDR_SPACE (a) == MEM_ADDR_SPACE (b)
&& if_info->branch_cost >= 5)
{
- enum machine_mode address_mode
- = targetm.addr_space.address_mode (MEM_ADDR_SPACE (a));
+ enum machine_mode address_mode = get_address_mode (a);
a = XEXP (a, 0);
b = XEXP (b, 0);
enum machine_mode mode;
last = get_last_insn ();
- mode = targetm.addr_space.address_mode (MEM_ADDR_SPACE (mem));
+ mode = get_address_mode (mem);
mem = replace_equiv_address (mem, copy_to_mode_reg (mode, addr));
if (insn_operand_matches (icode, opno, mem))
{
as would have been done by find_reloads_address. */
addr_space_t as = MEM_ADDR_SPACE (recog_data.operand[i]);
enum machine_mode address_mode;
- address_mode = GET_MODE (XEXP (recog_data.operand[i], 0));
- if (address_mode == VOIDmode)
- address_mode = targetm.addr_space.address_mode (as);
+ address_mode = get_address_mode (recog_data.operand[i]);
operand_reloadnum[i]
= push_reload (XEXP (recog_data.operand[i], 0), NULL_RTX,
&XEXP (recog_data.operand[i], 0), (rtx*) 0,
bool update_label_nuses;
} replace_label_data;
+extern enum machine_mode get_address_mode (rtx mem);
extern int rtx_addr_can_trap_p (const_rtx);
extern bool nonzero_address_p (const_rtx);
extern int rtx_unstable_p (const_rtx);
return exact_log2 (m + 1);
}
+
+/* Return the mode of MEM's address. */
+
+enum machine_mode
+get_address_mode (rtx mem)
+{
+ enum machine_mode mode;
+
+ gcc_assert (MEM_P (mem));
+ mode = GET_MODE (XEXP (mem, 0));
+ if (mode != VOIDmode)
+ return mode;
+ return targetm.addr_space.address_mode (MEM_ADDR_SPACE (mem));
+}
if (sched_deps_info->use_cselib)
{
- enum machine_mode address_mode
- = targetm.addr_space.address_mode (MEM_ADDR_SPACE (dest));
+ enum machine_mode address_mode = get_address_mode (dest);
t = shallow_copy_rtx (dest);
cselib_lookup_from_insn (XEXP (t, 0), address_mode, 1,
if (sched_deps_info->use_cselib)
{
- enum machine_mode address_mode
- = targetm.addr_space.address_mode (MEM_ADDR_SPACE (t));
+ enum machine_mode address_mode = get_address_mode (t);
t = shallow_copy_rtx (t);
cselib_lookup_from_insn (XEXP (t, 0), address_mode, 1,
enum machine_mode address_mode;
gcc_assert (MEM_P (x));
- address_mode = targetm.addr_space.address_mode (MEM_ADDR_SPACE (x));
+ address_mode = get_address_mode (x);
t = shallow_copy_rtx (x);
if (cselib_lookup (XEXP (t, 0), address_mode, 0, GET_MODE (t)))
return NULL;
}
-/* Helper function to get mode of MEM's address. */
-
-static inline enum machine_mode
-get_address_mode (rtx mem)
-{
- enum machine_mode mode = GET_MODE (XEXP (mem, 0));
- if (mode != VOIDmode)
- return mode;
- return targetm.addr_space.address_mode (MEM_ADDR_SPACE (mem));
-}
-
/* Replace all registers and addresses in an expression with VALUE
expressions that map back to them, unless the expression is a
register. If no mapping is or can be performed, returns NULL. */