def compute_reachability(graph): reachable = {} blocks = list(graph.iterblocks()) for block in py.builtin.reversed(blocks): # this order should make the reuse path more likely reach = {} scheduled = [block] while scheduled: current = scheduled.pop() for link in current.exits: if link.target in reachable: reach[link.target] = True reach = setunion(reach, reachable[link.target]) continue if link.target not in reach: reach[link.target] = True scheduled.append(link.target) reachable[block] = reach return reachable
def compute_reachability(graph): reachable = {} blocks = list(graph.iterblocks()) for block in py.builtin.reversed( blocks): # this order should make the reuse path more likely reach = {} scheduled = [block] while scheduled: current = scheduled.pop() for link in current.exits: if link.target in reachable: reach[link.target] = True reach = setunion(reach, reachable[link.target]) continue if link.target not in reach: reach[link.target] = True scheduled.append(link.target) reachable[block] = reach return reachable
def merge(self, other): creation_points = setunion(self.creation_points, other.creation_points) newstate = VarState() newstate.creation_points = creation_points return newstate