def build_adi(function, types): t = Translation(function, types) t.rtype() if option.view: t.view() adi = AbstractDataFlowInterpreter(t.context) graph = graphof(t.context, function) adi.schedule_function(graph) adi.complete() return t.context, adi, graph
def find_malloc_removal_candidates(t, graphs): adi = AbstractDataFlowInterpreter(t) for graph in graphs: if graph.startblock not in adi.flown_blocks: adi.schedule_function(graph) adi.complete() malloc_graphs = malloc_like_graphs(adi) targetset = dict.fromkeys(graphs) caller_candidates = {} seen = {} for graph in adi.seen_graphs(): creps = find_malloc_creps(graph, adi, t, malloc_graphs) if creps: find_calls_where_creps_go(creps, graph, adi, t, seen) if creps: if graph in targetset: caller_candidates[graph] = True callgraph = [] for called_graph, callers in seen.iteritems(): for caller in callers: if caller in targetset and called_graph in targetset: callgraph.append((caller, called_graph)) else: log.inlineandremove.WARNING("would like to inline into" " out of target set: %r" % caller) return callgraph, caller_candidates
def build_adi(function, types): t = Translation(function, types) t.rtype() if option.view: t.view() adi = AbstractDataFlowInterpreter(t.context) graph = graphof(t.context, function) adi.schedule_function(graph) adi.complete() return t.context, adi, graph