예제 #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
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
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
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)