Hi all,
I’m trying to understand how the Module object works more in details, so suppose I’ve an empty module and I’d like to know if it is possible to add instructions at runtime and execute it. Is it possible to do it? Any suggestion on how?
If you’re looking to execute code at runtime (within th eam process - or across a network etc - as the one that compiles that code (rather than writing an executable/object code to dusk etc)) sounds like you’re looking for a JIT. Here’s some info on how to use/write a JIT using llvm: https://llvm.org/docs/tutorial/BuildingAJIT1.html
Hi David,
Thanks for your answer. Just to clarify, I would like to create 2 3 instructions put them in a function and execute them. Do you still think the JIT would be the best option?
As far as LLVM is concerned, yeah. Though if you have that small amount of code it might be quicker to interpret it directly rather than going all the way into/through llvm