示例#1
0
 def remove_mallocs_once(self, graph):
     """Perform one iteration of malloc removal."""
     simplify.remove_identical_vars(graph)
     lifetimes = self.compute_lifetimes(graph)
     progress = 0
     for info in lifetimes:
         progress += self._try_inline_malloc(info)
     return progress
示例#2
0
 def remove_mallocs_once(self, graph):
     """Perform one iteration of malloc removal."""
     simplify.remove_identical_vars(graph)
     lifetimes = self.compute_lifetimes(graph)
     progress = 0
     for info in lifetimes:
         progress += self._try_inline_malloc(info)
     return progress
示例#3
0
def remove_tail_calls_to_self(translator, graph):
    entrymap = mkentrymap(graph)
    changed = False
    for link in entrymap[graph.returnblock]:
        block = link.prevblock
        if (len(block.exits) == 1 and len(block.operations) > 0
                and block.operations[-1].opname == 'direct_call'
                and block.operations[-1].result == link.args[0]):
            call = get_graph(block.operations[-1].args[0], translator)
            print "getgraph", graph
            if graph is graph:
                _remove_tail_call(translator, graph, block)
                changed = True
    if changed:
        from pypy.translator import simplify
        checkgraph(graph)
        simplify.remove_identical_vars(graph)
        simplify.eliminate_empty_blocks(graph)
        simplify.join_blocks(graph)
示例#4
0
def remove_tail_calls_to_self(translator, graph):
    entrymap = mkentrymap(graph)
    changed = False
    for link in entrymap[graph.returnblock]:
        block = link.prevblock
        if (len(block.exits) == 1 and
            len(block.operations) > 0 and
            block.operations[-1].opname == 'direct_call' and
            block.operations[-1].result == link.args[0]):
            call = get_graph(block.operations[-1].args[0], translator)
            print "getgraph", graph
            if graph is graph:
                _remove_tail_call(translator, graph, block)
                changed = True
    if changed:
        from pypy.translator import simplify
        checkgraph(graph)
        simplify.remove_identical_vars(graph)
        simplify.eliminate_empty_blocks(graph)
        simplify.join_blocks(graph)