mirror of https://github.com/m-labs/artiq.git
py2llvm: distinguish between llvmlite Module and ModuleRef
This commit is contained in:
parent
b830dd527c
commit
bfe980d458
|
@ -149,7 +149,7 @@ class Environment(LinkInterface):
|
||||||
|
|
||||||
def emit_object(self):
|
def emit_object(self):
|
||||||
tm = llvm.Target.from_triple(self.cpu_type).create_target_machine()
|
tm = llvm.Target.from_triple(self.cpu_type).create_target_machine()
|
||||||
obj = tm.emit_object(self.module.llvm_module)
|
obj = tm.emit_object(self.module.llvm_module_ref)
|
||||||
_debug_dump_obj(obj)
|
_debug_dump_obj(obj)
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
|
@ -14,17 +14,17 @@ class Module:
|
||||||
fractions.init_module(self)
|
fractions.init_module(self)
|
||||||
|
|
||||||
def finalize(self):
|
def finalize(self):
|
||||||
self.llvm_module = llvm.parse_assembly(str(self.llvm_module)) # FIXME
|
self.llvm_module_ref = llvm.parse_assembly(str(self.llvm_module))
|
||||||
pmb = llvm.create_pass_manager_builder()
|
pmb = llvm.create_pass_manager_builder()
|
||||||
pmb.opt_level = 2
|
pmb.opt_level = 2
|
||||||
pm = llvm.create_module_pass_manager()
|
pm = llvm.create_module_pass_manager()
|
||||||
pmb.populate(pm)
|
pmb.populate(pm)
|
||||||
pm.run(self.llvm_module)
|
pm.run(self.llvm_module_ref)
|
||||||
|
|
||||||
def get_ee(self):
|
def get_ee(self):
|
||||||
self.finalize()
|
self.finalize()
|
||||||
tm = llvm.Target.from_default_triple().create_target_machine()
|
tm = llvm.Target.from_default_triple().create_target_machine()
|
||||||
ee = llvm.create_mcjit_compiler(self.llvm_module, tm)
|
ee = llvm.create_mcjit_compiler(self.llvm_module_ref, tm)
|
||||||
ee.finalize_object()
|
ee.finalize_object()
|
||||||
return ee
|
return ee
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ class CompiledFunction:
|
||||||
|
|
||||||
ee = module.get_ee()
|
ee = module.get_ee()
|
||||||
cfptr = ee.get_pointer_to_global(
|
cfptr = ee.get_pointer_to_global(
|
||||||
module.llvm_module.get_function(function.name))
|
module.llvm_module_ref.get_function(function.name))
|
||||||
retval_ctype = _value_to_ctype(retval)
|
retval_ctype = _value_to_ctype(retval)
|
||||||
argval_ctypes = [_value_to_ctype(argval) for argval in argvals]
|
argval_ctypes = [_value_to_ctype(argval) for argval in argvals]
|
||||||
self.cfunc = CFUNCTYPE(retval_ctype, *argval_ctypes)(cfptr)
|
self.cfunc = CFUNCTYPE(retval_ctype, *argval_ctypes)(cfptr)
|
||||||
|
|
Loading…
Reference in New Issue