[pypy-svn] r30411 - in pypy/dist/pypy/translator: . llvm

rxe at codespeak.net rxe at codespeak.net
Sun Jul 23 20:55:38 CEST 2006


Author: rxe
Date: Sun Jul 23 20:55:35 2006
New Revision: 30411

Modified:
   pypy/dist/pypy/translator/llvm/funcnode.py
   pypy/dist/pypy/translator/unsimplify.py
Log:
Move transformation to unsimplify.py



Modified: pypy/dist/pypy/translator/llvm/funcnode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/funcnode.py	(original)
+++ pypy/dist/pypy/translator/llvm/funcnode.py	Sun Jul 23 20:55:35 2006
@@ -4,7 +4,7 @@
 from pypy.translator.llvm.node import LLVMNode, ConstantLLVMNode
 from pypy.translator.llvm.opwriter import OpWriter
 from pypy.translator.llvm.log import log 
-from pypy.translator.unsimplify import remove_double_links, insert_empty_startblock
+from pypy.translator.unsimplify import remove_double_links, no_links_to_startblack
 log = log.funcnode
 
 class FuncTypeNode(LLVMNode):
@@ -67,24 +67,8 @@
     # main entry points from genllvm 
 
     def post_setup_transform(self):
-        graph = self.graph
-
-        remove_double_links(self.db.translator.annotator, graph)
-
-        # XXX below is a quick hack to compile pypy-llvm
-        broken_start_block = False
-        for block in graph.iterblocks():
-            for link in block.exits:
-                if link.target == graph.startblock:
-                    broken_start_block = True
-                    break
-
-        if broken_start_block:
-            insert_empty_startblock(None, graph)
-        
-        for block in graph.iterblocks():
-            for link in block.exits:
-                assert link.target != graph.startblock
+        remove_double_links(self.db.translator.annotator, self.graph)
+        no_links_to_startblack(self.graph)
 
     def writedecl(self, codewriter): 
         codewriter.declare(self.getdecl())

Modified: pypy/dist/pypy/translator/unsimplify.py
==============================================================================
--- pypy/dist/pypy/translator/unsimplify.py	(original)
+++ pypy/dist/pypy/translator/unsimplify.py	Sun Jul 23 20:55:35 2006
@@ -137,3 +137,14 @@
             for link in double_links:
                 insert_empty_block(annotator, link)
     traverse(visit, graph)
+
+def no_links_to_startblack(graph):
+    """Ensure no links to start block."""    
+    links_to_start_block = False
+    for block in graph.iterblocks():
+        for link in block.exits:
+            if link.target == graph.startblock:
+                links_to_start_block = True
+                break
+    if links_to_start_block:
+        insert_empty_startblock(None, graph)



More information about the Pypy-commit mailing list