def ddump_optimizer(source): import parser import cfg import typecheck import codegen with errors.listen(): parse = parser.make_parser() ast = parse(source) typecheck.typecheck(ast) functions = cfg.ssa_pass(ast) cgen = codegen.LLVMEmitter() blockgen = codegen.BlockEmitter(cgen) for name, retty, argtys, start_block in functions: function = blockgen.generate_function( name, retty, argtys, start_block ) optimizer = codegen.LLVMOptimizer(cgen.module) print 'Optimizer Diff'.center(80, '=') optimizer.diff(function, cgen.module)
def ddump_optimizer(source): import parser import cfg import typecheck import codegen with errors.listen(): parse = parser.make_parser() ast = parse(source) typecheck.typecheck(ast) functions = cfg.ssa_pass(ast) cgen = codegen.LLVMEmitter() blockgen = codegen.BlockEmitter(cgen) for name, retty, argtys, start_block in functions: function = blockgen.generate_function(name, retty, argtys, start_block) optimizer = codegen.LLVMOptimizer(cgen.module) print 'Optimizer Diff'.center(80, '=') optimizer.diff(function, cgen.module)
def ssa_pass(ast, env): functions = cfg.ssa_pass(ast) env['functions'] = functions return ast, env
def ssa_pass(ast, env): functions = cfg.ssa_pass(ast) env["functions"] = functions return ast, env