[pypy-dev] Next step: gen???.py
Armin Rigo
arigo at tunes.org
Thu Mar 31 15:26:17 MEST 2005
Hi Holger,
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)
t.simplify()
a = t.annotate([int, int])
t.checkgraphs()
specialize(a)
t.checkgraphs()
t.view()
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.
A bientot,
Armin
More information about the pypy-dev
mailing list