Example #1
0
def get_loop_addrs(split):
    split = addr_to_loop_id(split)
    f = functions[trace_refute.get_body_addrs_fun(split)]
    return [
        addr for addr in f.nodes if trace_refute.is_addr(addr)
        if addr_to_loop_id_cache.get(addr) == split
    ]
Example #2
0
def add_fun_to_loop_data_cache(fname):
    p = functions[fname].as_problem(problem.Problem)
    p.do_loop_analysis()
    for h in p.loop_heads():
        addrs = [n for n in p.loop_body(h) if trace_refute.is_addr(n)]
        min_addr = min(addrs)
        for addr in addrs:
            addr_to_loop_id_cache[addr] = min_addr
        complex_loop_id_cache[min_addr] = problem.has_inner_loop(p, h)
    return min_addr
Example #3
0
def add_fun_to_loop_data_cache(fname):
    p = functions[fname].as_problem(problem.Problem)
    p.do_loop_analysis()
    for h in p.loop_heads():
        addrs = [n for n in p.loop_body(h) if trace_refute.is_addr(n)]
        min_addr = min(addrs)
        for addr in addrs:
            addr_to_loop_id_cache[addr] = min_addr
        complex_loop_id_cache[min_addr] = problem.has_inner_loop(p, h)
    return min_addr
Example #4
0
def get_loop_heads(fun):
    if not fun.entry:
        return []
    p = fun.as_problem(problem.Problem)
    p.do_loop_analysis()
    loops = set()
    for h in p.loop_heads():
        # any address in the loop will do. pick the smallest one
        addr = min([n for n in p.loop_body(h) if trace_refute.is_addr(n)])
        loops.add((addr, fun.name, problem.has_inner_loop(p, h)))
    return list(loops)
Example #5
0
def get_loop_heads(fun):
    if not fun.entry:
        return []
    p = fun.as_problem(problem.Problem)
    p.do_loop_analysis()
    loops = set()
    for h in p.loop_heads():
        # any address in the loop will do. pick the smallest one
        addr = min([n for n in p.loop_body(h) if trace_refute.is_addr(n)])
        loops.add((addr, fun.name, problem.has_inner_loop(p, h)))
    return list(loops)
Example #6
0
def get_bound_super_ctxt (split, call_ctxt, no_splitting=False,
        known_bound_only=False):
    if not known_bounds:
      load_bounds ()
    for (ctxt2, fn_hash, bound) in known_bounds.get ((split, 'Global'), []):
      if ctxt2 == call_ctxt and fn_hash == get_functions_hash ():
        return bound
    f = trace_refute.get_body_addrs_fun (split)
    p = functions[f].as_problem (problem.Problem)
    p.do_loop_analysis ()
    min_addr = min ([n for n in p.loop_body (split)
      if trace_refute.is_addr (n)])
    if min_addr != split:
      return get_bound_super_ctxt (min_addr, call_ctxt,
            no_splitting = no_splitting, known_bound_only = known_bound_only)

    if known_bound_only:
        return None
    no_splitting_abort = [False]
    try:
      bound = get_bound_super_ctxt_inner (split, call_ctxt,
        no_splitting = (no_splitting, no_splitting_abort))
    except problem.Abort, e:
      bound = None
Example #7
0
def get_loop_addrs(split):
    split = addr_to_loop_id(split)
    f = functions[trace_refute.get_body_addrs_fun(split)]
    return [addr for addr in f.nodes if trace_refute.is_addr(addr) if addr_to_loop_id_cache.get(addr) == split]
Example #8
0
def addr_of_node(preds, n):
    while not trace_refute.is_addr(n):
        [n] = preds[n]
    return n
Example #9
0
def addr_of_node(preds, n):
    while not trace_refute.is_addr(n):
        [n] = preds[n]
    return n