This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] gen_lowpart and lvalues

On Thu, 24 Feb 2005, Richard Henderson wrote:
> On Thu, Feb 24, 2005 at 12:38:43PM -0700, Roger Sayle wrote:
> > But I do also agree that we should more clearly document that gen_lowpart
> > doesn't preserve the lvalueness of it's operand, and that modifying
> > the rtx returned from that function might/need not affect the value held
> > by the argument rtx.
> I do NOT agree to this.  There are way way too many users that do in
> fact assume this, because for a long time it has been true.

You and Richard Kenner will have to help me out here, because gen_lowpart
has *not* preserved the lvalueness of it's operand from well before I ever
started contributing to GCC!

% cvs annotate -r1.372 emit-rtl.c

1.1  (law 11-Aug-97): /* Must be a hard reg that's not valid in MODE.  */
1.1  (law 11-Aug-97): result = gen_lowpart_common (mode, copy_to_reg (x));
1.6  (law 02-Nov-97): else if (GET_CODE (x) == ADDRESSOF)
1.6  (law 02-Nov-97):   return gen_lowpart (mode, force_reg (GET_MODE (x), x));

> If you want to make this true, then remove gen_lowpart completely and
> replace all users with one of our many other subreg/lowpart generating
> functions.

Everyone is talking about this as if it is somehow a recent change!
I'll do some more archeology to identify when gen_lowpart was added
to GCC prior to current era CVS repository, but my guess is that it has
*never* been lvalue safe.  I wouldn't even be surprised if gen_lowpart
was creating SUBREGs long before they were valid as the destination of
a SET rtx.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]