From fad2288b4b1e63fce8550d70f99bcc16e54bf539 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Wed, 3 Jan 2018 07:17:33 +0000 Subject: poly_int: REGMODE_NATURAL_SIZE This patch makes target-independent code that uses REGMODE_NATURAL_SIZE treat it as a poly_int rather than a constant. 2018-01-03 Richard Sandiford Alan Hayward David Sherwood gcc/ * combine.c (can_change_dest_mode): Handle polynomial REGMODE_NATURAL_SIZE. * expmed.c (store_bit_field_1): Likewise. * expr.c (store_constructor): Likewise. * emit-rtl.c (validate_subreg): Operate on polynomial mode sizes and polynomial REGMODE_NATURAL_SIZE. (gen_lowpart_common): Likewise. * reginfo.c (record_subregs_of_mode): Likewise. * rtlanal.c (read_modify_subreg_p): Likewise. Co-Authored-By: Alan Hayward Co-Authored-By: David Sherwood From-SVN: r256149 --- gcc/reginfo.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'gcc/reginfo.c') diff --git a/gcc/reginfo.c b/gcc/reginfo.c index 3d1c2ed..90d25c8 100644 --- a/gcc/reginfo.c +++ b/gcc/reginfo.c @@ -1294,10 +1294,14 @@ record_subregs_of_mode (rtx subreg, bool partial_def) subregs will be invalid. This relies on the fact that we've already been passed - SUBREG with PARTIAL_DEF set to false. */ - unsigned int size = MAX (REGMODE_NATURAL_SIZE (shape.inner_mode), - GET_MODE_SIZE (shape.outer_mode)); - gcc_checking_assert (size < GET_MODE_SIZE (shape.inner_mode)); + SUBREG with PARTIAL_DEF set to false. + + The size of the outer mode must ordered wrt the size of the + inner mode's registers, since otherwise we wouldn't know at + compile time how many registers the outer mode occupies. */ + poly_uint64 size = MAX (REGMODE_NATURAL_SIZE (shape.inner_mode), + GET_MODE_SIZE (shape.outer_mode)); + gcc_checking_assert (known_lt (size, GET_MODE_SIZE (shape.inner_mode))); if (known_ge (shape.offset, size)) shape.offset -= size; else -- cgit v1.1