diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-12-20 12:52:22 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-12-20 12:52:22 +0000 |
commit | 84bc717b510cc56f64120dd58c64e1f6ebfad5e3 (patch) | |
tree | 453653202c11c4dbbfe83c406937159f5b19a558 /gcc/emit-rtl.c | |
parent | 37b2b8f95783b449aca30d32f4c97a4db3bd395e (diff) | |
download | gcc-84bc717b510cc56f64120dd58c64e1f6ebfad5e3.zip gcc-84bc717b510cc56f64120dd58c64e1f6ebfad5e3.tar.gz gcc-84bc717b510cc56f64120dd58c64e1f6ebfad5e3.tar.bz2 |
poly_int: REG_OFFSET
This patch changes the type of the reg_attrs offset field
from HOST_WIDE_INT to poly_int64 and updates uses accordingly.
This includes changing reg_attr_hasher::hash to use inchash.
(Doing this has no effect on code generation since the only
use of the hasher is to avoid creating duplicate objects.)
2017-12-20 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* rtl.h (reg_attrs::offset): Change from HOST_WIDE_INT to poly_int64.
(gen_rtx_REG_offset): Take the offset as a poly_int64.
* inchash.h (inchash::hash::add_poly_hwi): New function.
* gengtype.c (main): Register poly_int64.
* emit-rtl.c (reg_attr_hasher::hash): Use inchash. Treat the
offset as a poly_int.
(reg_attr_hasher::equal): Use must_eq to compare offsets.
(get_reg_attrs, update_reg_offset, gen_rtx_REG_offset): Take the
offset as a poly_int64.
(set_reg_attrs_from_value): Treat the offset as a poly_int64.
* print-rtl.c (print_poly_int): New function.
(rtx_writer::print_rtx_operand_code_r): Treat REG_OFFSET as
a poly_int.
* var-tracking.c (track_offset_p, get_tracked_reg_offset): New
functions.
(var_reg_set, var_reg_delete_and_set, var_reg_delete): Use them.
(same_variable_part_p, track_loc_p): Take the offset as a poly_int64.
(vt_get_decl_and_offset): Return the offset as a poly_int64.
Enforce track_offset_p for parts of a PARALLEL.
(vt_add_function_parameter): Use const_offset for the final
offset to track. Use get_tracked_reg_offset for the parts
of a PARALLEL.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r255867
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r-- | gcc/emit-rtl.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 799b94a..ff3585e 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -196,7 +196,6 @@ static rtx lookup_const_wide_int (rtx); #endif static rtx lookup_const_double (rtx); static rtx lookup_const_fixed (rtx); -static reg_attrs *get_reg_attrs (tree, int); static rtx gen_const_vector (machine_mode, int); static void copy_rtx_if_shared_1 (rtx *orig); @@ -393,7 +392,10 @@ reg_attr_hasher::hash (reg_attrs *x) { const reg_attrs *const p = x; - return ((p->offset * 1000) ^ (intptr_t) p->decl); + inchash::hash h; + h.add_ptr (p->decl); + h.add_poly_hwi (p->offset); + return h.end (); } /* Returns nonzero if the value represented by X is the same as that given by @@ -405,19 +407,19 @@ reg_attr_hasher::equal (reg_attrs *x, reg_attrs *y) const reg_attrs *const p = x; const reg_attrs *const q = y; - return (p->decl == q->decl && p->offset == q->offset); + return (p->decl == q->decl && known_eq (p->offset, q->offset)); } /* Allocate a new reg_attrs structure and insert it into the hash table if one identical to it is not already in the table. We are doing this for MEM of mode MODE. */ static reg_attrs * -get_reg_attrs (tree decl, int offset) +get_reg_attrs (tree decl, poly_int64 offset) { reg_attrs attrs; /* If everything is the default, we can just return zero. */ - if (decl == 0 && offset == 0) + if (decl == 0 && known_eq (offset, 0)) return 0; attrs.decl = decl; @@ -1218,10 +1220,10 @@ reg_is_parm_p (rtx reg) to the REG_OFFSET. */ static void -update_reg_offset (rtx new_rtx, rtx reg, int offset) +update_reg_offset (rtx new_rtx, rtx reg, poly_int64 offset) { REG_ATTRS (new_rtx) = get_reg_attrs (REG_EXPR (reg), - REG_OFFSET (reg) + offset); + REG_OFFSET (reg) + offset); } /* Generate a register with same attributes as REG, but with OFFSET @@ -1229,7 +1231,7 @@ update_reg_offset (rtx new_rtx, rtx reg, int offset) rtx gen_rtx_REG_offset (rtx reg, machine_mode mode, unsigned int regno, - int offset) + poly_int64 offset) { rtx new_rtx = gen_rtx_REG (mode, regno); @@ -1265,7 +1267,7 @@ adjust_reg_mode (rtx reg, machine_mode mode) void set_reg_attrs_from_value (rtx reg, rtx x) { - int offset; + poly_int64 offset; bool can_be_reg_pointer = true; /* Don't call mark_reg_pointer for incompatible pointer sign |