[cfe-dev] Objective-C Code Generation
Chris Lattner
clattner at apple.com
Sun Feb 24 20:43:22 PST 2008
> Generating code for an Objective-C method involves
> two steps:
>
> 1) Emitting the function that implements the method.
> 2) Set up the class structure to point to it (modify the structure
> directly with the GNU runtime, via functions on the Étoilé and Apple
> runtimes).
Ok.
> The second step is best done via some custom LLVM IR code for each
> runtime. The first step ought to be able to reuse the code in
> CodeGenFunction::GenerateCode. Looking at the ObjCMethodDecl class,
> it seems that this implements most of the methods used by the code
> generator, but since they do not have a common superclass specifying
> these functions the code can not easily be used. Can anyone suggest a
> good way of factoring this out so it can be used in both places? I
> notice a few TODO and FIXME comments there, so I am hesitant about
> just copying and pasting code that is going to be changed later.
What specifically do you need to do? In the next runtime, message
expressions are all pretty simple: they are llvm Function's with
internal linkage and names that contain the selector. I assume you
would like to factor out the argument lowering code? Is there
anything else?
-Chris
More information about the cfe-dev
mailing list