예제 #1
0
def getBinaryBoundFromC(p, c_tag, asm_split, restrs, hyps):
    c_heads = [
        h for h in search.init_loops_to_split(p, restrs)
        if p.node_tags[h][0] == c_tag
    ]
    c_bounds = [(p.loop_id(split), search_bound(p, (), hyps, split))
                for split in c_heads]
    if not [b for (n, b) in c_bounds if b]:
        trace('no C bounds found (%s).' % c_bounds)
        return None

    asm_tag = p.node_tags[asm_split][0]

    rep = rep_graph.mk_graph_slice(p)
    i_seq_opts = [(0, 1), (1, 1), (2, 1)]
    j_seq_opts = [(0, 1), (0, 2), (1, 1)]
    tags = [p.node_tags[asm_split][0], c_tag]
    try:
        split = search.find_split(rep,
                                  asm_split,
                                  restrs,
                                  hyps,
                                  i_seq_opts,
                                  j_seq_opts,
                                  5,
                                  tags=[asm_tag, c_tag])
    except solver.SolverFailure, e:
        return None
예제 #2
0
def test_interesting_linear_series_exprs():
    pairs = set([pair for f in pairings for pair in pairings[f]])
    notes = {}
    for pair in pairs:
        p = check.build_problem(pair)
        for n in search.init_loops_to_split(p, ()):
            intr = logic.interesting_linear_series_exprs(p, n, search.get_loop_var_analysis_at(p, n))
            if intr:
                notes[pair.name] = True
            if "Call" in str(intr):
                notes[pair.name] = "Call!"
    return notes
예제 #3
0
def test_interesting_linear_series_exprs():
    pairs = set([pair for f in pairings for pair in pairings[f]])
    notes = {}
    for pair in pairs:
        p = check.build_problem(pair)
        for n in search.init_loops_to_split(p, ()):
            intr = logic.interesting_linear_series_exprs(
                p, n, search.get_loop_var_analysis_at(p, n))
            if intr:
                notes[pair.name] = True
            if 'Call' in str(intr):
                notes[pair.name] = 'Call!'
    return notes
예제 #4
0
def getBinaryBoundFromC(p, c_tag, asm_split, restrs, hyps):
    c_heads = [h for h in search.init_loops_to_split(p, restrs) if p.node_tags[h][0] == c_tag]
    c_bounds = [(p.loop_id(split), search_bound(p, (), hyps, split)) for split in c_heads]
    if not [b for (n, b) in c_bounds if b]:
        trace("no C bounds found (%s)." % c_bounds)
        return None

    asm_tag = p.node_tags[asm_split][0]

    rep = rep_graph.mk_graph_slice(p)
    i_seq_opts = [(0, 1), (1, 1), (2, 1)]
    j_seq_opts = [(0, 1), (0, 2), (1, 1)]
    tags = [p.node_tags[asm_split][0], c_tag]
    try:
        split = search.find_split(rep, asm_split, restrs, hyps, i_seq_opts, j_seq_opts, 5, tags=[asm_tag, c_tag])
    except solver.SolverFailure, e:
        return None
예제 #5
0
def try_pairing_at_funcall(p,
                           name,
                           head=None,
                           restrs=None,
                           hyps=None,
                           at='At'):
    pairs = set(pairings[name])
    addrs = [
        n for (n, name2) in p.function_call_addrs()
        if [pair for pair in pairings[name2] if pair in pairs]
    ]
    assert at in ['At', 'After']
    if at == 'After':
        addrs = [p.nodes[n].cont for n in addrs]
    if head == None:
        tags = p.pairing.tags
        [head] = [
            n for n in search.init_loops_to_split(p, ())
            if p.node_tags[n][0] == tags[0]
        ]
    if restrs == None:
        restrs = ()
    if hyps == None:
        hyps = check.init_point_hyps(p)
    while True:
        res = search.find_split_loop(p,
                                     head,
                                     restrs,
                                     hyps,
                                     node_restrs=set(addrs))
        if res[0] == 'CaseSplit':
            (_, ((n, tag), _)) = res
            hyp = rep_graph.pc_true_hyp(((n, restrs), tag))
            hyps = hyps + [hyp]
        else:
            return res