Esempio n. 1
0
def translate(func, env, _):
    emit = lambda s, *args: sys.stdout.write(format(s, *args) + "\n")

    # -- Create visitor -- #
    translator = Translator(func, env, emit)
    visitor = opgrouper(translator)

    # -- Codegen -- #
    argloader = CArgLoader()
    valuemap = vvisit(visitor, func, argloader)
Esempio n. 2
0
def translate(func, env, _):
    emit = lambda s, *args: sys.stdout.write(format(s, *args) + "\n")

    # -- Create visitor -- #
    translator = Translator(func, env, emit)
    visitor = opgrouper(translator)

    # -- Codegen -- #
    argloader = CArgLoader()
    valuemap = vvisit(visitor, func, argloader)
Esempio n. 3
0
def translate(func, env, lfunc):
    engine, llvm_module = env["codegen.llvm.engine"], env["codegen.llvm.module"]
    blockmap = allocate_blocks(lfunc, func)

    ### Create visitor ###
    translator = Translator(func, env, lfunc, llvm_type, llvm_module)
    visitor = opgrouper(translator)

    ### Codegen ###
    argloader = LLVMArgLoader(None, engine, llvm_module, lfunc, blockmap)
    valuemap = vvisit(visitor, func, argloader)
    update_phis(translator.phis, valuemap, argloader)

    return lfunc
Esempio n. 4
0
def translate(func, env, lfunc):
    engine, llvm_module = env["codegen.llvm.engine"], env["codegen.llvm.module"]
    blockmap = allocate_blocks(lfunc, func)

    ### Create visitor ###
    translator = Translator(func, env, lfunc, llvm_type, llvm_module)
    visitor = opgrouper(translator)

    ### Codegen ###
    argloader = LLVMArgLoader(None, engine, llvm_module, lfunc, blockmap)
    valuemap = vvisit(visitor, func, argloader)
    update_phis(translator.phis, valuemap, argloader)

    return lfunc
Esempio n. 5
0
def translate(func, engine, llvm_module):
    verify_lowlevel(func)

    ### Create lfunc ###
    lfunc = llvm_module.add_function(llvm_type(func.type), func.name)
    blockmap = allocate_blocks(lfunc, func)

    ### Create visitor ###
    translator = Translator(func, lfunc, llvm_type, llvm_module)
    visitor = opgrouper(translator)

    ### Codegen ###
    argloader = LLVMArgLoader(None, engine, llvm_module, lfunc, blockmap)
    valuemap = vvisit(visitor, func, argloader)
    update_phis(translator.phis, valuemap, argloader)

    return lfunc