|[2 earlier articles]|
|Re: Death by pointers. firstname.lastname@example.org (1995-09-05)|
|Re: Death by pointers. email@example.com (1995-09-05)|
|Re: Death by pointers. firstname.lastname@example.org (1995-09-06)|
|Re: Death by pointers. email@example.com (1995-09-11)|
|Re: Death by pointers. firstname.lastname@example.org (1995-09-12)|
|Re: Death by pointers. email@example.com (1995-09-12)|
|Re: Death by pointers. firstname.lastname@example.org (1995-09-13)|
|Re: Death by pointers. ECE@dwaf-hri.pwv.gov.za (John Carter) (1995-09-23)|
|Re: Death by pointers. email@example.com (Stefan Monnier) (1995-09-25)|
|From:||firstname.lastname@example.org (Preston Briggs)|
|Keywords:||C, optimize, architecture|
|Organization:||Tera Computer Company, Seattle, WA|
|References:||95-08-195 95-09-030 95-09-061|
|Date:||Wed, 13 Sep 1995 16:19:42 GMT|
email@example.com (Joseph H Allen) writes:
>Anyway, there is a solution to this problem, although I'm not sure if it's
>worthwhile. You just completely skip alias detection in the compiler.
>Assume that there is no alias to your pointer and load it into a register if
>doing so will help optimize the code. The trick is to also load an
>extension to the register with the address of the origin of the pointer.
>Now whenever the CPU does a store, it checks the address of each loaded
>pointer. If any registers have the pointer, the register gets an update.
>Basically the registers act like a sort of mini-cache.
No, this is inadequate. (However, it's been proposed so often it
ought to be in the FAQ.) Consider the following example
*p = 5;
*q = 6;
i = 5 + *p;
With adequate alias analysis, we might be able to prove that p and q
never point to the same location, allowing us to replace the addition
with the constant 10, all at compile time. Similar examples arise
with all sorts of optimization, and especially with parallelization.
Return to the
Search the comp.compilers archives again.