Contents    Page-10    Prev    Next    Page+10    Index   

Variable Uses and Register Assignment

A def-use chain is the connection between a definition of a variable and the subsequent use of that variable. When an expression is computed and is busy, the compiler can save its value. When an expression is needed and is available, the compiler can substitute the compiler variable representing its previously computed value.

Register allocation can be performed by graph coloring. A graph is formed in which nodes are def-use chains and (undirected) links are placed between nodes that share parts of the program flow graph.

A graph is colored by assigning ``colors'' to nodes such that no two nodes that are linked have the same color. Colors correspond to registers.