diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-12-20 12:53:23 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-12-20 12:53:23 +0000 |
commit | d05d755107df11e675a57ac4371fd0031c7d68a4 (patch) | |
tree | 1178b6d79fbc857905717d3e51f99bd3df6cfbda /gcc/emit-rtl.h | |
parent | a02ee6ef8834a80d4692736eb340db9854fe32ce (diff) | |
download | gcc-d05d755107df11e675a57ac4371fd0031c7d68a4.tar.gz |
poly_int: MEM_OFFSET and MEM_SIZE
This patch changes the MEM_OFFSET and MEM_SIZE memory attributes
from HOST_WIDE_INT to poly_int64. Most of it is mechanical,
but there is one nonbovious change in widen_memory_access.
Previously the main while loop broke with:
/* Similarly for the decl. */
else if (DECL_P (attrs.expr)
&& DECL_SIZE_UNIT (attrs.expr)
&& TREE_CODE (DECL_SIZE_UNIT (attrs.expr)) == INTEGER_CST
&& compare_tree_int (DECL_SIZE_UNIT (attrs.expr), size) >= 0
&& (! attrs.offset_known_p || attrs.offset >= 0))
break;
but it seemed wrong to optimistically assume the best case
when the offset isn't known (and thus might be negative).
As it happens, the "! attrs.offset_known_p" condition was
always false, because we'd already nullified attrs.expr in
that case:
/* If we don't know what offset we were at within the expression, then
we can't know if we've overstepped the bounds. */
if (! attrs.offset_known_p)
attrs.expr = NULL_TREE;
The patch therefore drops "! attrs.offset_known_p ||" when
converting the offset check to the may/must interface.
2017-12-20 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* rtl.h (mem_attrs): Add a default constructor. Change size and
offset from HOST_WIDE_INT to poly_int64.
* emit-rtl.h (set_mem_offset, set_mem_size, adjust_address_1)
(adjust_automodify_address_1, set_mem_attributes_minus_bitpos)
(widen_memory_access): Take the sizes and offsets as poly_int64s
rather than HOST_WIDE_INTs.
* alias.c (ao_ref_from_mem): Handle the new form of MEM_OFFSET.
(offset_overlap_p): Take poly_int64s rather than HOST_WIDE_INTs
and ints.
(adjust_offset_for_component_ref): Change the offset from a
HOST_WIDE_INT to a poly_int64.
(nonoverlapping_memrefs_p): Track polynomial offsets and sizes.
* cfgcleanup.c (merge_memattrs): Update after mem_attrs changes.
* dce.c (find_call_stack_args): Likewise.
* dse.c (record_store): Likewise.
* dwarf2out.c (tls_mem_loc_descriptor, dw_sra_loc_expr): Likewise.
* print-rtl.c (rtx_writer::print_rtx): Likewise.
* read-rtl-function.c (test_loading_mem): Likewise.
* rtlanal.c (may_trap_p_1): Likewise.
* simplify-rtx.c (delegitimize_mem_from_attrs): Likewise.
* var-tracking.c (int_mem_offset, track_expr_p): Likewise.
* emit-rtl.c (mem_attrs_eq_p, get_mem_align_offset): Likewise.
(mem_attrs::mem_attrs): New function.
(set_mem_attributes_minus_bitpos): Change bitpos from a
HOST_WIDE_INT to poly_int64.
(set_mem_alias_set, set_mem_addr_space, set_mem_align, set_mem_expr)
(clear_mem_offset, clear_mem_size, change_address)
(get_spill_slot_decl, set_mem_attrs_for_spill): Directly
initialize mem_attrs.
(set_mem_offset, set_mem_size, adjust_address_1)
(adjust_automodify_address_1, offset_address, widen_memory_access):
Likewise. Take poly_int64s rather than HOST_WIDE_INT.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r255875
Diffstat (limited to 'gcc/emit-rtl.h')
-rw-r--r-- | gcc/emit-rtl.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gcc/emit-rtl.h b/gcc/emit-rtl.h index 9deff00d679..3e0192123f5 100644 --- a/gcc/emit-rtl.h +++ b/gcc/emit-rtl.h @@ -333,13 +333,13 @@ extern void set_mem_addr_space (rtx, addr_space_t); extern void set_mem_expr (rtx, tree); /* Set the offset for MEM to OFFSET. */ -extern void set_mem_offset (rtx, HOST_WIDE_INT); +extern void set_mem_offset (rtx, poly_int64); /* Clear the offset recorded for MEM. */ extern void clear_mem_offset (rtx); /* Set the size for MEM to SIZE. */ -extern void set_mem_size (rtx, HOST_WIDE_INT); +extern void set_mem_size (rtx, poly_int64); /* Clear the size recorded for MEM. */ extern void clear_mem_size (rtx); @@ -489,10 +489,10 @@ extern rtx change_address (rtx, machine_mode, rtx); #define adjust_automodify_address_nv(MEMREF, MODE, ADDR, OFFSET) \ adjust_automodify_address_1 (MEMREF, MODE, ADDR, OFFSET, 0) -extern rtx adjust_address_1 (rtx, machine_mode, HOST_WIDE_INT, int, int, - int, HOST_WIDE_INT); +extern rtx adjust_address_1 (rtx, machine_mode, poly_int64, int, int, + int, poly_int64); extern rtx adjust_automodify_address_1 (rtx, machine_mode, rtx, - HOST_WIDE_INT, int); + poly_int64, int); /* Return a memory reference like MEMREF, but whose address is changed by adding OFFSET, an RTX, to it. POW2 is the highest power of two factor @@ -507,7 +507,7 @@ extern void set_mem_attributes (rtx, tree, int); /* Similar, except that BITPOS has not yet been applied to REF, so if we alter MEM_OFFSET according to T then we should subtract BITPOS expecting that it'll be added back in later. */ -extern void set_mem_attributes_minus_bitpos (rtx, tree, int, HOST_WIDE_INT); +extern void set_mem_attributes_minus_bitpos (rtx, tree, int, poly_int64); /* Return OFFSET if XEXP (MEM, 0) - OFFSET is known to be ALIGN bits aligned for 0 <= OFFSET < ALIGN / BITS_PER_UNIT, or @@ -516,7 +516,7 @@ extern int get_mem_align_offset (rtx, unsigned int); /* Return a memory reference like MEMREF, but with its mode widened to MODE and adjusted by OFFSET. */ -extern rtx widen_memory_access (rtx, machine_mode, HOST_WIDE_INT); +extern rtx widen_memory_access (rtx, machine_mode, poly_int64); extern void maybe_set_max_label_num (rtx_code_label *x); |