From bfe980d45805a035afa6535c3b4e425e7f90b43b Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 6 Dec 2014 15:14:39 +0800 Subject: [PATCH] py2llvm: distinguish between llvmlite Module and ModuleRef --- artiq/coredevice/runtime.py | 2 +- artiq/py2llvm/module.py | 6 +++--- test/py2llvm.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/artiq/coredevice/runtime.py b/artiq/coredevice/runtime.py index 317dc9d02..746892b96 100644 --- a/artiq/coredevice/runtime.py +++ b/artiq/coredevice/runtime.py @@ -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 diff --git a/artiq/py2llvm/module.py b/artiq/py2llvm/module.py index 2ef443a63..535b1ab51 100644 --- a/artiq/py2llvm/module.py +++ b/artiq/py2llvm/module.py @@ -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 diff --git a/test/py2llvm.py b/test/py2llvm.py index 12bd42c90..7f756dc00 100644 --- a/test/py2llvm.py +++ b/test/py2llvm.py @@ -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)