Author: Remi Meier <[email protected]>
Branch: fix-longevity
Changeset: r82505:4e99dd1d0654
Date: 2016-02-25 15:03 +0100
http://bitbucket.org/pypy/pypy/changeset/4e99dd1d0654/
Log: (plan_rich,remi) test and fix for call_dists calculation
diff --git a/rpython/jit/backend/llsupport/regalloc.py
b/rpython/jit/backend/llsupport/regalloc.py
--- a/rpython/jit/backend/llsupport/regalloc.py
+++ b/rpython/jit/backend/llsupport/regalloc.py
@@ -796,6 +796,9 @@
last_call_pos = -1
for i in range(len(operations)-1, -1, -1):
op = operations[i]
+ if op.is_call():
+ last_call_pos = i
+ dist_to_next_call[i] = last_call_pos - i
if op.type != 'v':
if op not in last_used and op.has_no_side_effect():
continue
@@ -816,9 +819,6 @@
assert not isinstance(arg, Const)
if arg not in last_used:
last_used[arg] = i
- if op.is_call():
- last_call_pos = i
- dist_to_next_call[i] = last_call_pos - i
#
longevity = {}
for i, arg in enumerate(operations):
diff --git a/rpython/jit/backend/llsupport/test/test_regalloc_call.py
b/rpython/jit/backend/llsupport/test/test_regalloc_call.py
--- a/rpython/jit/backend/llsupport/test/test_regalloc_call.py
+++ b/rpython/jit/backend/llsupport/test/test_regalloc_call.py
@@ -200,8 +200,9 @@
""", namespace=self.namespace)
i1 = ops.operations[0]
i2 = ops.operations[1]
- trace_alloc = TraceAllocation(ops, [eax, edx], [r8, r9, r10], [eax,
r10], tt)
- trace_alloc.run_allocation([r8,r9,edx])
+ trace_alloc = TraceAllocation(ops, [eax, edx, get_param(0)],
+ [r8, r9, r10], [eax, r10], tt)
+ trace_alloc.run_allocation()
# we force the allocation to immediately take the first call parameter
register
# the new regalloc will not shuffle register binding around (other
than spilling)
# in the best case this will reduce a lot of movement
diff --git a/rpython/jit/backend/llsupport/test/test_regalloc_integration.py
b/rpython/jit/backend/llsupport/test/test_regalloc_integration.py
--- a/rpython/jit/backend/llsupport/test/test_regalloc_integration.py
+++ b/rpython/jit/backend/llsupport/test/test_regalloc_integration.py
@@ -190,6 +190,20 @@
assert lrs.dist_to_next_call == [3, 2, 1, 0, 1, 0, -7, -8]
+ def test_compute_call_distances2(self):
+ ops = '''
+ [p0,i0]
+ i1 = int_add(i0,i0)
+ i2 = int_sub(i0,i1)
+ call_n(p0, i1, descr=raising_calldescr)
+ i3 = int_mul(i2,i0)
+ jump(p0,i2)
+ '''
+ loop = self.parse(ops)
+ lrs = compute_var_live_ranges(loop.inputargs, loop.operations)
+ assert lrs.dist_to_next_call == [2, 1, 0, -4, -5]
+
+
def test_simple_loop(self):
ops = '''
[i0]
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit