Example #1
0
def transform_dead_op_vars(self, block_subset):
    # we redo the same simplification from simplify.py,
    # to kill dead (never-followed) links,
    # which can possibly remove more variables.
    from pypy.translator.simplify import transform_dead_op_vars_in_blocks

    transform_dead_op_vars_in_blocks(block_subset)
Example #2
0
 def check(self, fn, signature, args, expected_result, must_be_removed=True,
           inline=None):
     remover = self.MallocRemover()
     t = TranslationContext()
     t.buildannotator().build_types(fn, signature)
     t.buildrtyper(type_system=self.type_system).specialize()
     graph = graphof(t, fn)
     if inline is not None:
         from pypy.translator.backendopt.inline import auto_inline_graphs
         auto_inline_graphs(t, t.graphs, inline)
     if option.view:
         t.view()
     # to detect missing keepalives and broken intermediate graphs,
     # we do the loop ourselves instead of calling remove_simple_mallocs()
     while True:
         progress = remover.remove_mallocs_once(graph)
         simplify.transform_dead_op_vars_in_blocks(list(graph.iterblocks()))
         if progress and option.view:
             t.view()
         if expected_result is not Ellipsis:
             interp = LLInterpreter(t.rtyper)
             res = interp.eval_graph(graph, args)
             assert res == expected_result
         if not progress:
             break
     if must_be_removed:
         self.check_malloc_removed(graph)
     return graph
Example #3
0
 def check(self,
           fn,
           signature,
           args,
           expected_result,
           must_be_removed=True):
     remover = self.MallocRemover()
     t = TranslationContext()
     t.buildannotator().build_types(fn, signature)
     t.buildrtyper(type_system=self.type_system).specialize()
     graph = graphof(t, fn)
     if option.view:
         t.view()
     # to detect missing keepalives and broken intermediate graphs,
     # we do the loop ourselves instead of calling remove_simple_mallocs()
     while True:
         progress = remover.remove_mallocs_once(graph)
         simplify.transform_dead_op_vars_in_blocks(list(graph.iterblocks()))
         if progress and option.view:
             t.view()
         if expected_result is not Ellipsis:
             interp = LLInterpreter(t.rtyper)
             res = interp.eval_graph(graph, args)
             assert res == expected_result
         if not progress:
             break
     if must_be_removed:
         self.check_malloc_removed(graph)
     return graph
Example #4
0
def transform_dead_op_vars(self, block_subset):
    # we redo the same simplification from simplify.py,
    # to kill dead (never-followed) links,
    # which can possibly remove more variables.
    from pypy.translator.simplify import transform_dead_op_vars_in_blocks
    transform_dead_op_vars_in_blocks(block_subset, self.translator.graphs)