l6 (1)

# l6 (1) - Lecture 6 Register Allocation I. Introduction II....

This preview shows pages 1–7. Sign up to view the full content.

Lecture 6 Register Allocation I. Introduction II. Abstraction and the Problem III. Algorithm Reading: Chapter 8.8.4 Before next class: Chapter 10.1 - 10.2 M. Lam CS243: Register Allocation 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
I. Motivation Problem Allocation of variables (pseudo-registers) to hardware registers in a procedure Perhaps the most important optimization Directly reduces running time (memory access register access) Useful for other optimizations e.g. cse assumes old values are kept in registers. M. Lam CS243: Register Allocation 2
Goal Find an assignment for all pseudo-registers, if possible. If there are not enough registers in the machine, choose registers to spill to memory M. Lam CS243: Register Allocation 3

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Example M. Lam CS243: Register Allocation 4 B = … = A D = = B + D L1: C = … = A D = = C + D A = … IF A goto L1
II. An Abstraction for Allocation & Assignment Intuitively Two pseudo-registers interfere if at some point in the program they cannot both occupy the same register. Interference graph : an undirected graph, where nodes = pseudo-registers there is an edge between two nodes if their corresponding pseudo-registers interfere What is not represented Extent of the interference between uses of different variables Where in the program is the interference M. Lam CS243: Register Allocation 5

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Register Allocation and Coloring A graph is n-colorable if: every node in the graph can be colored with one of the n colors such that two adjacent nodes do not have the same color.
This is the end of the preview. Sign up to access the rest of the document.

## l6 (1) - Lecture 6 Register Allocation I. Introduction II....

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online