[cfe-dev] Objective-C Code Generation
clattner at apple.com
Mon Feb 25 13:34:20 PST 2008
On Feb 25, 2008, at 3:34 AM, David Chisnall wrote:
> On 25 Feb 2008, at 04:43, Chris Lattner wrote:
>> 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?
> I'm talking about method definitions, rather than message sends.
> These methods are implemented as functions with two hidden arguments
> (id self and SEL _cmd on the GNU and NeXT runtimes, id self and
> struct objc_call _call on the Étoilé runtime so, at some point,
> factoring out the argument lowering code will be useful). A pointer
> to this function is then installed in the relevant objc_class
> structure. Obviously this last step will require some new code (and
> be completely runtime-specific. I think Apple have at least two
> ways of doing it for their various runtimes), but generating the
> function body ought to be possible with existing code (since
> everything that's valid as an Objective-C method is also valid as a
> The hidden parameters and the function name (I don't think any
> existing runtimes rely on name mangling for lookup, but it's
> possible a future one will) should probably be specified in some
> runtime-specific code. After this, it can be generated exactly as a
> function would.
Ok, it sounds like factoring out the relevant functionality is the
right way to go. We'll eventually need very similar code for C++
methods as well, which get a this pointer.
More information about the cfe-dev