This is the mail archive of the gcc-patches@gcc.gnu.org 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: [ast-optimizer-branch] PATCH to simplify array base


On Mon, 2002-06-10 at 17:26, Jason Merrill wrote:
> >>>>> "Richard" == Richard Henderson <rth@redhat.com> writes:
> 
> > I'm of the opinion that
> 
> > 	t1 = k.d.e.f[2][3].g[t0].h
> 
> > ought to be valid in the variant of SIMPLE used in GCC.
> 
> Seems reasonable to me.  Diego, what do you think?
> 
Yes.  I was just looking at it and while the patch creates individual
references that seem easy to deal with, the overall effect may obfuscate
the dependence analyzer.

We should, however, get rid of things like function calls in the base
expression of the array.  Something like allowing simple values and
simple component refs?

Incidentally, the reference inside the argument list for printf() didn't
get simplified.

main()    (ORIGINAL)
{
  struct A a;
  int f;
  a.b[3].c.d[2][5].e[3] = 5;
  printf ((const char *)(char *)"a.b[3].c.d[2][5].e[3] = %d (should be
5)\n", a.b[3].c.d[2][5].e[3]);
  f = a.b[3].c.d[2][5].e[3];
}

main()    (SIMPLIFIED)
{
  struct A a;
  int f;
  int[10] * T.10;
  struct D * T.9;
  struct D[10][10][10] * T.8;
  struct B * T.7;
  struct B[10] * T.6;
  int[10] * T.5;
  struct D * T.4;
  struct D[10][10][10] * T.3;
  struct B * T.2;
  struct B[10] * T.1;
  T.1 = &a.b;
  T.2 = &(*T.1)[3];
  T.3 = &(*T.2).c.d;
  T.4 = &(*T.3)[2][5];
  T.5 = &(*T.4).e;
  (*T.5)[3] = 5;
  printf ((const char *)(char *)"a.b[3].c.d[2][5].e[3] = %d (should be
5)\n", a.b[3].c.d[2][5].e[3]);
  T.6 = &a.b;
  T.7 = &(*T.6)[3];
  T.8 = &(*T.7).c.d;
  T.9 = &(*T.8)[2][5];
  T.10 = &(*T.9).e;
  f = (*T.10)[3];
}

> Jason
> 
-- 
Diego Novillo
GCC Engineering
Red Hat Canada, Ltd.


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