12.07.2015 Views

Iterated Register Coalescing - School of Computer Science

Iterated Register Coalescing - School of Computer Science

Iterated Register Coalescing - School of Computer Science

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

320 · Lal George and Andrew Appeldescribed by Briggs and Torczon [1993] contains a bug, where t is removed fromthe live set instead <strong>of</strong> s.The Build procedure also initializes the worklistMoves to contain all the movesin the program.function Adjacent(n)AdjacentadjList[n] \ (selectStack ∪ coalescedNodes)function NodeMoves (n)moveList[n] ∩ (activeMoves ∪ worklistMoves)function MoveRelated(n)NodeMoves(n) ≠ {}procedure MkWorklist()forall n ∈ initialinitial := initial \{n}if degree[n] ≥ K thenspillWorklist := spillWorklist ∪{n}else if MoveRelated(n) thenfreezeWorklist := freezeWorklist ∪{n}elsesimplifyWorklist := simplifyWorklist ∪{n}NodeMovesMoveRelatedMkWorklistprocedure Simplify()let n ∈ simplifyWorklistsimplifyWorklist := simplifyWorklist \{n}push(n, selectStack)forall m ∈ Adjacent(n)DecrementDegree(m)procedure DecrementDegree(m)let d = degree[m]degree[m] :=d-1if d = K thenEnableMoves({m} ∪Adjacent(m))spillWorklist := spillWorklist \{m}if MoveRelated(m) thenfreezeWorklist := freezeWorklist ∪{m}elsesimplifyWorklist := simplifyWorklist ∪{m}SimplifyDecrementDegreeRemoving a node from the graph involves decrementing the degree <strong>of</strong> its currentneighbors. If the degree is already less than K − 1 then the node must be moverelated and is not added to the simplifyWorklist. When the degree <strong>of</strong> a nodetransitions from K to K − 1, moves associated with its neighbors may be enabled.procedure EnableMoves(nodes)EnableMovesforall n ∈ nodesforall m ∈ NodeMoves(n)if m ∈ activeMoves thenactiveMoves := activeMoves \{m}worklistMoves := worklistMoves ∪{m}ACM Transactions on Programming Languages and Systems, Vol. 18, No. 3, May 1996, Pages 300-324.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!