Questions about LLVM

Dear list,

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 in the Objective-C runtime. It is written by Philippe Mougin.

The goal is for me to become more familiar with LLVM, and learn about the conclusions we can draw in terms performance improvements (or degradation !), possible optimizations, etc. So far, I have followed with great interest the Kaleidoscope tutorial, this gave me an initial idea of what needs to be accomplished.

In F-Script everything is represented as an Objective-C object.
When a block is parsed, a AST representation is built and then interpreted. The mechanics of interpretation are rather complicated, and for a start, I would like to stay way from that. Thus, I have chosen to JIT only expressions, but not blocks (yet).

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? If that is possible it would enable me to start progressively porting F-Script to LLVM, instead of reinventing the wheel and port everything at once.

  2. If the previous answer is yes, can you point me to some code where CGObjCRuntime is used?

  3. If the previous answer is no, do you have a suggestion for an alternative approach?

Thank you in advance for your help!

Best Regards,
Camille

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? If that is possible it would enable me
to start progressively porting F-Script to LLVM, instead of reinventing the
wheel and port everything at once.

It's a possibility, but I'm not sure how much it'll help you; writing
the bits you need from scratch shouldn't be much harder than making
ObjC calls in an interpreter.

2. If the previous answer is yes, can you point me to some code
where CGObjCRuntime is used?

I don't think anyone outside of clang is using it at the moment.

On a side note, it's better to ask this sort of question on cfe-dev.

-Eli

Alright, I can try this way.
Could you please elaborate on “the bits” I would have to write?
Does it mean implementing calls to the objc runtime?
I believe that would not be that difficult.

Cam