[cfe-dev] Clang & Objective-C questions

David Chisnall csdavec at swansea.ac.uk
Tue Jun 2 04:24:06 PDT 2009


Hi Camille,

The CGObjCRuntime class was originally designed to be reused, but has  
since grown a lot of dependencies on other bits of clang, so reusing  
it requires keeping a lot of the other clang code, including the type  
system and bits of the AST.

The code generation in Étoilé's LanguageKit is based on the first  
version of CGObjCRuntime that I wrote, and doesn't have these  
dependencies (the interface is slightly more convoluted because of  
this, but it generates the same code - I have been testing most  
changes there before submitting them to clang).  Unfortunately, it  
also doesn't have an implementation for the Apple runtimes.  You may  
find some inspiration here, however, as it is currently used to  
compile a Smalltalk dialect that is ABI-compatible with GNU Objective- 
C, as well as a dialect of JavaScript.

David

On 2 Jun 2009, at 11:52, Camille Troillard wrote:

> Hello,
>
> I am learning LLVM and would like to add JIT support to the F-Script  
> language.  F-Script is a Smalltalk like scripting language that  
> lives above the Objective-C runtime.  In F-Script everything is  
> represented as an Objective-C object.
>
> Right now, when a block is parsed, a AST representation is built and  
> then interpreted.  This results in selectors calls (by large), but  
> also classes and methods definitions.
>
> My question are:
>
> 1. Do you think it would make sense to use the clang codebase  
> (specifically Objective-C CodeGen / CGObjCRuntime) in order to  
> generate the code that will replace F-Script's interpretation?
>
> (I have asked llvmdev if it was possible to use the objc code  
> generation module in clang to emit the code, and they sent me to cfe- 
> dev.)
>
> 2. If the previous answer is yes, can you point me to some code  
> where CGObjCRuntime is used?  Or advices on how to use it?
>
> 3. If this is not a good idea, do you have a suggestion for an  
> alternative approach?
>
>
> Thanks!
>
>
> Best Regards,
> Camille
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev





More information about the cfe-dev mailing list