I need a way to statically compile a module written in Julia to LLVM IR. I would modify this LLVM IR representation of the module for my project and would like to somehow replug this LLVM IR representation in Julia system image to run it. Please let me know what is the best way forward to do this.
I suppose there are 2 parts of this question.
I need help to statically compile a Julia module to LLVM IR. I have tried the Julia Computing blog Static and AOT compiled Julia to generate a system image in LLVM bitcode (using --output-bc) format. The problem is that the generated image is just a wrapper and the actual compiled module code is stored as a byte array in this file. I am not sure if the byte array is a native representation of system image or a bit code representation.
Also, I do not think macro @code_llvm would work as it modifies the actual LLVM code. It is useful to take a look at the LLVM representation but not if I want to link it back to the rest of the Julia code.
How to embed a LLVM bitcode representation of a Julia module in the system image. How do I link it with the rest of the Julia code?