[pypy-svn] r14096 - in pypy/dist/pypy/translator/llvm2: . test

hpk at codespeak.net hpk at codespeak.net
Sat Jul 2 16:04:15 CEST 2005


Author: hpk
Date: Sat Jul  2 16:04:14 2005
New Revision: 14096

Modified:
   pypy/dist/pypy/translator/llvm2/funcnode.py
   pypy/dist/pypy/translator/llvm2/test/test_genllvm.py
Log:
fix invocations of optimizations and unsimplificiations even more 


Modified: pypy/dist/pypy/translator/llvm2/funcnode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/funcnode.py	(original)
+++ pypy/dist/pypy/translator/llvm2/funcnode.py	Sat Jul  2 16:04:14 2005
@@ -3,6 +3,7 @@
 from pypy.objspace.flow.model import flatten, mkentrymap, traverse
 from pypy.rpython import lltype
 from pypy.translator.backendoptimization import remove_same_as 
+from pypy.translator.unsimplify import remove_double_links                     
 from pypy.translator.llvm2.node import LLVMNode
 from pypy.translator.llvm2.log import log 
 log = log.funcnode
@@ -40,6 +41,7 @@
         self.ref = "%" + const_ptr_func.value._obj._name
         self.graph = const_ptr_func.value._obj.graph 
         remove_same_as(self.graph) 
+        remove_double_links(self.db._translator, self.graph) 
         
     def __str__(self):
         return "<FuncNode %r>" %(self.ref,)

Modified: pypy/dist/pypy/translator/llvm2/test/test_genllvm.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/test/test_genllvm.py	(original)
+++ pypy/dist/pypy/translator/llvm2/test/test_genllvm.py	Sat Jul  2 16:04:14 2005
@@ -23,6 +23,8 @@
     a = t.annotate(annotate)
     t.specialize()
     a.simplify()
+    if view: 
+        t.view()
     return genllvm(t)
 
 
@@ -32,6 +34,20 @@
     f = compile_function(simple1, [])
     assert f() == 1
 
+def Xtest_simple_function_pointer(): 
+    def f1(x): 
+        return x + 1
+    def f2(x): 
+        return x + 2
+
+    l = [f1, f2]
+
+    def pointersimple(i): 
+        return l[i]
+
+    f = compile_function(pointersimple, [int])
+    assert f 
+
 def test_simple_branching():
     def simple5(b):
         if b:
@@ -153,7 +169,7 @@
         if m == 0:
             return ackermann(n - 1, 1)
         return ackermann(n - 1, ackermann(n, m - 1))
-    f = compile_function(call_ackermann, [int, int])
+    f = compile_function(call_ackermann, [int, int], view=False)
     assert f(0, 2) == 3
     
 def test_tuple_getitem(): 



More information about the Pypy-commit mailing list