This is the mail archive of the gcc@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: should MEM tracking be able to optimize this?


Richard Kenner <kenner@vlsi1.ultra.nyu.edu> writes:

        Would it be possible to put the fields in different alias sets at
        tree->rtl conversion time (or whenever the alias sets are first
        computed), as we should know they don't overlap?
     
    Well there's no mechanism for fields to have alias sets and even if
    they did, the alias set for the reference would be that of "float", not
    of the field.  This is because of the addressing rules in C.

OK.

How about this example:

struct example
{
  char a;
  int  b;
  char c;
  int  d;
} *ex1;

void
foo (void)
{
  ex1->a = '1';
  ex1->b = 2;
  ex1->c = '3';
  ex1->d = 4;
}

on sparc:

foo:
	!#PROLOGUE# 0
	!#PROLOGUE# 1
	sethi	%hi(ex1), %o1
	ld	[%o1+%lo(ex1)], %o2  <- this
	mov	49, %o0
	stb	%o0, [%o2]
	ld	[%o1+%lo(ex1)], %o3  <-  is reloaded after store byte
	mov	51, %o0
	stb	%o0, [%o3+8]
	ld	[%o1+%lo(ex1)], %o2  <-  same here
	mov	2, %o0
	st	%o0, [%o3+4]
	mov	4, %o1
	retl
	st	%o1, [%o2+12]


It seems that ex1->a and ex1->c are put in the alias set 0 and it
should not be necessary. 
Can this be avoided? 


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