(graph, start_node, end_node, doms, df)
return True
:param graph:
        :param start_node:
        :param end_node:
        :param doms:
        :param df:
        :return:
def _check_region(graph, start_node, end_node, doms, df):
        """

        :param graph:
        :param start_node:
        :param end_node:
        :param doms:
        :param df:
        :return:
        """

        # if the exit node is the header of a loop that contains the start node, the dominance frontier should only
        # contain the exit node.
        if not dominates(doms, start_node, end_node):
            frontier = df.get(start_node, set())
            for node in frontier:
                if node is not start_node and node is not end_node:
                    return False

        # no edges should enter the region.
        for node in df.get(end_node, set()):
            if dominates(doms, start_node, node) and node is not end_node:
                return False

        # no edges should leave the region.
        for node in df.get(start_node, set()):
            if node is start_node or node is end_node:
                continue
            if node not in df.get(end_node, set()):
                return False
            for pred in graph.predecessors(node):
                if dominates(doms, start_node, pred) and not dominates(doms, end_node, pred):
                    return False

        return True
def _check_region ( graph , start_node , end_node , doms , df ) : # if the exit node is the header of a loop that contains the start node, the dominance frontier should only # contain the exit node. if not dominates ( doms , start_node , end_node ) : frontier = df . get ( start_node , set ( ) ) for node in frontier : if node is not start_node and node is not end_node : return False # no edges should enter the region. for node in df . get ( end_node , set ( ) ) : if dominates ( doms , start_node , node ) and node is not end_node : return False # no edges should leave the region. for node in df . get ( start_node , set ( ) ) : if node is start_node or node is end_node : continue if node not in df . get ( end_node , set ( ) ) : return False for pred in graph . predecessors ( node ) : if dominates ( doms , start_node , pred ) and not dominates ( doms , end_node , pred ) : return False return True