Related articles |
---|
pointer elimination in C miller@crx.ece.cmu.edu (Karen Miller) (1993-10-05) |
Re:pointer elimination in C ghiya@flo.cs.mcgill.ca (1993-10-06) |
Re: pointer elimination in C donawa@bluebeard.cs.mcgill.ca (Chris DONAWA) (1993-10-10) |
Re: pointer elimination in C doug@netcom.com (1993-10-19) |
Re: pointer elimination in C pop@dcs.gla.ac.uk (Robin Popplestone) (1993-10-22) |
Re: pointer elimination in C macrakis@osf.org (1993-10-22) |
Re: pointer elimination in C henry@zoo.toronto.edu (1993-10-22) |
Re: pointer elimination in C mcdonald@kestrel.edu (1993-10-28) |
Re: pointer elimination in C ted@crl.nmsu.edu (1993-10-29) |
[3 later articles] |
Newsgroups: | comp.compilers |
From: | Chris DONAWA <donawa@bluebeard.cs.mcgill.ca> |
Keywords: | C, optimize |
Organization: | Compilers Central |
References: | 93-10-039 |
Date: | Sun, 10 Oct 1993 18:32:33 GMT |
: [Does anyone have any idea in actual C code what fraction of pointer use
: is easily turned into subscripts, what fraction is handled with hacks like
: the one above (i.e. references can be shown to something with a local or
: global name) and what fraction is to anonymous data? ... -John]
My impression is that a great deal of may aliases come from passing the
address of variables as parameters. While, as Rakesh pointed out, this
can make it difficult to replace dereference operations with the alias
itself, if the function is inlined such replacement becomes trivial. For
example:
foo(){
int a,b;
bar(&a);
bar(&b)
}
bar(int *x){
printf("%d",*x); /* no source-level replacement for *x */
}
would be transformed to something like
foo(){
int a,b;
int *tmp1,*tmp2;
tmp1 = &a;
printf("%d",*tmp1);
tmp2 = &b;
printf("%d",*tmp2);
}
After this, a straight forward replacement of *tmp1 and *tmp2 is
simplicity itself. Of course there are trade-offs for inlining, but with
accuruate alias analysis the case for inlining is weighted a bit more
heavily. Currently, we have an automatic inliner (for the McCAT
compiler), and are in the process of gathering statistics for the
influence of alias analysis. If there is interest in these results, we'll
post them to the net.
Christopher Donawa
School of Computer Science,
McGill University,
Montreal, Canada.
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.