[llvm-commits] Function aliases
Anton Korobeynikov
asl at math.spbu.ru
Thu Apr 19 00:05:02 PDT 2007
Hello, Chris.
> First, you are changing the LLVM language. When you do this, please
> submit a patch for langref before you write code :). In this case,
> I'd like to see the patch so that I understand the semantics of what
> you're proposing.
Ok. However language semantics was already discussed with you and Reid
some time ago :) The syntax itself is:
declare %i32 foo(...) alias "bar"
> Do aliases only apply to function-like things, or can they also apply
> to global vars?
Aliases are "hacks". I don't see any field, where they can be useful,
except gcc support. GCC doesn't allow variable aliases and I don't know
how they should look (and work!). That's why I'm focusing on function
aliases only.
> This needs a block comment above it for doxygen, explaining what it
> is. Also, you have FunctionAlias. Is there also a
> GlobalVariableAlias? Why does this inherit from Function? Can
> FunctionAliases have a body? If not, it shouldn't inherit from
> Function.
FunctionAliases are actually Functions declarations with some "extra"
information. That's why they should be inherited from Function. Another
reason: this will allow all optimization passes think about
FunctionAliases as Functions and use casts if they actually need alias
target
> + if (TAI->getSetDirective()) {
> + if (FunctionAliases.begin() != FunctionAliases.end())
> if (!FunctionAliases.empty())
I saw such idiom many time in the current LLVM code. That's why I
selected it :)
> Other stuff: should the verifier reject aliases with no name?
Yes, I've forgotten about this.
> How do aliases interact with the Linker?
Linker patch was included. Currently we're linking two aliases only if
they have same name and go to the same destination.
--
With best regards, Anton Korobeynikov.
Faculty of Mathematics & Mechanics, Saint Petersburg State University.
More information about the llvm-commits
mailing list