[pypy-commit] pypy ppc-jit-backend: add class scratch_reg as help for management of the scratch registers

hager noreply at buildbot.pypy.org
Tue Feb 14 16:33:10 CET 2012


Author: hager <sven.hager at uni-duesseldorf.de>
Branch: ppc-jit-backend
Changeset: r52454:cd1b5bef88c7
Date: 2012-02-14 16:30 +0100
http://bitbucket.org/pypy/pypy/changeset/cd1b5bef88c7/

Log:	add class scratch_reg as help for management of the scratch
	registers

diff --git a/pypy/jit/backend/ppc/codebuilder.py b/pypy/jit/backend/ppc/codebuilder.py
--- a/pypy/jit/backend/ppc/codebuilder.py
+++ b/pypy/jit/backend/ppc/codebuilder.py
@@ -1174,6 +1174,16 @@
                 f.write(data[i])
             f.close()
 
+class scratch_reg(object):
+    def __init__(self, mc):
+        self.mc = mc
+
+    def __enter__(self):
+        self.mc.alloc_scratch_reg()
+
+    def __exit__(self):
+        self.mc.free_scratch_reg()
+
 class BranchUpdater(PPCAssembler):
     def __init__(self):
         PPCAssembler.__init__(self)


More information about the pypy-commit mailing list