[pypy-commit] pypy arm-backend-2: update compute_vars_longevity and return computed values instead of directly assigning them

bivab noreply at buildbot.pypy.org
Fri Dec 30 17:13:01 CET 2011


Author: David Schneider <david.schneider at picle.org>
Branch: arm-backend-2
Changeset: r50960:43bf7458dfe1
Date: 2011-12-30 13:58 +0100
http://bitbucket.org/pypy/pypy/changeset/43bf7458dfe1/

Log:	update compute_vars_longevity and return computed values instead of
	directly assigning them

diff --git a/pypy/jit/backend/llsupport/regalloc.py b/pypy/jit/backend/llsupport/regalloc.py
--- a/pypy/jit/backend/llsupport/regalloc.py
+++ b/pypy/jit/backend/llsupport/regalloc.py
@@ -491,7 +491,7 @@
     # only to guard operations or to jump or to finish
     produced = {}
     last_used = {}
-    useful = {}
+    last_real_usage = {}
     for i in range(len(operations)-1, -1, -1):
         op = operations[i]
         if op.result:
@@ -502,10 +502,13 @@
         opnum = op.getopnum()
         for j in range(op.numargs()):
             arg = op.getarg(j)
-            if opnum != rop.JUMP and opnum != rop.FINISH:
-                useful[arg] = None
-            if isinstance(arg, Box) and arg not in last_used:
+            if not isinstance(arg, Box):
+                continue
+            if arg not in last_used:
                 last_used[arg] = i
+            if opnum != rop.JUMP and opnum != rop.LABEL:
+                if arg not in last_real_usage:
+                    last_real_usage[arg] = i
         if op.is_guard():
             for arg in op.getfailargs():
                 if arg is None: # hole
@@ -513,7 +516,7 @@
                 assert isinstance(arg, Box)
                 if arg not in last_used:
                     last_used[arg] = i
-
+    #
     longevity = {}
     for arg in produced:
         if arg in last_used:
@@ -529,8 +532,7 @@
             longevity[arg] = (0, last_used[arg])
             del last_used[arg]
     assert len(last_used) == 0
-    return longevity, useful
-
+    return longevity, last_real_usage
 
 def is_comparison_or_ovf_op(opnum):
     from pypy.jit.metainterp.resoperation import opclasses
diff --git a/pypy/jit/backend/x86/regalloc.py b/pypy/jit/backend/x86/regalloc.py
--- a/pypy/jit/backend/x86/regalloc.py
+++ b/pypy/jit/backend/x86/regalloc.py
@@ -174,7 +174,10 @@
         operations = cpu.gc_ll_descr.rewrite_assembler(cpu, operations,
                                                        allgcrefs)
         # compute longevity of variables
-        self._compute_vars_longevity(inputargs, operations)
+        longevity, last_real_usage = compute_vars_longevity(
+                                                    inputargs, operations)
+        self.longevity = longevity
+        self.last_real_usage = last_real_usage
         self.rm = gpr_reg_mgr_cls(self.longevity,
                                   frame_manager = self.fm,
                                   assembler = self.assembler)


More information about the pypy-commit mailing list