This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa]: GIMPLE lowering array references too early?
- From: law at redhat dot com
- To: Chris Lattner <sabre at nondot dot org>
- Cc: Daniel Berlin <dberlin at dberlin dot org>, gcc at gcc dot gnu dot org, jason at redhat dot com, dnovillo at redhat dot com
- Date: Tue, 29 Jul 2003 12:23:27 -0600
- Subject: Re: [tree-ssa]: GIMPLE lowering array references too early?
- Reply-to: law at redhat dot com
In message <Pine.LNX.4.44.0307291311370.3660-100000@nondot.org>, Chris Lattner
writes:
>On Tue, 29 Jul 2003 law@redhat.com wrote:
>
>> >Would this break everything?
>> It's a source of annoyance. I had started cobbling together some code to
>> do this, but things kept breaking downstream. Probably due to my lack of
>> knowledge about reform the ARRAY_REFs/ARRAY_TYPEs.
>
>I have done a fair amount of work in the past trying to reconstruct array
>references from "lowered" address arithmetic like this, and have come to
>the conclusion that there is no good way to do it in general.
Note that I was not trying to reconstruct array notation from pointer
notation, but trying to keep the compiler from dropping the already existing
array notation down to pointer notation.
For something like this:
char *x;
for (i = 0; i < 10; i++)
whatever x[i]
For code of that style the compiler lowers to pointer notation as it's
generating the tree IL. It'd be *far* better if it kept the existing
array notation for this case. We have the toplevel object (a pointer)
and an index, rather than generating pointer code we should be generating
a suitable ARRAY_REF.
>Given the right people working on the problem, and enough interest, do you
>think it's possible to "fix it right" in the places that break downstream?
More likely the solution is actually generate the correct ARRAY_REF/ARRAY_TYPE
structures to begin with. As I said, I'm pretty sure the failures where
me simply generating the wrong tree nodes.
jeff