[pypy-svn] r27302 - pypy/dist/pypy/translator/c

arigo at codespeak.net arigo at codespeak.net
Tue May 16 21:26:45 CEST 2006


Author: arigo
Date: Tue May 16 21:26:44 2006
New Revision: 27302

Modified:
   pypy/dist/pypy/translator/c/funcgen.py
Log:
Generate goto's in a more natural-looking order (when reading the C source).
Remove double blank lines.


Modified: pypy/dist/pypy/translator/c/funcgen.py
==============================================================================
--- pypy/dist/pypy/translator/c/funcgen.py	(original)
+++ pypy/dist/pypy/translator/c/funcgen.py	Tue May 16 21:26:44 2006
@@ -233,14 +233,13 @@
                 assert len(block.exits) == 1
                 for op in self.gen_link(block.exits[0]):
                     yield op
-                yield ''
             else:
                 assert block.exitswitch != c_last_exception
                 # block ending in a switch on a value
                 TYPE = self.lltypemap(block.exitswitch)
                 if TYPE in (Bool, PyObjPtr):
                     expr = self.expr(block.exitswitch)
-                    for link in block.exits[:-1]:
+                    for link in block.exits[:0:-1]:
                         assert link.exitcase in (False, True)
                         if TYPE == Bool:
                             if not link.exitcase:
@@ -256,13 +255,12 @@
                         for op in self.gen_link(link):
                             yield '\t' + op
                         yield '}'
-                    link = block.exits[-1]
+                    link = block.exits[0]
                     assert link.exitcase in (False, True)
                     #yield 'assert(%s == %s);' % (self.expr(block.exitswitch),
                     #                       self.genc.nameofvalue(link.exitcase, ct))
-                    for op in self.gen_link(block.exits[-1]):
+                    for op in self.gen_link(link):
                         yield op
-                    yield ''
                 elif TYPE in (Signed, Unsigned, SignedLongLong,
                               UnsignedLongLong, Char, UniChar):
                     defaultlink = None



More information about the Pypy-commit mailing list