ExecutionEngine should have a non-Module creator

With the support of Multi-modules, it makes sense to have a creator / constructor for ExecutionEngine that does not require a module.

The use-case is a program using one EE created at initialization that holds many modules created later, as needed.

Workaround for current API could be

  1. using a pointer to EE init with NULL, delaying the actual EE construction to the time the first module is ready and skipping construction with later modules.
  2. supplying a dummy Module to the creator and then removeModule(M).


I agree that this would be useful. One minor stumbling block is that the EngineBuilder uses the supplied Module to determine the target triple when creating the TargetMachine. Obviously that could be handled with different EngineBuilder usage (the API may even already be there for that). It’s just something to consider.


If someone encounters this problem here is my workaround code,


llvm::OwningPtrllvm::ExecutionEngine m_EE;
llvm::Module* m_LastModule;

after making module:

if (!m_EE) {
} else {