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

mwh at codespeak.net mwh at codespeak.net
Fri Jan 27 18:34:52 CET 2006


Author: mwh
Date: Fri Jan 27 18:34:50 2006
New Revision: 22751

Modified:
   pypy/dist/pypy/translator/c/newfuncgen.py
Log:
use iterblocks() not traverse


Modified: pypy/dist/pypy/translator/c/newfuncgen.py
==============================================================================
--- pypy/dist/pypy/translator/c/newfuncgen.py	(original)
+++ pypy/dist/pypy/translator/c/newfuncgen.py	Fri Jan 27 18:34:50 2006
@@ -3,7 +3,7 @@
 from pypy.translator.c.support import cdecl, ErrorValue
 from pypy.translator.c.support import llvalue_from_constant, gen_assignments
 from pypy.objspace.flow.model import Variable, Constant, Block
-from pypy.objspace.flow.model import traverse, c_last_exception
+from pypy.objspace.flow.model import c_last_exception
 from pypy.rpython.lltypesystem.lltype import \
      Ptr, PyObject, Void, Bool, Signed, Unsigned, SignedLongLong, UnsignedLongLong,Char, UniChar, pyobjectptr, Struct, Array
 
@@ -206,11 +206,9 @@
             yield 'goto block%d;' % blocknum[link.target]
 
         # collect all blocks
-        def visit(block):
-            if isinstance(block, Block):
-                allblocks.append(block)
-                blocknum[block] = len(blocknum)
-        traverse(visit, graph)
+        for block in graph.iterblocks():
+            allblocks.append(block)
+            blocknum[block] = len(blocknum)
 
         assert graph.startblock is allblocks[0]
 



More information about the Pypy-commit mailing list