Previous: Register Allocation for Deferred Compilation Up: Register Allocation for Deferred Compilation Next: Run-Time Register Allocation
powgen: beq r1, r0, L1
sub r1, r1, 1
emit mul r2, r2, r1
jmp powgen
L1: emit move r1, r2
ret
The usual notion of lifetime ranges does not capture this distinction, since the staging being exploited is not explicit in the source program. For example, computations involving exp and base are textually adjacent but belong to different computation stages. Conventional register allocation algorithms may nonetheless be used for deferred compilation by simply modifying the construction of the interference graph. A standard lifetime analysis can be conducted without regard to the staging of the program, followed by an analysis that determines the program stage to which each variable belongs. During construction of the interference graph, edges are only added between overlapping lifetime ranges of variables from the same program stage.
