[pypy-svn] r25214 - pypy/dist/pypy/rpython
arigo at codespeak.net
arigo at codespeak.net
Sat Apr 1 19:39:19 CEST 2006
Author: arigo
Date: Sat Apr 1 19:39:18 2006
New Revision: 25214
Modified:
pypy/dist/pypy/rpython/rgenop.py
Log:
(arre, pedronis, arigo)
rgenop.isconst() helper.
Modified: pypy/dist/pypy/rpython/rgenop.py
==============================================================================
--- pypy/dist/pypy/rpython/rgenop.py (original)
+++ pypy/dist/pypy/rpython/rgenop.py Sat Apr 1 19:39:18 2006
@@ -84,7 +84,11 @@
return llmemory.cast_ptr_to_adr(c.value)
else:
return lltype.cast_primitive(T, c.value)
-
+
+def isconst(gv_value):
+ c = from_opaque_object(gv_value)
+ return isinstance(c, flowmodel.Constant)
+
# XXX
# temporary interface; it's unclera if genop itself should change to ease dinstinguishing
# Void special args from the rest. Or there should be variation for the ops involving them
@@ -254,6 +258,7 @@
setannotation(genop, s_ConstOrVar)
setannotation(genconst, s_ConstOrVar)
revealconst.compute_result_annotation = lambda s_T, s_gv: annmodel.lltype_to_annotation(s_T.const)
+setannotation(isconst, annmodel.SomeBool())
setannotation(closeblock1, s_Link)
setannotation(closeblock2, s_LinkPair)
setannotation(closelink, None)
@@ -265,6 +270,7 @@
setspecialize(genop)
setspecialize(genconst)
setspecialize(revealconst)
+setspecialize(isconst)
setspecialize(closeblock1)
setspecialize(closeblock2)
setspecialize(closelink)
More information about the Pypy-commit
mailing list