[llvm-commits] Function aliases

Gordon Henriksen gordonhenriksen at mac.com
Fri Apr 20 06:51:33 PDT 2007


On 2007-04-20, at 01:22, Chris Lattner wrote:

> On Apr 19, 2007, at 3:24 PM, Anton Korobeynikov wrote:
>
>> 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,

Why not simply reinsert the aliased GV into the symbol table under  
the alias name? In this manner, alias objects would not need to  
derive from GlobalValue at all. Aliases could be stored in a list on  
the side as you describe, solving the memory usage problem. The  
majority of code could remain ignorant of them, resolving the code  
duplication Anton was worried about.

— Gordon

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070420/5cd6ee13/attachment.html>


More information about the llvm-commits mailing list