From 0cb07998ae317e89dbf9695db731bfc8aa5f9d41 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 22 Sep 2014 07:36:51 +0000 Subject: [PATCH] rtl.h (subreg_info): Expand commentary gcc/ * rtl.h (subreg_info): Expand commentary * rtlanal.c (subreg_get_info): Likewise. From-SVN: r215447 --- gcc/ChangeLog | 5 +++++ gcc/rtl.h | 7 +++++-- gcc/rtlanal.c | 15 ++++++++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3420fb03455..9227427c161 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-09-22 Richard Sandiford + + * rtl.h (subreg_info): Expand commentary + * rtlanal.c (subreg_get_info): Likewise. + 2014-09-22 Richard Sandiford * hard-reg-set.h (COPY_HARD_REG_SET, COMPL_HARD_REG_SET) diff --git a/gcc/rtl.h b/gcc/rtl.h index e919aaeca93..93df69152c2 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -2875,10 +2875,13 @@ struct subreg_info { /* Offset of first hard register involved in the subreg. */ int offset; - /* Number of hard registers involved in the subreg. */ + /* Number of hard registers involved in the subreg. In the case of + a paradoxical subreg, this is the number of registers that would + be modified by writing to the subreg; some of them may be don't-care + when reading from the subreg. */ int nregs; /* Whether this subreg can be represented as a hard reg with the new - mode. */ + mode (by adding OFFSET to the original hard register). */ bool representable_p; }; diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index e361f0f4540..30634580f2c 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -3410,7 +3410,20 @@ subreg_lsb (const_rtx x) xmode - The mode of xregno. offset - The byte offset. ymode - The mode of a top level SUBREG (or what may become one). - info - Pointer to structure to fill in. */ + info - Pointer to structure to fill in. + + Rather than considering one particular inner register (and thus one + particular "outer" register) in isolation, this function really uses + XREGNO as a model for a sequence of isomorphic hard registers. Thus the + function does not check whether adding INFO->offset to XREGNO gives + a valid hard register; even if INFO->offset + XREGNO is out of range, + there might be another register of the same type that is in range. + Likewise it doesn't check whether HARD_REGNO_MODE_OK accepts the new + register, since that can depend on things like whether the final + register number is even or odd. Callers that want to check whether + this particular subreg can be replaced by a simple (reg ...) should + use simplify_subreg_regno. */ + void subreg_get_info (unsigned int xregno, enum machine_mode xmode, unsigned int offset, enum machine_mode ymode, -- 2.30.2