[pypy-dev] Next step: gen???.py
arigo at tunes.org
Thu Mar 31 15:26:17 CEST 2005
On Thu, Mar 31, 2005 at 02:00:28PM +0200, holger krekel wrote:
> Actually i woke up this morning with exactly this idea in mind :-)
> I was wondering if it makes sense for such conversions to be determined
> at the flowgraph-level and conversion operations to be inserted accordingly?
Yes, that's what typer.py does already. Example:
from pypy.translator.translator import Translator
from pypy.translator.typer import specialize
from pypy.translator.test.snippet import my_gcd as fn
t = Translator(fn)
a = t.annotate([int, int])
This example shows both the is_true() -> int_is_true() transformation, and the
mod() operation which isn't recognized yet by specialize() and thus gets
explicit conversion operations inserted before and after.
It is indeed back-end specific which operations can be specialized and how,
but it is done at the graph level.
More information about the Pypy-dev