def pykitcompile(source, funcname=None, cfanalyze=True): m = from_c(source) verify(m) if cfanalyze: for function in m.functions.values(): cfa.run(function) verify(function) verify(m) if len(m.functions) == 1: funcname, = m.functions if funcname: f = m.get_function(funcname) b = Builder(f) entry = f.startblock else: f, b, entry = None, None, None env = environment.fresh_env() return State(m, f, b, entry, env)
'flypy.typing.constraints': None, # Output # Flags 'flypy.verify': True, 'flypy.optimize': True, 'flypy.target': 'cpu', # Codegen "codegen.llvm.opt": None, "codegen.llvm.engine": None, "codegen.llvm.module": None, "codegen.llvm.machine": None, "codegen.llvm.ctypes": None, } _cpu_env.update(pykit_env.fresh_env()) llvm_codegen.install(_cpu_env) cpu_env = FrozenDict(_cpu_env) #===------------------------------------------------------------------=== # Data Parallel Python Environment #===------------------------------------------------------------------=== _dpp_env = dict(cpu_env) _dpp_env.update({ 'flypy.typing.cache': TypingCache(), 'flypy.inference.cache': InferenceCache(), 'flypy.opt.cache': Cache(), 'flypy.prelowering.cache': Cache(), 'flypy.lowering.cache': Cache(),
'flypy.typing.constraints': None, # Output # Flags 'flypy.verify': True, 'flypy.optimize': True, 'flypy.target': 'cpu', # Codegen "codegen.llvm.opt": None, "codegen.llvm.engine": None, "codegen.llvm.module": None, "codegen.llvm.machine": None, "codegen.llvm.ctypes": None, } _cpu_env.update(pykit_env.fresh_env()) llvm_codegen.install(_cpu_env) cpu_env = FrozenDict(_cpu_env) #===------------------------------------------------------------------=== # Data Parallel Python Environment #===------------------------------------------------------------------=== _dpp_env = dict(cpu_env) _dpp_env .update({ 'flypy.typing.cache': TypingCache(), 'flypy.inference.cache': InferenceCache(), 'flypy.opt.cache': Cache(), 'flypy.prelowering.cache': Cache(), 'flypy.lowering.cache': Cache(),
def test_normalize(self): mod = from_c(testfunc) func = mod.get_function("func") ret.run(func, fresh_env()) ops = opcodes(func) self.assertEqual(ops.count("ret"), 1, ops)