def translate_stage(bytecode): interp = interpreter.Interpreter(bytecode=bytecode) if config.DUMP_CFG: interp.cfa.dump() interp.interpret() if config.DEBUG or config.DUMP_IR: print(("IR DUMP: %s" % interp.bytecode.func_qualname).center(80, "-")) interp.dump() if interp.generator_info: print( ("GENERATOR INFO: %s" % interp.bytecode.func_qualname).center( 80, "-")) interp.dump_generator_info() expanded = macro.expand_macros(interp.blocks) if config.DUMP_IR and expanded: print(("MACRO-EXPANDED IR DUMP: %s" % interp.bytecode.func_qualname).center(80, "-")) interp.dump() return interp
def interpret(func): bc = bytecode.ByteCode(func=func) bc.dump() interp = interpreter.Interpreter(bytecode=bc) interp.interpret() interp.dump(utils.StringIO()) return interp
def translate_stage(bytecode): interp = interpreter.Interpreter(bytecode=bytecode) interp.interpret() if config.DEBUG: interp.dump() for syn in interp.syntax_info: print(syn) interp.verify() return interp
def run_frontend(func): """ Run the compiler frontend over the given Python function, and return the function's canonical Numba IR. """ # XXX make this a dedicated Pipeline? func_id = bytecode.FunctionIdentity.from_function(func) interp = interpreter.Interpreter(func_id) bc = bytecode.ByteCode(func_id=func_id) func_ir = interp.interpret(bc) post_proc = postproc.PostProcessor(func_ir) post_proc.run() return func_ir
def interpret(func): bc = bytecode.ByteCode(func=func) print(bc.dump()) interp = interpreter.Interpreter(bytecode=bc) interp.interpret() interp.dump() for syn in interp.syntax_info: print(syn) interp.verify() return interp
def translate_stage(bytecode): interp = interpreter.Interpreter(bytecode=bytecode) if config.DUMP_CFG: interp.cfa.dump() interp.interpret() if config.DEBUG or config.DUMP_IR: print(("IR DUMP: %s" % interp.bytecode.func_qualname).center(80, "-")) interp.dump() if interp.generator_info: print(("GENERATOR INFO: %s" % interp.bytecode.func_qualname).center(80, "-")) interp.dump_generator_info() return interp
def translate_stage(bytecode): interp = interpreter.Interpreter(bytecode=bytecode) if config.DUMP_CFG: interp.cfa.dump() interp.interpret() if config.DEBUG: interp.dump() macro.expand_macros(interp.blocks) if config.DUMP_IR: interp.dump() return interp
def run_frontend(func, inline_closures=False): """ Run the compiler frontend over the given Python function, and return the function's canonical Numba IR. If inline_closures is Truthy then closure inlining will be run """ # XXX make this a dedicated Pipeline? func_id = bytecode.FunctionIdentity.from_function(func) interp = interpreter.Interpreter(func_id) bc = bytecode.ByteCode(func_id=func_id) func_ir = interp.interpret(bc) if inline_closures: inline_pass = InlineClosureCallPass(func_ir, cpu.ParallelOptions(False), {}, False) inline_pass.run() post_proc = postproc.PostProcessor(func_ir) post_proc.run() return func_ir
def translate_stage(func_id, bytecode): interp = interpreter.Interpreter(func_id) return interp.interpret(bytecode)
def get_ir(self, pyfunc): bc = bytecode.ByteCode(func=pyfunc) interp = interpreter.Interpreter(bc) interp.interpret() return interp