This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [lno] [patch] vectorizer update - loop bound
- From: Paul Brook <paul at codesourcery dot com>
- To: Dorit Naishlos <DORIT at il dot ibm dot com>
- Cc: gcc-patches at gcc dot gnu dot org, pop at gauvain dot u-strasbg dot fr,Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Date: Tue, 20 Jan 2004 17:54:28 +0000
- Subject: Re: [lno] [patch] vectorizer update - loop bound
- Organization: CodeSourcery
- References: <OFAAD60C52.3C2674E0-ONC2256E20.005C998A-C2256E21.005E4194@il.ibm.com>
On Tuesday 20 January 2004 5:09 pm, Dorit Naishlos wrote:
> > In gfortran we currently flatten all array access into a 0-based one
> > dimensional array pointer.
> >
> > This is something that I hope to address fairly soon. To be done properly
>
> I
>
> > think it requires the addition of additional semantics for ARRAY_TYPEs,
> > and/or an extra lowering pass.
>
> I'm not sure I understand - Do you mean that the TYPE_MIN_VALUE of the
> arrays is always set to 0, but the references are not yet modified
> accordingly?
We never addess an array object directly. We always create a pointer to an
array with a TYPE_MIN_VALUE of zero and unknown length, and point that at
wherever we need to.
In the example given by Toon a(1) is the first element of the array, so we
point the pointer at the element before the start of the array. The
equivalent C code is something like:
int main()
{
float a[1000];
int i;
float *p;
p=a[-1];
for (i=1; i <= 1000; i++)
p[i] = logf (1.0f)
}
Yes, it's evil, but seemed the easiest way of handling all the things fortran
can do with arrays. It gets even more fun for multidimensional arrays.
Using array types properly is fairly high on my list of things to fix.
> If I compile Toon's example below with gfortran, I get 0 for TYPE_MIN_VALUE
> (TYPE_DOMAIN (array_type)). Is that an expected behavior?
Yes.
> If so, does the
> compiler have a way to find what is the correct first index?
Probably not. The valid elements of the array may not be contiguous either.
Paul