[llvm-commits] [PATCH][RFC] PR10367: don't allow GlobalAlias's aliasee to be an arbitrary Constant
Duncan Sands
baldrick at free.fr
Sat Jul 30 05:54:36 PDT 2011
Hi Chris,
>>> To summarise the PR, Chris said that a GlobalAlias's aliasee should
>>> always be a GlobalValue (we shouldn't allow arbitrary Constants), and
>>> the types of the alias and the aliasee shouldn't be required to match.
>>
>> If we go this way then we eliminate the possibility of having an alias into
>> the middle of a global variable.
>
> I don't see that this is something we can support. Aliases are a very simple conceptual model, it isn't clear that extending them to support this is a good cost/benefit tradeoff. Is this supported by ELF?
I've no idea if it is supported by ELF [*]. Another use for this feature would
be for people who want their global variables to occur one after the other in a
given order: they can declare a private global variable which has the real
global variables as fields, and declare the globals to be aliases of the fields.
Ciao, Duncan.
[*] The simplest and most useful case is a GEP with all constant integer
operands that is just referring to some field inside the global. I have
no idea if ELF supports that, but probably by outputting a label before
each field of the global and having the alias-GEP turn into an alias of the
appropriate label you could get the desired effect.
More information about the llvm-commits
mailing list