[llvm-commits] Function aliases

Chris Lattner clattner at apple.com
Wed Apr 18 22:16:50 PDT 2007


On Apr 18, 2007, at 4:53 PM, Anton Korobeynikov wrote:

> Hello Everyone.
>
> This is LLVM part of patch, which enable function aliases for LLVM.  
> The
> syntax is pretty simple: it just "mimics" the "section" keyword. I'm
> currently working on gcc part of the patch. Please note, that patch
> breaks bytecode format (llvm-dev message will follow).
>
> Documentation updates & testcases will be added just after this patch
> landed.

Questions questions :)

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.  The BC format documents can come later after it  
lands.  Do aliases only apply to function-like things, or can they  
also apply to global vars?

Specific code comments:

+class FunctionAlias : public Function {
+private:

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.


Minor stuff:


+  std::string getTarget() const { return Target; }

Should return a const& to the string.

+  if (TAI->getSetDirective()) {
+    if (FunctionAliases.begin() != FunctionAliases.end())

if (!FunctionAliases.empty())


+    FunctionAlias* SA = dyn_cast<FunctionAlias>(Src);
+    if (SA) {

if (FunctionAlias* SA = dyn_cast<FunctionAlias>(Src)) {


Other stuff: should the verifier reject aliases with no name?  How do  
aliases interact with the Linker?

I'd like Reid to review the BC reader/writer changes.

Please resend the patch with updates (particularly to langref).   
Thanks Anton, it will be great to get alias support!

-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070418/7e876f4c/attachment.html>


More information about the llvm-commits mailing list