Register Allocation - Iterated Register Coalescing

Iterated Register Coalescing

Register allocators have several types, with Iterated Register Coalescing (IRC) being a more common one. IRC was invented by LAL George and Andrew Appel in 1996, building off of earlier work by Gregory Chaitin. IRC works based on a few principles. First, if there are any non-move related vertices in the graph with degree less than K the graph can be simplified by removing those vertices, since once those vertices are added back in it is guaranteed that a color can be found for them (simplification). Second, two vertices sharing a preference edge whose adjacency sets combined have a degree less than K can be combined into a single vertex, by the same reasoning (coalescing). If neither of the two steps can simplify the graph, simplification can be run again on move-related vertices (freezing). Finally, if nothing else works, vertices can be marked for potential spilling and removed from the graph (spill). Since all of these steps reduce the degrees of vertices in the graph, vertices may transform from being high-degree (degree > K) to low-degree during the algorithm, enabling them to be simplified or coalesced. Thus, the stages of the algorithm are iterated to ensure aggressive simplification and coalescing. The pseudo-code is thus:

function IRC_color g K : repeat if ∃v s.t. !moveRelated(v) ∧ degree(v) < K then simplify v else if ∃e s.t. cardinality(neighbors(first v) ∪ neighbors(second v)) < K then coalesce e else if ∃v s.t. moveRelated(v) then deletePreferenceEdges v else if ∃v s.t. !precolored(v) then spill v else return loop

The coalescing done in IRC is conservative, because aggressive coalescing may introduce spills into the graph. However, additional coalescing heuristics such as George coalescing may coalesce more vertices while still ensuring that no additional spills are added. Work-lists are used in the algorithm to ensure that each iteration of IRC requires sub-quadratic time.

Read more about this topic:  Register Allocation

Famous quotes containing the words iterated and/or register:

    The customary cry,
    ‘Come buy, come buy,’
    With its iterated jingle
    Of sugar-bated words:
    Christina Georgina Rossetti (1830–1894)

    In 1872 I received a request like this and I did register and vote, for which I was arrested, convicted and fined $100. Excuse me if I decline to repeat the experience.
    Susan B. Anthony (1820–1906)