コード例 #1
0
def allocate_registers(graph):
    interesting_vars = find_interesting_variables(graph)
    if not interesting_vars:
        return None
    regalloc = perform_register_allocation(graph, interesting_vars.__contains__)
    assert regalloc.graph is graph
    regalloc.find_num_colors()
    return regalloc
コード例 #2
0
ファイル: test_regalloc.py プロジェクト: mozillazg/pypy
def test_loop_1():
    def f(a, b):
        while a > 0:
            b += a
            a -= 1
        return b
    t, rtyper, graph = gengraph(f, [int, int], viewbefore=False)
    regalloc = perform_register_allocation(graph, is_int)
    num_renamings = check_valid(graph, regalloc, is_int)
    assert num_renamings == 0
コード例 #3
0
ファイル: test_regalloc.py プロジェクト: sbw111/lab4
def test_loop_1():
    def f(a, b):
        while a > 0:
            b += a
            a -= 1
        return b

    t, rtyper, graph = gengraph(f, [int, int], viewbefore=False)
    regalloc = perform_register_allocation(graph, is_int)
    num_renamings = check_valid(graph, regalloc, is_int)
    assert num_renamings == 0
コード例 #4
0
ファイル: test_regalloc.py プロジェクト: mozillazg/pypy
def test_loop_2():
    def f(a, b):
        while a > 0:
            b += a
            if b < 10:
                a, b = b, a
            a -= 1
        return b
    t, rtyper, graph = gengraph(f, [int, int], viewbefore=False)
    regalloc = perform_register_allocation(graph, is_int)
    check_valid(graph, regalloc, is_int)
コード例 #5
0
ファイル: regalloc.py プロジェクト: sota/pypy-old
def perform_register_allocation(graph, kind):
    checkkind = lambda v: getkind(v.concretetype) == kind
    return regalloc.perform_register_allocation(graph, checkkind, ListOfKind)