Re: optimizing address calculation?

Alex Colvin <alexc@TheWorld.com>
Mon, 24 Sep 2007 20:42:05 +0000 (UTC)

          From comp.compilers

Related articles
optimizing address calculation? joggingsong@gmail.com (2007-09-18)
Re: optimizing address calculation? DrDiettrich1@aol.com (Hans-Peter Diettrich) (2007-09-18)
Re: optimizing address calculation? rupesh0508@gmail.com (2007-09-24)
Re: optimizing address calculation? alexc@TheWorld.com (Alex Colvin) (2007-09-24)
Re: optimizing address calculation? joggingsong@gmail.com (2007-09-25)
| List of all articles for this month |
From: Alex Colvin <alexc@TheWorld.com>
Newsgroups: comp.compilers
Date: Mon, 24 Sep 2007 20:42:05 +0000 (UTC)
Organization: The World : www.TheWorld.com : Since 1989
References: 07-09-071
Keywords: C, optimize
Posted-Date: 24 Sep 2007 21:48:41 EDT

>in the program, I refer to the variable test2a by the pointer
>for example


>for(i = 0; i <20; i++)
>{
> pTest2a->test1a[x].b[i] = i;
>}


>Although in the loop pTest2a->test1a[x] is fixed, it seems the
>generated codes calculate
>the address from pTest2a. If it is changed to the following:


Any code take the address of pTest2a, or make it external? Perhaps the
compiler is afraid that the loop assignment might also change pTest2a, in
which case it needs the addresses need to be recalculated.


Try making it a const, or at least static.
--
mac the naof


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.