/* Executes the AST by running the main function */GenericValue CodeGenContext::runCode() {std::cout << "Running code...\n";ExecutionEngine *ee = EngineBuilder(module).create();< div class="line" id="LC37" style="margin: 0px; padding: 0px 0px 0px 10px; border: 0px;"> vector<GenericValue> noargs;
> On Jan 8, 2013, at 13:55 , "Kaylor, Andrew" <andrew...@intel.com> wrote:
>
>> You need to include 'llvm/ExecutionEngine/JIT.h' (or
>> llvm/ExecutionEngine/JIT.h' if you want that engine) from your main
>> file. Including that file forces the JIT static constructor to be
>> linked into your executable. Without it, the JIT static constructor
>> gets optimized out and you get the result you're seeing.
>
> Wow, how obscure! Thank you; I never would've figured that out.
>
> Why is it done that way? That seems…quite horrible, actually. Why not
> just instantiate the JIT on demand as part of instantiating the
> Engine?
I guess that instantiating the JIT on that way would force the clients
to link with that feature (which exists only on selected platforms.) If
the user wants the interpreter, why should he be forced to include the
JIT on the final executable? And vice-versa: if you are interested only
on the JIT, why should your executable carry the weight of the
interpreter?