[pypy-svn] r10257 - pypy/dist/pypy/translator
cfbolz at codespeak.net
cfbolz at codespeak.net
Sat Apr 2 19:43:52 CEST 2005
Author: cfbolz
Date: Sat Apr 2 19:43:52 2005
New Revision: 10257
Modified:
pypy/dist/pypy/translator/unsimplify.py
Log:
Added a flowgraph transformation needed by genllvm.
Modified: pypy/dist/pypy/translator/unsimplify.py
==============================================================================
--- pypy/dist/pypy/translator/unsimplify.py (original)
+++ pypy/dist/pypy/translator/unsimplify.py Sat Apr 2 19:43:52 2005
@@ -34,3 +34,16 @@
if isinstance(link, Link) and link.prevblock is link.target:
insert_empty_block(translator, link)
traverse(visit, graph)
+
+
+def remove_double_links(translator, graph):
+ """This can be useful for code generators: it ensures that no block has
+ more than one incoming links from one and the same other block. It allows
+ argument passing along links to be implemented with phi nodes since the
+ value of an argument can be determined by looking from which block the
+ control passed. """
+ def visit(block):
+ if isinstance(block, Block) and len(block.exits) == 2 and \
+ block.exits[0].target == block.exits[1].target:
+ insert_empty_block(translator, block.exits[0])
+ traverse(visit, graph)
More information about the pypy-svn
mailing list