This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Use simplify_replace_rtx rather than wrap_constant
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Alexandre Oliva <aoliva at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 30 Sep 2009 21:11:59 +0100
- Subject: Re: Use simplify_replace_rtx rather than wrap_constant
- References: <87ljk1sr4c.fsf@firetop.home> <ord458iygk.fsf@huru.localdomain>
Hi Alex,
Thanks for the feedback.
Alexandre Oliva <aoliva@redhat.com> writes:
> The one bit I'm concerned about is the potential loss of modes in
> CONST_INTs in VALUE equivalence tables and in the expansion of locs.
> I'd expect some assertions to fail if this patch actually broke anything
> in this regard, though. We'll see.
The mode of a VALUE entry is taken from the VALUE rtx itself, so if
we're looking up a value in the table, we always have the table entry's
mode to hand. The problem is the mode of the value we're trying to
find, which is what wrap_constant was originally there to deal with.
The patch leaves that part intact, although like I say, I'd prefer to
pass an (rtx, mode) pair instead a throw-away CONST.
When replacing VALUEs with CONST_INTs, the principle is the same:
the CONST_INT in the table should already be canonical for the
VALUE's mode, and anything that wants to know the mode of the
CONST_INT should either (a) get it from the VALUE (if it's still
to hand) or (b) be given the information up-front, such as in a
separate function parameter. The principle's the same as the
result of simplify_binary_operation, or whatever, since it too
could return a CONST_INT for a non-CONST_INT input.
(I realise I'm probably not saying anything new here.
Just doing it for avoidance of doubt.)
Richard