[pypy-svn] r24897 - in pypy/branch/explicit-exceptions/translator: . backendopt c

pedronis at codespeak.net pedronis at codespeak.net
Thu Mar 23 18:36:45 CET 2006


Author: pedronis
Date: Thu Mar 23 18:36:44 2006
New Revision: 24897

Modified:
   pypy/branch/explicit-exceptions/translator/backendopt/inline.py
   pypy/branch/explicit-exceptions/translator/c/exceptiontransform.py
   pypy/branch/explicit-exceptions/translator/simplify.py
Log:
cleanup graph on which inlining has been performed as appropriate. Add cleanup_graph 
helper in simplify.py .



Modified: pypy/branch/explicit-exceptions/translator/backendopt/inline.py
==============================================================================
--- pypy/branch/explicit-exceptions/translator/backendopt/inline.py	(original)
+++ pypy/branch/explicit-exceptions/translator/backendopt/inline.py	Thu Mar 23 18:36:44 2006
@@ -1,6 +1,6 @@
 import sys
-from pypy.translator.simplify import eliminate_empty_blocks, join_blocks
-from pypy.translator.simplify import remove_identical_vars, get_graph
+from pypy.translator.simplify import join_blocks, cleanup_graph
+from pypy.translator.simplify import get_graph
 from pypy.translator.unsimplify import copyvar, split_block
 from pypy.translator.backendopt import canraise
 from pypy.objspace.flow.model import Variable, Constant, Block, Link
@@ -393,10 +393,8 @@
         """ cleaning up -- makes sense to be done after inlining, because the
         inliner inserted quite some empty blocks and blocks that can be
         joined. """
-        checkgraph(self.graph)
-        eliminate_empty_blocks(self.graph)
-        join_blocks(self.graph)
-        remove_identical_vars(self.graph)
+        cleanup_graph(self.graph)
+
 
 class Inliner(BaseInliner):
     def __init__(self, translator, graph, inline_func, inline_guarded_calls=False,

Modified: pypy/branch/explicit-exceptions/translator/c/exceptiontransform.py
==============================================================================
--- pypy/branch/explicit-exceptions/translator/c/exceptiontransform.py	(original)
+++ pypy/branch/explicit-exceptions/translator/c/exceptiontransform.py	Thu Mar 23 18:36:44 2006
@@ -1,4 +1,4 @@
-from pypy.translator.simplify import join_blocks
+from pypy.translator.simplify import join_blocks, cleanup_graph
 from pypy.translator.unsimplify import copyvar, split_block
 from pypy.translator.backendopt import canraise, inline
 from pypy.objspace.flow.model import Block, Constant, Variable, Link, \
@@ -95,7 +95,7 @@
         for block in list(graph.iterblocks()): #collect the blocks before changing them
             self.transform_block(graph, block)
         self.transform_except_block(graph, graph.exceptblock)
-        checkgraph(graph)
+        cleanup_graph(graph)
 
     def transform_block(self, graph, block):
         if block is graph.exceptblock:

Modified: pypy/branch/explicit-exceptions/translator/simplify.py
==============================================================================
--- pypy/branch/explicit-exceptions/translator/simplify.py	(original)
+++ pypy/branch/explicit-exceptions/translator/simplify.py	Thu Mar 23 18:36:44 2006
@@ -720,3 +720,10 @@
         pass_(graph)
     checkgraph(graph)
 
+def cleanup_graph(graph):
+    checkgraph(graph)
+    eliminate_empty_blocks(graph)
+    join_blocks(graph)
+    remove_identical_vars(graph)
+    checkgraph(graph)    
+    



More information about the Pypy-commit mailing list