forked from M-Labs/artiq
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):
|
||||
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)
|
||||
return obj
|
||||
|
||||
|
|
|
@ -14,17 +14,17 @@ class Module:
|
|||
fractions.init_module(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.opt_level = 2
|
||||
pm = llvm.create_module_pass_manager()
|
||||
pmb.populate(pm)
|
||||
pm.run(self.llvm_module)
|
||||
pm.run(self.llvm_module_ref)
|
||||
|
||||
def get_ee(self):
|
||||
self.finalize()
|
||||
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()
|
||||
return ee
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ class CompiledFunction:
|
|||
|
||||
ee = module.get_ee()
|
||||
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)
|
||||
argval_ctypes = [_value_to_ctype(argval) for argval in argvals]
|
||||
self.cfunc = CFUNCTYPE(retval_ctype, *argval_ctypes)(cfptr)
|
||||
|
|
Loading…
Reference in New Issue