Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 9165031fd589
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bfe980d45805
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Dec 6, 2014

  1. test/py2llvm: pep8

    sbourdeauducq committed Dec 6, 2014
    Copy the full SHA
    b830dd5 View commit details
  2. Copy the full SHA
    bfe980d View commit details
Showing with 13 additions and 13 deletions.
  1. +1 −1 artiq/coredevice/runtime.py
  2. +3 −3 artiq/py2llvm/module.py
  3. +9 −9 test/py2llvm.py
2 changes: 1 addition & 1 deletion artiq/coredevice/runtime.py
Original file line number Diff line number Diff line change
@@ -149,7 +149,7 @@ def __init__(self, internal_ref_period):

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

6 changes: 3 additions & 3 deletions artiq/py2llvm/module.py
Original file line number Diff line number Diff line change
@@ -14,17 +14,17 @@ def __init__(self, env=None):
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

18 changes: 9 additions & 9 deletions test/py2llvm.py
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@ def __init__(self, function, param_types):

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)
@@ -192,24 +192,24 @@ def frac_arith_encode_int_rev(op, a, b, x):

def frac_arith_float(op, a, b, x):
if op == 0:
return Fraction(a, b) - x
return Fraction(a, b) - x
elif op == 1:
return Fraction(a, b) + x
return Fraction(a, b) + x
elif op == 2:
return Fraction(a, b) * x
return Fraction(a, b) * x
else:
return Fraction(a, b) / x
return Fraction(a, b) / x


def frac_arith_float_rev(op, a, b, x):
if op == 0:
return x - Fraction(a, b)
return x - Fraction(a, b)
elif op == 1:
return x + Fraction(a, b)
return x + Fraction(a, b)
elif op == 2:
return x * Fraction(a, b)
return x * Fraction(a, b)
else:
return x / Fraction(a, b)
return x / Fraction(a, b)


def array_test():