Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.compilers    |    Compiler construction, theory, etc. (Mod    |    2,753 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 1,075 of 2,753    |
|    Hans-Peter Diettrich to joggingsong@gmail.com    |
|    Re: optimizing address calculation?    |
|    18 Sep 07 16:53:03    |
   
   From: DrDiettrich1@aol.com   
      
   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   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca