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

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 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
Background image of page 3

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

View Full DocumentRight Arrow Icon
Example M. Lam CS243: Register Allocation 4 B = … = A D = = B + D L1: C = … = A D = = C + D A = … IF A goto L1
Background image of page 4
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
Background image of page 5

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

View Full DocumentRight Arrow Icon
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.
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 18

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 Right Arrow Icon
Ask a homework question - tutors are online