[pypy-svn] r40587 - in pypy/branch/jit-virtual-world/pypy/translator/llvm: . test

ac at codespeak.net ac at codespeak.net
Fri Mar 16 17:05:06 CET 2007


Author: ac
Date: Fri Mar 16 17:05:04 2007
New Revision: 40587

Modified:
   pypy/branch/jit-virtual-world/pypy/translator/llvm/opwriter.py
   pypy/branch/jit-virtual-world/pypy/translator/llvm/test/test_symbolic.py
Log:
is_early_constant for llvm.

Modified: pypy/branch/jit-virtual-world/pypy/translator/llvm/opwriter.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/translator/llvm/opwriter.py	(original)
+++ pypy/branch/jit-virtual-world/pypy/translator/llvm/opwriter.py	Fri Mar 16 17:05:04 2007
@@ -517,3 +517,8 @@
 
     def hint(self, opr):
         self.same_as(opr)
+
+    def is_early_constant(self, opr):
+        # If it gets this far it is always false
+        self.codewriter.cast(opr.retref, 'bool',
+                             'false', opr.rettype)

Modified: pypy/branch/jit-virtual-world/pypy/translator/llvm/test/test_symbolic.py
==============================================================================
--- pypy/branch/jit-virtual-world/pypy/translator/llvm/test/test_symbolic.py	(original)
+++ pypy/branch/jit-virtual-world/pypy/translator/llvm/test/test_symbolic.py	Fri Mar 16 17:05:04 2007
@@ -167,3 +167,16 @@
     assert fn(21) == 42
 
 
+
+def test_is_early_constant():
+    from pypy.rlib import objectmodel
+    def f(x):
+        if objectmodel._is_early_constant(x):
+            return 42
+        return 0
+    
+
+    fn = compile_function(f, [int])
+    res = fn(5)
+    assert res == 0
+    



More information about the Pypy-commit mailing list