Professional Documents
Culture Documents
Define X: (Left) X Use X: (Right) - X + 1 //output X
Define X: (Left) X Use X: (Right) - X + 1 //output X
redefined.
Liveness:
Live Ranges of x - (has to be used, if next instruction does not use x, then that instruction at current
point is dead.
Register interference graph - Two live rangers interfere if they overlap (same section of code)
-Graph Coloring
K coloring – when you color graph, you cant assign same color(registers) to nodes that
have same edge (empty complete-may not cover anything)
More neighbors = more colors used, may not leave any colors for last node
If node n < Registers (easiest nodes) – remove from graph and do last
When you remove nodes, hardest nodes become easy nodes. When graph empty you are done.
Algorithm works if you can keep removing nodes until empty and can color all nodes
If doesn’t work (doesn’t mean that you cant color nodes, just that algorithm failed—empty complete
problem) //got stuck at removing nodes
- Take highest degree node(throw it away(go to memory) – remove node and its edges)
- Remove nodes n < R. (if you get stuck remove 1 or 2 nodes until rest of nodes have n < R)
Once you know global information go back one step to local blocks and compute everything
Local
3 topics – 3 questions