[llvm-commits] Function aliases

Chris Lattner clattner at apple.com
Thu Apr 19 22:22:10 PDT 2007


On Apr 19, 2007, at 3:24 PM, Anton Korobeynikov wrote:

> Hello, Dan.
>
>> int x = 2;
>> extern int y __attribute__((alias("x")));
> Funny. This isn't mentioned in gcc docs. This slightly changes the
> situation.

Thanks Dan, I had a sneaking suspicion that this was the case :)

> Chris, maybe in this situation it will be better to spare 4 bytes at
> GlobalValue object to store pointer to alias string there?

I don't think that really makes sense.  Aliases aren't really global  
variables or functions themselves, they are a third kind of object.

What do you think about making a new GlobalAlias class, which derives  
from GlobalValue.  Module would contain a list of these, just like it  
has a list of functions and gvars?

This would clearly solve the memory use issue and I think it would be  
a cleaner design (obvious they can't have bodies, etc).

What do you think?

-Chris



More information about the llvm-commits mailing list