Complexity of the spilling problem
The coalescing problem
Wrap it all together
Advanced Register Allocation (2) Understanding the difficulty of register allocation
Florent Bouchez
[email protected] IISc — SERC
April 16th 2009
1 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Previously, on Advanced Register Allocation Without live-range splitting, deciding if k registers is enough is
NP-complete; With live-range splitting, it is polynomial (e.g., SSA-based splitting
makes interference graph chordal) What are the remaining problems? Spilling if there is not enough registers; Coalescing to reduce the number of added copies. What are the restrictions on splitting?
2 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Outline 1
Complexity of the spilling problem Study on basic blocks
2
The coalescing problem Introduction to coalescing Complexity of the coalescing problem Heuristics for coalescing
3
Wrap it all together A register allocation scheme in two phases Conclusion
3 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Outline 1
Complexity of the spilling problem Study on basic blocks
2
The coalescing problem Introduction to coalescing Complexity of the coalescing problem Heuristics for coalescing
3
Wrap it all together A register allocation scheme in two phases Conclusion
4 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Goal of the spilling We need that at all points, at most k variables are alive at the same time. Maxlive ≥ k
Problem What, where, and how to spill variables? Which variables are best for spilling? Should variables be spilled on all or parts of their live-ranges?
(spill everywhere vs. non-everywhere)
5 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Easy start: unweighted spilling on a basic block Unweighted spilling: we consider each live-range has the same cost. On a basic block, the interference graph is an interval graph.
Problem How to spill so that the graph gets k-colorable?
6 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Easy start: unweighted spilling on a basic block Unweighted spilling: we consider each live-range has the same cost. On a basic block, the interference graph is an interval graph.
Problem How to spill so that the graph gets k-colorable? No need to bother with non everywhere spilling. Use Belady’s algorithm: top-down scan; when register pressure is too high, spill the variable with furthest last use.
6 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Weighted version on a basic block What happens if live-ranges are weighted by their number of defs + uses? for spill everywhere, still polynomial with ILP formulation (unimodular
matrix) spill non-everywhere is more interesting, results depends on the cost function: store is free, loads count store counts, loads count
7 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Weighted version on a basic block What happens if live-ranges are weighted by their number of defs + uses? for spill everywhere, still polynomial with ILP formulation (unimodular
matrix) spill non-everywhere is more interesting, results depends on the cost function: store is free, loads count: live-ranges are “split” into smaller parts store counts, loads count
7 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Weighted version on a basic block What happens if live-ranges are weighted by their number of defs + uses? for spill everywhere, still polynomial with ILP formulation (unimodular
matrix) spill non-everywhere is more interesting, results depends on the cost function: store is free, loads count: live-ranges are “split” into smaller parts store counts, loads count: NP-complete
7 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Weighted version on a basic block What happens if live-ranges are weighted by their number of defs + uses? for spill everywhere, still polynomial with ILP formulation (unimodular
matrix) spill non-everywhere is more interesting, results depends on the cost function: store is free, loads count: live-ranges are “split” into smaller parts store counts, loads count: NP-complete
The more realistic problem “with holes” is even harder! (spilled variables leave tiny live-ranges at def and uses points.)
7 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Spilling is difficult
The spill problem is already a difficult one for basic blocks. For general programs (general graphs), or even SSA programs (chordal graphs), it is of course not simpler. . . approaches on interference graph lack the local informations; better to work on the control-flow graph, putting the effort on nested
loops.
8 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Outline 1
Complexity of the spilling problem Study on basic blocks
2
The coalescing problem Introduction to coalescing Complexity of the coalescing problem Heuristics for coalescing
3
Wrap it all together A register allocation scheme in two phases Conclusion
9 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Why coalescing? Goal of coalescing Removing the register-to-register copies [move a ← b] Numerous move due to: live-range splitting to
avoid spilling
10 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Why coalescing? Goal of coalescing Removing the register-to-register copies [move a ← b]
Numerous move due to: live-range splitting to
avoid spilling register constraints
a ← ... b ← ... c ← f (a, b)
a ← ... b ← ... move R0 ,a move R1 ,b call f move c,R0
10 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Why coalescing? Goal of coalescing Removing the register-to-register copies [move a ← b] if (. . . ) Numerous move due to: live-range splitting to
avoid spilling
a1 ← 1
a2 ← 2
register constraints SSA destruction
a3 ← φ(a1 , a2 ) · · · ← a3 10 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Why coalescing? Goal of coalescing Removing the register-to-register copies [move a ← b] if (. . . ) Numerous move due to: live-range splitting to
avoid spilling register constraints SSA destruction
a1 ← 1 move a3 ← a1
a2 ← 2 move a3 ← a2
a3 ← φ(a1 , a2 ) · · · ← a3 10 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Statement of the coalescing problem Given an instruction [move a ← b] Fact I Giving the same color to both a and b saves the instruction. Fact II Merging a and b forces them to have the same color.
11 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Statement of the coalescing problem Given an instruction [move a ← b] Fact I Giving the same color to both a and b saves the instruction. Fact II Merging a and b forces them to have the same color.
a
d
d
Merge a and b b
c
ab c
11 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Statement of the coalescing problem Given an instruction [move a ← b] Fact I Giving the same color to both a and b saves the instruction. Fact II Merging a and b forces them to have the same color. Idea Express this as an “affinity” between a and b in the interference graph to drive the algorithm. a
d
d
Merge a and b b
c
ab c
11 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Statement of the conservative coalescing problem Problem (conservative coalescing) G : k-colorable interference graph, A: set of affinities. Coalesce (merge) as many (a, b) ∈ A so that G stays k-colorable.
a1 ← 1 if (. . . )
a1 ← 1
a1
a2 ← 2 · · · ← a1
a2 a3
a3 ← φ(a1 , a2 ) 12 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Statement of the conservative coalescing problem Problem (conservative coalescing) G : k-colorable interference graph, A: set of affinities. Coalesce (merge) as many (a, b) ∈ A so that G stays k-colorable.
a1 ← 1 if (. . . )
a1 ← 1
a1
a2 ← 2 · · · ← a1
a2 a3
a3 ← φ(a1 , a2 ) 12 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Existing conservative coalescing heuristics Biased coloring; Incremental schemes: coalesce affinities one by one; Optimistic schemes: coalesce aggressively, then undo some
coalescings.
13 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Existing conservative coalescing heuristics Biased coloring;
à relies on “luck” during coloring Incremental schemes: coalesce affinities one by one;
à conservative rules of Briggs and George Optimistic schemes: coalesce aggressively, then undo some
coalescings. à optimistic register coalescing (Park&Moon)
13 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Existing conservative coalescing heuristics Biased coloring;
à relies on “luck” during coloring Incremental schemes: coalesce affinities one by one;
à conservative rules of Briggs and George Optimistic schemes: coalesce aggressively, then undo some
coalescings. à optimistic register coalescing (Park&Moon) But what is the complexity of the problem?
13 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Do you prefer programs or graphs?
Coalescing is a notion of instruction removing, and variable renaming. We modeled it using interference graphs with affinities.
Problem Is it possible to obtain any graph with a program?
14 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
A Chaitin-like construction d
Broot switch
c
b a Ba,b
Ba
a←0 b←1 x←a+b
return a+x
Ba,c
Bb
a←3 c←4 x←a+c
return b + x
Bb,d
Bc
b←6 d←7 x←b+d
return c + x
Bc,d
Bd
c←9 d ← 10 x←c+d
15 / 31
return d+x
Complexity of the spilling problem
The coalescing problem
Wrap it all together
A Chaitin-like construction d
Broot switch
c
b a Ba,b
a←0 b←1 x←a+b
Ba,c
a←3 c←4 x←a+c
Bb,d
b←6 d←7 x←b+d
Bc,d
c←9 d ← 10 x←c+d
Bhb,ci c←b Ba
return a+x
Bb
return b + x
Bc
return c + x
Bd
15 / 31
return d+x
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Different coalescing problems: conservative Problem (Conservative coalescing) Given a graph G , a set of affinities A, two integers k and K , is it possible to coalesce G such that it is k-colorable and at most K affinities are not coalesced?
16 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Different coalescing problems: conservative Problem (Conservative coalescing) Given a graph G , a set of affinities A, two integers k and K , is it possible to coalesce G such that it is k-colorable and at most K affinities are not coalesced? NP-complete xhd,bi
d
e c
b a
d
yhc,di
yhd,bi
e xhc,di
c
b xhb,ai
yhc,ei xhc,ei
yha,ci yhb,ai
a
xha,ci
16 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Different coalescing problems: incremental Problem (Incremental coalescing) Given a k-colorable graph G and an affinity hx, y i, is it possible to coalesce hx, y i such that G stays k-colorable?
17 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Different coalescing problems: incremental Problem (Incremental coalescing) Given a k-colorable graph G and an affinity hx, y i, is it possible to NP-complete coalesce hx, y i such that G stays k-colorable? Reduction from 4-SAT. Similar to the proof of NP-completeness for graph-coloring from 3-SAT. Idea: add {x0 } and modify each clause c ∈ C such that: c = yi,1 ∨ yi,2 ∨ yi,3 ∨ x0 Clearly, the formula is satisfied if x0 = True. Now, ask x0 and False to be coalesced. . . 17 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Different coalescing problems: incremental greedy-k-colorable
Problem (Incremental greedy-k-colorable coalescing) Given a greedy-k-colorable graph G and an affinity hx, y i, is it possible to coalesce hx, y i such that G stays greedy-k-colorable?
18 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Different coalescing problems: incremental greedy-k-colorable
Problem (Incremental greedy-k-colorable coalescing) Given a greedy-k-colorable graph G and an affinity hx, y i, is it possible to Polynomial! coalesce hx, y i such that G stays greedy-k-colorable? Yes it is! Checking if a graph is greedy-k-colorable is polynomial. . .
18 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Problem inherent with incremental coalescing
In incremental coalescing, the graph must stay greedy-k-colorable at each step.
Problem It may be possible that one requires more than one affinity to be coalesced to get to a greedy-k-colorable graph again.
19 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Problem inherent with incremental coalescing In incremental coalescing, the graph must stay greedy-k-colorable at each step. j
b e a
d
f
g
c
m
h
i
k l
20 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Problem inherent with incremental coalescing In incremental coalescing, the graph must stay greedy-k-colorable at each step. j
b e a
d
f
g
c
m
h
i
k l
20 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Problem inherent with incremental coalescing In incremental coalescing, the graph must stay greedy-k-colorable at each step. j
b e a c
Not greedy-3-colorable
df f
g
m
h
i
k l
20 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Problem inherent with incremental coalescing In incremental coalescing, the graph must stay greedy-k-colorable at each step. j
b e a
d
f
g
c
m
h
i
k l
20 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Problem inherent with incremental coalescing In incremental coalescing, the graph must stay greedy-k-colorable at each step. j
b e a
d
f
g
c
m
h
i
k l
20 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Problem inherent with incremental coalescing In incremental coalescing, the graph must stay greedy-k-colorable at each step. j
b e a
d
fg f
c
m
Not greedy-3-colorable i h
k l
20 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Problem inherent with incremental coalescing In incremental coalescing, the graph must stay greedy-k-colorable at each step. j
b e a
d
f
g
c
m
h
i
k l
20 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Problem inherent with incremental coalescing In incremental coalescing, the graph must stay greedy-k-colorable at each step. j
b e a
d
f
g
c
m
h
i
k l
20 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Problem inherent with incremental coalescing In incremental coalescing, the graph must stay greedy-k-colorable at each step. b e a
d
f
g
c
m
h
i
jk
greedy-3-colorable
l
20 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Problem inherent with incremental coalescing In incremental coalescing, the graph must stay greedy-k-colorable at each step. b e a
d
f
g
c
m
h
i
jk l
20 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Problem inherent with incremental coalescing In incremental coalescing, the graph must stay greedy-k-colorable at each step. b e a
d
f
g
c
m
h
i
jkl jk
greedy-3-colorable
20 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Problem inherent with incremental coalescing In incremental coalescing, the graph must stay greedy-k-colorable at each step. j
b e a
dfg c
m
i
jkl kl
h
20 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Different coalescing problems: aggressive Problem (Aggressive coalescing) Given a graph G , a set of affinities A, two integers k and K , is it possible to coalesce G such that at most K affinities are not coalesced? (no colorability constraint)
21 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Different coalescing problems: aggressive Problem (Aggressive coalescing) Given a graph G , a set of affinities A, two integers k and K , is it possible to coalesce G such that at most K affinities are not coalesced? (no NP-complete colorability constraint) Reduction from 3-Multiway-Cut: given a graph G = (V , E ), a subset S = {s1 , s2 , s3 } of V with 3 specified vertices or terminals, an integer K , the problem is to decide if one can remove at most K edges from E so that each terminal is in a different connected component.
21 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Theoretical limits of coalescing schemes Conservative rules (e.g., Briggs & George) Optimistic coalescing (e.g., Park & Moon)
22 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Theoretical limits of coalescing schemes Conservative rules (e.g., Briggs & George)
à incremental coalescing
Optimistic coalescing (e.g., Park & Moon)
à aggressive coalescing + de-coalescing
22 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Theoretical limits of coalescing schemes Conservative rules (e.g., Briggs & George)
à incremental coalescing
Optimistic coalescing (e.g., Park & Moon)
à aggressive coalescing + de-coalescing not k-colorable
22 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Theoretical limits of coalescing schemes Conservative rules (e.g., Briggs & George)
à incremental coalescing
Optimistic coalescing (e.g., Park & Moon)
à aggressive coalescing + de-coalescing Conservative
not k-colorable
22 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Theoretical limits of coalescing schemes Conservative rules (e.g., Briggs & George)
à incremental coalescing
Optimistic coalescing (e.g., Park & Moon)
à aggressive coalescing + de-coalescing Conservative
not k-colorable
incremental
22 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Theoretical limits of coalescing schemes Conservative rules (e.g., Briggs & George)
à incremental coalescing
Optimistic coalescing (e.g., Park & Moon)
à aggressive coalescing + de-coalescing Conservative
not k-colorable
incremental
22 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Theoretical limits of coalescing schemes Conservative rules (e.g., Briggs & George)
à incremental coalescing
Optimistic coalescing (e.g., Park & Moon)
à aggressive coalescing + de-coalescing Conservative
not k-colorable
incremental
22 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Theoretical limits of coalescing schemes Conservative rules (e.g., Briggs & George)
à incremental coalescing
Optimistic coalescing (e.g., Park & Moon)
à aggressive coalescing + de-coalescing Conservative
not k-colorable
incremental
22 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Theoretical limits of coalescing schemes Conservative rules (e.g., Briggs & George)
à incremental coalescing
Optimistic coalescing (e.g., Park & Moon)
à aggressive coalescing + de-coalescing Conservative
not k-colorable
incremental B/G
22 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Theoretical limits of coalescing schemes Conservative rules (e.g., Briggs & George)
à incremental coalescing
Optimistic coalescing (e.g., Park & Moon)
à aggressive coalescing + de-coalescing Conservative
not k-colorable
incremental B/G
22 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Theoretical limits of coalescing schemes Conservative rules (e.g., Briggs & George)
à incremental coalescing
Optimistic coalescing (e.g., Park & Moon)
à aggressive coalescing + de-coalescing Conservative
not k-colorable
incremental B/G
22 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Theoretical limits of coalescing schemes Conservative rules (e.g., Briggs & George)
à incremental coalescing
Optimistic coalescing (e.g., Park & Moon)
à aggressive coalescing + de-coalescing Conservative
not k-colorable
incremental B/G
22 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Theoretical limits of coalescing schemes Conservative rules (e.g., Briggs & George)
à incremental coalescing
Optimistic coalescing (e.g., Park & Moon)
à aggressive coalescing + de-coalescing Conservative
not k-greedy-colorable
not k-colorable
incremental B/G
22 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Theoretical limits of coalescing schemes Conservative rules (e.g., Briggs & George)
à incremental coalescing
Optimistic coalescing (e.g., Park & Moon)
à aggressive coalescing + de-coalescing Conservative
not k-greedy-colorable
not k-colorable
incremental B/G aggressive
22 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Theoretical limits of coalescing schemes Conservative rules (e.g., Briggs & George)
à incremental coalescing
Optimistic coalescing (e.g., Park & Moon)
à aggressive coalescing + de-coalescing Conservative
not k-greedy-colorable
incremental
not k-colorable
de-coalescing
B/G aggressive
22 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Theoretical limits of coalescing schemes Conservative rules (e.g., Briggs & George)
à incremental coalescing
Optimistic coalescing (e.g., Park & Moon)
à aggressive coalescing + de-coalescing Conservative
not k-greedy-colorable
incremental
not k-colorable
de-coalescing
B/G aggressive
22 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Theoretical limits of coalescing schemes Conservative rules (e.g., Briggs & George)
à incremental coalescing
NP-complete (not greedy-check)
Optimistic coalescing (e.g., Park & Moon)
à aggressive coalescing + de-coalescing Conservative
not k-greedy-colorable
incremental
both NP-complete not k-colorable
de-coalescing
B/G aggressive
22 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors. a
3
j
Stack
2
d0 1
c0
c
4
4
b
3
d
e
3
4
f 2
g0
1
3
i g
2
Hi-degree node Low-degree node
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors. a
3
j 2
Stack
d0 1
c0
j
c
4
4
b
3
d
e
3
4
f 2
g0
2
i g
2
Hi-degree node Low-degree node
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors. a
3
j 2
Stack
d0 1
c0 g j
c
4
4
b
3
d
e
3
3
f 2
g0
1
i g
Hi-degree node Low-degree node
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors. a
3
j 2
Stack
d0 1
c0 i g j
c
4
4
b
3
d
e
3
2
f 2
g0
i g
Hi-degree node Low-degree node
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors. a
3
j 2
Stack
d0 1
f i g j
c0
c
4
4
b
3
d
e
2
f 1
g0
i g
Hi-degree node Low-degree node
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors. a
3
j
Stack
2
d0 g0 f i g j
1
c0
c
4
4
b
3
d
e
1
g0
f
i g
Hi-degree node Low-degree node
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors. a
3
j
Stack
2
d0 e g0 f i g j
1
c0
c
4
4
b
2
d
e g0
f
i g
Hi-degree node Low-degree node
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors. a
3
j
Stack
2
d0 d e g0 f i g j
1
c0
c
3
3
b
d
e g0
f
i g
Hi-degree node Low-degree node
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors.
Stack
a d0 d e g0 f i g j
3
j d0
1
c0
c
2
2
b
d
e g0
f
i g
Hi-degree node Low-degree node
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors.
Stack
a c d0 d e g0 f i g j
2
j d0
1
c0
c
1
b
d
e g0
f
i g
Hi-degree node Low-degree node
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors.
Stack
a b c d0 d e g0 f i g j
1
j d0
1
c0
c
b
d
e g0
f
i g
Hi-degree node Low-degree node
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs
Stack
Greedy-k-colorable-graphs: simplify nodes with < k neighbors. a b c d0 d e g0 f i g j
a
j d0
c0
c
b
d
e g0
f
i g
Hi-degree node Low-degree node
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs
Stack
Greedy-k-colorable-graphs: simplify nodes with < k neighbors. c0 a b c d0 d e g0 f i g j
a
j d0
c0
c
b
d
e g0
f
i g
Hi-degree node Low-degree node
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs
Stack
Greedy-k-colorable-graphs: simplify nodes with < k neighbors. c0 a b c d0 d e g0 f i g j
a
j d0
c0
c
b
d
e g0
f
i g
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs
Stack
Greedy-k-colorable-graphs: simplify nodes with < k neighbors. a b c d0 d e g0 f i g j
a
j d0
c0
c
b
d
e g0
f
i g
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors.
Stack
a b c d0 d e g0 f i g j
j d0
c0
c
b
d
e g0
f
i g
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors.
Stack
a c d0 d e g0 f i g j
j d0
c0
c
b
d
e g0
f
i g
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors.
Stack
a d0 d e g0 f i g j
j d0
c0
c
b
d
e g0
f
i g
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors.
Stack
a
j d0
d e g0 f i g j
c0
c
b
d
e g0
f
i g
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors.
Stack
a
j d0
e g0 f i g j
c0
c
b
d
e g0
f
i g
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors.
Stack
a
j d0
g0 f i g j
c0
c
b
d
e g0
f
i g
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors. a
j
Stack
d0
f i g j
c0
c
b
d
e g0
f
i g
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors. a
j
Stack
d0 c0
c
b
d
e g0
f
i g
i g j
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors. a
j
Stack
d0 c0
c
b
d
e g0
f
i g
g j
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors. a
j
Stack
d0 c0
c
b
d
e g0
f
i g
j
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors.
Stack
a
j d0
c0
c
b
d
e g0
f
i g
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Briggs’s and George’s rules for Greedy-k-colorable graphs Greedy-k-colorable-graphs: simplify nodes with < k neighbors.
Stack
a
j d0
c0
c
b
d
e g0
f
i g
23 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Briggs Resulting node has < k high-degree neighbours
a
j d’
c’
c
b
d
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Briggs Resulting node has < k high-degree neighbours
2
a
j 2
d’
3
d
e
4
c’
c
b
g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Briggs Resulting node has < k high-degree neighbours
a
j d’
c’
c
b
d
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Briggs Resulting node has < k high-degree neighbours
a
j d’
c’
c
b
d
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Briggs Resulting node has < k high-degree neighbours
a
j d’
c’
c
b
d
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Briggs Resulting node has < k high-degree neighbours
a
j d’
c’ c
b
d
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Briggs Resulting node has < k high-degree neighbours
a
j d’
c’ c
b
d
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Briggs Resulting node has < k high-degree neighbours
a
j d’
c’ c
b
d
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Briggs Resulting node has < k high-degree neighbours
a
j d’
c’c
b
d
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Briggs Resulting node has < k high-degree neighbours
a
j d’
c c’
b
d
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
George
George
All high-degree neighbours are neighbours of the other node
a
j d’
c c’
b
d
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
George
George
All high-degree neighbours are neighbours of the other node
a
j 3
d’ 3
c c’
d
e
3
b
g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
George
George
All high-degree neighbours are neighbours of the other node
a
j d’
c c’
b
d
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
George
George
All high-degree neighbours are neighbours of the other node
a
j d’
c c’
b
d
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
George
George
All high-degree neighbours are neighbours of the other node
a
j d’
c c’
b
d
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
George
George
All high-degree neighbours are neighbours of the other node
a
j d’ d
c c’
b
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
George
George
All high-degree neighbours are neighbours of the other node
a
j d’ d
c c’
b
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
George
George
All high-degree neighbours are neighbours of the other node
a
j d’ d
c c’
b
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
George
George
All high-degree neighbours are neighbours of the other node
a
j d’d
c c’
b
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
George
George
All high-degree neighbours are neighbours of the other node
a
j d’ d
c c’
b
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Brute-force
George
Merge the nodes and check if resulting graph is greedy-k-colorable
Brute-force
a
j d’ d
c c’
b
e g’
f
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Brute-force
George
Merge the nodes and check if resulting graph is greedy-k-colorable
Brute-force
2
a
j 3
d’ d c c’
b
e g’
3
f
3
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Brute-force
George
Merge the nodes and check if resulting graph is greedy-k-colorable
Brute-force
a
j d’ d
c c’
b
e
f g’
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Brute-force
George
Merge the nodes and check if resulting graph is greedy-k-colorable
Brute-force
a
j d’ d
c c’
b
e
f g’
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Brute-force
George
Merge the nodes and check if resulting graph is greedy-k-colorable
Brute-force
a
j d’ d
c c’
b
e
f g’
i g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Brute-force
George
Merge the nodes and check if resulting graph is greedy-k-colorable
Brute-force
a
j d’ d
c c’
b
e
f
i
g’
g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Brute-force
George
Merge the nodes and check if resulting graph is greedy-k-colorable
Brute-force
a
j d’ d
c c’
b
e
i
f g’
g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Brute-force
George
Merge the nodes and check if resulting graph is greedy-k-colorable
Brute-force
a
j d’ d
c c’
b
e
f
i g’ g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Brute-force
George
Merge the nodes and check if resulting graph is greedy-k-colorable
Brute-force
a
j d’ d
c c’
b
e
f
i g’ g
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Brute-force
George
Merge the nodes and check if resulting graph is greedy-k-colorable
Brute-force
a
j d’ d
c c’
b
e
f
i g g’
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Chordal
George
Relies on optimal incremental coalescing for interval graphs. (May need to merge other nodes
Brute-force
to get a greedy-k-colorable graph.)
Chordal
a
j d’ d
c c’
b
e
f
i g g’
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes Briggs
Chordal
George
Relies on optimal incremental coalescing for interval graphs. (May need to merge other nodes
Brute-force
to get a greedy-k-colorable graph.)
Chordal 2
2
a
j 3
d’ d 3
c c’
3
b
3
e
3
f
3
i 4
g g’
24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes
c
j
f e
b a
i g
d
a
j d’ d
c c’
b
e
f
i g g’ 24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes
c
j
f e
b a
i g
d
a
j d’ d
c c’
b
e
f
i g g’ 24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Coalescing two nodes. . . with additional merges
c
j
f e
b a
i g
d
adfj
e c
b
i g 24 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
A note on optimistic register coalescing Optimistic schemes perform aggressive coalescing, hoping that few coalescings must be undone later.
Bonus: demo of coalescing. 25 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
A note on optimistic register coalescing Optimistic schemes perform aggressive coalescing, hoping that few coalescings must be undone later. Advantages: 1 if the fully coalesced graph is greedy-k-colorable, always find the optimal solution; 2 does not get stuck at non greedy-k-colorable intermediate graphs; 3 very fast on graphs with many affinities.
Bonus: demo of coalescing. 25 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
A note on optimistic register coalescing Optimistic schemes perform aggressive coalescing, hoping that few coalescings must be undone later. Advantages: 1 if the fully coalesced graph is greedy-k-colorable, always find the optimal solution; 2 does not get stuck at non greedy-k-colorable intermediate graphs; 3 very fast on graphs with many affinities. Disadvantages: 1 good aggressive choices can be bad conservative ones, hard to repair; 2 no good de-coalescing indicator; 3 de-coalescing is technically difficult; 4 worse that incremental “brute-force” in practice. Bonus: demo of coalescing. 25 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Outline 1
Complexity of the spilling problem Study on basic blocks
2
The coalescing problem Introduction to coalescing Complexity of the coalescing problem Heuristics for coalescing
3
Wrap it all together A register allocation scheme in two phases Conclusion
26 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
“All-in-one” register allocation For decades, graph-coloring register allocation schemes consist of one big chunk that does spilling, coloring, and coalescing at the same time. The are good reasons for this: spilling is highly dependent on the coloring coalescing helps the coloring coalescing not strong enough to remove many affinities
Pros Simple scheme, handles everything.
Cons Difficult to modify parts, as everything in entangled. Hence testing different heuristics is complicated. 27 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
A register allocation scheme in two phases 1
Decrease register pressure to R (using as many splits as we want)
2
Color independently with a good coalescing
Since now: spilling only dependent on Maxlive whatever the coalescing, still Maxlive colors required advanced coalescing techniques efficiently discards copies
28 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
A register allocation scheme in two phases 1
Decrease register pressure to R (using as many splits as we want)
2
Color independently with a good coalescing
What for? scheme still as simple as the original IRC improvements on spill or coalescing won’t affect the whole allocator easier for developpers to test different strategies
28 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
coalesce
freeze
pot. spill
select
act. spill
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
coalesce
freeze
pot. spill
select
act. spill
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
coalesce
freeze
select
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
coalesce
freeze
select
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
coalesce
freeze
select
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
coalesce
freeze
select
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
coalesce
freeze
select
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
coalesce
freeze
select
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
coalesce
freeze
select
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
Briggs
George
Brute
freeze
select
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
Briggs
George
Brute
freeze
select
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
Briggs
George
Brute
select
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
Briggs
George
Brute
select
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
Briggs
George
Brute
select
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
Briggs
George
Brute
select
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
Briggs
George
Brute
select
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
Briggs
George
Brute
select
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
Briggs
George
Brute
select
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Iterated Register Coalescing and beyond Incremental conservative algorithm 1
Fast check with Briggs&George rules (for all nodes, “pre-colored” or not)
2
If fails, longer check with optimized version of brute-force.
à uses same framework as Chaitin: easy to implement!
build
simplify
Briggs
George
simplify
select
29 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
Conclusion
Spilling is a difficult problem for which interference graph are not well
suited. Coalescing is nicely expressed in terms of graph coloring. Thanks to splitting, newer graph coloring register allocators can be
built in two phases instead of the old traditional “all-in-one” ways.
30 / 31
Complexity of the spilling problem
The coalescing problem
Wrap it all together
That’s all for today
31 / 31