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/print-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/print-rtl.c')
-rw-r--r-- | gcc/print-rtl.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c index 66dcf92..7e0a0a0 100644 --- a/gcc/print-rtl.c +++ b/gcc/print-rtl.c @@ -178,6 +178,23 @@ print_mem_expr (FILE *outfile, const_tree expr) fputc (' ', outfile); print_generic_expr (outfile, CONST_CAST_TREE (expr), dump_flags); } + +/* Print X to FILE. */ + +static void +print_poly_int (FILE *file, poly_int64 x) +{ + HOST_WIDE_INT const_x; + if (x.is_constant (&const_x)) + fprintf (file, HOST_WIDE_INT_PRINT_DEC, const_x); + else + { + fprintf (file, "[" HOST_WIDE_INT_PRINT_DEC, x.coeffs[0]); + for (int i = 1; i < NUM_POLY_INT_COEFFS; ++i) + fprintf (file, ", " HOST_WIDE_INT_PRINT_DEC, x.coeffs[i]); + fprintf (file, "]"); + } +} #endif /* Subroutine of print_rtx_operand for handling code '0'. @@ -509,9 +526,11 @@ rtx_writer::print_rtx_operand_code_r (const_rtx in_rtx) if (REG_EXPR (in_rtx)) print_mem_expr (m_outfile, REG_EXPR (in_rtx)); - if (REG_OFFSET (in_rtx)) - fprintf (m_outfile, "+" HOST_WIDE_INT_PRINT_DEC, - REG_OFFSET (in_rtx)); + if (maybe_ne (REG_OFFSET (in_rtx), 0)) + { + fprintf (m_outfile, "+"); + print_poly_int (m_outfile, REG_OFFSET (in_rtx)); + } fputs (" ]", m_outfile); } if (regno != ORIGINAL_REGNO (in_rtx)) |