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) |
From: | Hans-Peter Diettrich <DrDiettrich1@aol.com> |
Newsgroups: | comp.compilers |
Date: | Tue, 18 Sep 2007 16:53:03 +0200 |
Organization: | Compilers Central |
References: | 07-09-071 |
Keywords: | optimize, C |
Posted-Date: | 19 Sep 2007 15:55:58 EDT |
joggingsong@gmail.com wrote:
> 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.
Perhaps the compiler couldn't figure out, how x and i are related to
the loop (invariant, loop index, side effects...).
That's why e.g. Pascal doesn't allow to modify the loop index variable
inside the loop, so that the compiler can safely optimize all for
loops.
DoDi
Return to the
comp.compilers page.
Search the
comp.compilers archives again.