l6-handout

# l6-handout - Lecture 6 Register Allocation I. Introduction...

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

1 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 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

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

View Full Document
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 Example M. Lam CS243: Register Allocation 4 B = … = A D = = B + D L1: C = … = A D = = C + D A = … IF A goto L1
3 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 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 preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This document was uploaded on 03/12/2012.

### Page1 / 9

l6-handout - Lecture 6 Register Allocation I. Introduction...

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

View Full Document
Ask a homework question - tutors are online