Add lazy compilation option.
Unify execution engine creation through engine-builder internally.
This commit is contained in:
parent
91a10e6a8e
commit
bdac4a809d
4 changed files with 55 additions and 38 deletions
14
llvm/ee.py
14
llvm/ee.py
|
|
@ -205,12 +205,10 @@ class ExecutionEngine(object):
|
|||
|
||||
@staticmethod
|
||||
def new(module, force_interpreter=False):
|
||||
core.check_is_module(module)
|
||||
_util.check_is_unowned(module)
|
||||
ret = _core.LLVMCreateExecutionEngine(module.ptr, int(force_interpreter))
|
||||
if isinstance(ret, str):
|
||||
raise llvm.LLVMException(ret)
|
||||
return ExecutionEngine(ret, module)
|
||||
eb = EngineBuilder.new(module)
|
||||
if force_interpreter:
|
||||
eb.force_interpreter()
|
||||
return eb.create()
|
||||
|
||||
def __init__(self, ptr, module):
|
||||
self.ptr = ptr
|
||||
|
|
@ -219,6 +217,10 @@ class ExecutionEngine(object):
|
|||
def __del__(self):
|
||||
_core.LLVMDisposeExecutionEngine(self.ptr)
|
||||
|
||||
def disable_lazy_compilation(self, disabled=True):
|
||||
_core.LLVMExecutionEngineDisableLazyCompilation(self.ptr,
|
||||
int(bool(disabled)))
|
||||
|
||||
def run_function(self, fn, args):
|
||||
core.check_is_function(fn)
|
||||
ptrs = _unpack_generic_values(args)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue