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:
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.
If the previous answer is yes, can you point me to some code where CGObjCRuntime is used?
If the previous answer is no, do you have a suggestion for an alternative approach?
Thank you in advance for your help!