[pypy-svn] r9527 - pypy/dist/pypy/translator

arigo at codespeak.net arigo at codespeak.net
Mon Feb 28 17:33:53 CET 2005


Author: arigo
Date: Mon Feb 28 17:33:53 2005
New Revision: 9527

Modified:
   pypy/dist/pypy/translator/simplify.py
   pypy/dist/pypy/translator/transform.py
Log:
Fixed comments; move the entry point function at the top of the module.


Modified: pypy/dist/pypy/translator/simplify.py
==============================================================================
--- pypy/dist/pypy/translator/simplify.py	(original)
+++ pypy/dist/pypy/translator/simplify.py	Mon Feb 28 17:33:53 2005
@@ -1,8 +1,25 @@
 """Flow Graph Simplification
+
+'Syntactic-ish' simplifications on a flow graph.
+
+simplify_graph() applies all simplifications defined in this file.
+See also remove_direct_loops(), which is a 'de-simplification' useful
+for code generators.
 """
 
 from pypy.objspace.flow.model import *
 
+def simplify_graph(graph):
+    """inplace-apply all the existing optimisations to the graph."""
+    checkgraph(graph)
+    eliminate_empty_blocks(graph)
+    remove_implicit_exceptions(graph)
+    join_blocks(graph)
+    transform_dead_op_vars(graph)
+    checkgraph(graph)
+
+# ____________________________________________________________
+
 def eliminate_empty_blocks(graph):
     """Eliminate basic blocks that do not contain any operations.
     When this happens, we need to replace the preceeding link with the
@@ -85,15 +102,6 @@
                     link.prevblock.exitswitch = None
     traverse(visit, graph)
 
-def simplify_graph(graph):
-    """inplace-apply all the existing optimisations to the graph."""
-    checkgraph(graph)
-    eliminate_empty_blocks(graph)
-    remove_implicit_exceptions(graph)
-    join_blocks(graph)
-    transform_dead_op_vars(graph)
-    checkgraph(graph)
-
 def remove_direct_loops(graph):
     """This is useful for code generators: it ensures that no link has
     common input and output variables, which could occur if a block's exit

Modified: pypy/dist/pypy/translator/transform.py
==============================================================================
--- pypy/dist/pypy/translator/transform.py	(original)
+++ pypy/dist/pypy/translator/transform.py	Mon Feb 28 17:33:53 2005
@@ -1,7 +1,8 @@
 """Flow Graph Transformation
 
 The difference between simplification and transformation is that
-transformation may introduce new space operation.
+transformation is based on annotations; it runs after the annotator
+completed.
 """
 
 import types



More information about the Pypy-commit mailing list