[llvm-commits] Function aliases

Reid Spencer rspencer at reidspencer.com
Fri Apr 20 13:04:32 PDT 2007


On Fri, 2007-04-20 at 09:51 -0400, Gordon Henriksen wrote:
> 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.

Right, that's along the same lines as what I'm thinking. We should never
want to create two GlobalValues (of any kind) to represent aliases. The
only distinguishing thing is the name.

> 
> 
> — Gordon
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list