summaryrefslogtreecommitdiff
path: root/gcc/emit-rtl.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-19 17:43:27 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-19 17:43:27 +0000
commitda443c27cfce0227bebc5559e1332fa2f1558c94 (patch)
treedc0b299847e998d99b662b29fa6960f8e4d4b826 /gcc/emit-rtl.c
parent5b2a69fa143a3164437a77df692e558c69485d2a (diff)
downloadgcc-da443c27cfce0227bebc5559e1332fa2f1558c94.tar.gz
gcc/
* doc/rtl.texi (MEM_OFFSET_KNOWN_P): Document. (MEM_OFFSET): Change from returning an rtx to returning a HOST_WIDE_INT. * rtl.h (MEM_OFFSET_KNOWN_P): New macro. (MEM_OFFSET): Return a HOST_WIDE_INT rather than an rtx. * emit-rtl.h (set_mem_offset): Take a HOST_WIDE_INT rather than an rtx. (clear_mem_offset): Declare. * alias.c (ao_ref_from_mem): Adjust uses of MEM_OFFSET, using MEM_OFFSET_KNOWN_P to test whether the offset is known, and MEM_OFFSET to get a HOST_WIDE_INT offset. (nonoverlapping_memrefs_p): Likewise. Adjust calls to... (adjust_offset_for_component_ref): Take a bool "known_p" parameter and a HOST_WIDE_INT "offset" parameter. * builtins.c (get_memory_rtx): As for ao_ref_from_mem. Adjust calls to set_mem_offset, passing a HOST_WIDE_INT rather than an rtx. Use clear_mem_offset to clear the offset. * cfgcleanup.c (merge_memattrs): Likewise. * dwarf2out.c (tls_mem_loc_descriptor): Likewise. * function.c (assign_parm_find_stack_rtl): Likewise. (assign_parm_setup_stack): Likewise. * print-rtl.c (print_rtx): Likewise. * reload.c (find_reloads_subreg_address): Likewise. * simplify-rtx.c (delegitimize_mem_from_attrs): Likewise. * var-tracking.c (INT_MEM_OFFSET): Likewise. * emit-rtl.c (set_reg_attrs_from_value): Likewise. (get_mem_align_offset): Likewise. (set_mem_offset): Take a HOST_WIDE_INT rather than an rtx. (clear_mem_offset): New function. * config/mips/mips.c (r10k_safe_mem_expr_p): Take a HOST_WIDE_INT offset rather than an rtx. Assume both the expressio and offset are available. (r10k_needs_protection_p_1): Update accordingly, checking the expression and offset availability here instead. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@176477 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r--gcc/emit-rtl.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 88624904f01..fd1e5dbe6c3 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -969,9 +969,9 @@ set_reg_attrs_from_value (rtx reg, rtx x)
offset = byte_lowpart_offset (GET_MODE (reg), GET_MODE (x));
if (MEM_P (x))
{
- if (MEM_OFFSET (x) && CONST_INT_P (MEM_OFFSET (x)))
- REG_ATTRS (reg)
- = get_reg_attrs (MEM_EXPR (x), INTVAL (MEM_OFFSET (x)) + offset);
+ if (MEM_OFFSET_KNOWN_P (x))
+ REG_ATTRS (reg) = get_reg_attrs (MEM_EXPR (x),
+ MEM_OFFSET (x) + offset);
if (MEM_POINTER (x))
mark_reg_pointer (reg, 0);
}
@@ -1460,14 +1460,13 @@ get_mem_align_offset (rtx mem, unsigned int align)
unsigned HOST_WIDE_INT offset;
/* This function can't use
- if (!MEM_EXPR (mem) || !MEM_OFFSET (mem)
- || !CONST_INT_P (MEM_OFFSET (mem))
+ if (!MEM_EXPR (mem) || !MEM_OFFSET_KNOWN_P (mem)
|| (MAX (MEM_ALIGN (mem),
get_object_alignment (MEM_EXPR (mem), align))
< align))
return -1;
else
- return (- INTVAL (MEM_OFFSET (mem))) & (align / BITS_PER_UNIT - 1);
+ return (- MEM_OFFSET (mem)) & (align / BITS_PER_UNIT - 1);
for two reasons:
- COMPONENT_REFs in MEM_EXPR can have NULL first operand,
for <variable>. get_inner_reference doesn't handle it and
@@ -1477,12 +1476,10 @@ get_mem_align_offset (rtx mem, unsigned int align)
isn't sufficiently aligned, the object it is in might be. */
gcc_assert (MEM_P (mem));
expr = MEM_EXPR (mem);
- if (expr == NULL_TREE
- || MEM_OFFSET (mem) == NULL_RTX
- || !CONST_INT_P (MEM_OFFSET (mem)))
+ if (expr == NULL_TREE || !MEM_OFFSET_KNOWN_P (mem))
return -1;
- offset = INTVAL (MEM_OFFSET (mem));
+ offset = MEM_OFFSET (mem);
if (DECL_P (expr))
{
if (DECL_ALIGN (expr) < align)
@@ -1901,12 +1898,24 @@ set_mem_expr (rtx mem, tree expr)
/* Set the offset of MEM to OFFSET. */
void
-set_mem_offset (rtx mem, rtx offset)
+set_mem_offset (rtx mem, HOST_WIDE_INT offset)
{
struct mem_attrs attrs;
attrs = *get_mem_attrs (mem);
- attrs.offset = offset;
+ attrs.offset = GEN_INT (offset);
+ set_mem_attrs (mem, &attrs);
+}
+
+/* Clear the offset of MEM. */
+
+void
+clear_mem_offset (rtx mem)
+{
+ struct mem_attrs attrs;
+
+ attrs = *get_mem_attrs (mem);
+ attrs.offset = NULL_RTX;
set_mem_attrs (mem, &attrs);
}