[pypy-svn] r38916 - pypy/dist/pypy/doc/config

mwh at codespeak.net mwh at codespeak.net
Thu Feb 15 17:21:17 CET 2007


Author: mwh
Date: Thu Feb 15 17:21:15 2007
New Revision: 38916

Added:
   pypy/dist/pypy/doc/config/mergedblocks.png   (contents, props changed)
   pypy/dist/pypy/doc/config/unmergedblocks.png   (contents, props changed)
Modified:
   pypy/dist/pypy/doc/config/translation.backendopt.merge_if_blocks.txt
Log:
from the too-much-effort department: document merge_if_blocks, with pictures.


Added: pypy/dist/pypy/doc/config/mergedblocks.png
==============================================================================
Binary file. No diff available.

Modified: pypy/dist/pypy/doc/config/translation.backendopt.merge_if_blocks.txt
==============================================================================
--- pypy/dist/pypy/doc/config/translation.backendopt.merge_if_blocks.txt	(original)
+++ pypy/dist/pypy/doc/config/translation.backendopt.merge_if_blocks.txt	Thu Feb 15 17:21:15 2007
@@ -0,0 +1,26 @@
+This optimization converts parts of flow graphs that result from
+chains of ifs and elifs like this into merged blocks.
+
+By default flow graphing this kind of code::
+
+    if x == 0:
+        f()
+    elif x == 1:
+        g()
+    elif x == 4:
+        h()
+    else:
+        j()
+
+will result in a chain of blocks with two exits, somewhat like this:
+
+.. image:: unmergedblocks.png
+
+(reflecting how Python would interpret this code).  Running this
+optimization will transform the block structure to contain a single
+"choice block" with four exits:
+
+.. image:: mergedblocks.png
+
+This can then be turned into a switch by the C backend, allowing the C
+compiler to produce more efficient code.

Added: pypy/dist/pypy/doc/config/unmergedblocks.png
==============================================================================
Binary file. No diff available.



More information about the Pypy-commit mailing list