[pypy-svn] rev 2144 - pypy/trunk/src/pypy/translator
sanxiyn at codespeak.net
sanxiyn at codespeak.net
Fri Oct 31 18:08:10 CET 2003
Author: sanxiyn
Date: Fri Oct 31 18:08:09 2003
New Revision: 2144
Modified:
pypy/trunk/src/pypy/translator/simplify.py
pypy/trunk/src/pypy/translator/transform.py
Log:
Documentation enhancements.
Modified: pypy/trunk/src/pypy/translator/simplify.py
==============================================================================
--- pypy/trunk/src/pypy/translator/simplify.py (original)
+++ pypy/trunk/src/pypy/translator/simplify.py Fri Oct 31 18:08:09 2003
@@ -1,13 +1,8 @@
+"""Flow Graph Simplification
"""
-generate Pyrex files from the flowmodel.
-"""
from pypy.objspace.flow.model import *
-# debug
-from pypy.translator.genpyrex import GenPyrex
-
-
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
@@ -66,7 +61,7 @@
traverse(visit, graph)
def simplify_graph(graph):
- """apply all the existing optimisations to the graph"""
+ """Apply all the existing optimisations to the graph."""
eliminate_empty_blocks(graph)
join_blocks(graph)
return graph
Modified: pypy/trunk/src/pypy/translator/transform.py
==============================================================================
--- pypy/trunk/src/pypy/translator/transform.py (original)
+++ pypy/trunk/src/pypy/translator/transform.py Fri Oct 31 18:08:09 2003
@@ -1,4 +1,7 @@
-"""Peephole Flow Graph Transformation
+"""Flow Graph Transformation
+
+The difference between simplification and transformation is that
+transformation may introduce new space operation.
"""
import autopath
@@ -10,6 +13,7 @@
# --> d = alloc_and_set(c, a)
def transform_allocate(self):
+ """Transforms [a] * b to alloc_and_set(b, a) where b is int."""
for block, ann in self.annotated.iteritems():
operations = block.operations[:]
n_op = len(operations)
@@ -31,6 +35,7 @@
# --> e = getslice(d, a, b)
def transform_slice(self):
+ """Transforms a[b:c] to getslice(a, b, c)."""
for block, ann in self.annotated.iteritems():
operations = block.operations[:]
n_op = len(operations)
@@ -47,5 +52,6 @@
block.operations[i:i+2] = [new_op]
def transform_graph(ann):
+ """Apply set of transformations available."""
transform_allocate(ann)
transform_slice(ann)
More information about the Pypy-commit
mailing list