+ /// is appropriate for the current machine. This takes ownership of the
+ /// module provider.
+ static ExecutionEngine *create(ModuleProvider *MP,
+ bool ForceInterpreter = false,
+ std::string *ErrorStr = 0,
+ CodeGenOpt::Level OptLevel =
+ CodeGenOpt::Default,
+ // Allocating globals with code breaks
+ // freeMachineCodeForFunction and is probably
+ // unsafe and bad for performance. However,
+ // we have clients who depend on this
+ // behavior, so we must support it.
+ // Eventually, when we're willing to break
+ // some backwards compatability, this flag
+ // should be flipped to false, so that by
+ // default freeMachineCodeForFunction works.
+ bool GVsWithCode = true);
+
+ /// create - This is the factory method for creating an execution engine which
+ /// is appropriate for the current machine. This takes ownership of the
+ /// module.
+ static ExecutionEngine *create(Module *M);
+
+ /// createJIT - This is the factory method for creating a JIT for the current
+ /// machine, it does not fall back to the interpreter. This takes ownership
+ /// of the ModuleProvider and JITMemoryManager if successful.
+ ///
+ /// Clients should make sure to initialize targets prior to calling this
+ /// function.
+ static ExecutionEngine *createJIT(ModuleProvider *MP,
+ std::string *ErrorStr = 0,
+ JITMemoryManager *JMM = 0,
+ CodeGenOpt::Level OptLevel =
+ CodeGenOpt::Default,
+ bool GVsWithCode = true);
+
+ /// addModuleProvider - Add a ModuleProvider to the list of modules that we
+ /// can JIT from. Note that this takes ownership of the ModuleProvider: when
+ /// the ExecutionEngine is destroyed, it destroys the MP as well.
+ virtual void addModuleProvider(ModuleProvider *P) {
+ Modules.push_back(P);
+ }
+
+ //===----------------------------------------------------------------------===//
+
+ const TargetData *getTargetData() const { return TD; }
+
+
+ /// removeModuleProvider - Remove a ModuleProvider from the list of modules.
+ /// Relases the Module from the ModuleProvider, materializing it in the
+ /// process, and returns the materialized Module.
+ virtual Module* removeModuleProvider(ModuleProvider *P,
+ std::string *ErrInfo = 0);
+
+ /// deleteModuleProvider - Remove a ModuleProvider from the list of modules,
+ /// and deletes the ModuleProvider and owned Module. Avoids materializing
+ /// the underlying module.
+ virtual void deleteModuleProvider(ModuleProvider *P,std::string *ErrInfo = 0);