示例#1
0
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)
示例#2
0
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)
示例#3
0
def ssa_pass(ast, env):
    functions = cfg.ssa_pass(ast)

    env['functions'] = functions

    return ast, env
示例#4
0
def ssa_pass(ast, env):
    functions = cfg.ssa_pass(ast)

    env["functions"] = functions

    return ast, env