Lecture10 - Register Allocation CSE 501 Lecture 10 April...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Register Allocation CSE 501 Lecture 10 April 29, 2009 Questions? About the last lecture? About the programming assignments? About the reading? Any critiques ready? Code Generation Recall our separation of concerns. Code generation is instruction selection register allocation instruction scheduling This time, we'll talk about register allocation. Registers Top of the memory hierarchy! regs log scale! TLB cache RAM disk 1/3 cycle 3 cycles Register Allocation As part of the overall design of his compiler, Backus suggested a simplifying separation of concerns: During optimization, assume an infinite set of registers; treat register allocation as a separate problem. Register allocation may be performed at many levels: Expression tree Local (basic block) Loop Global (routine) Interprocedural Global optimization suggests global register allocation. Interesting Problems Control fow Machine details 2-address instructions Calling conventions Register pairs Restricted instructions Finally, there are practical considerations: Space and time. Graph coloring oers a simpliying abstraction. Allocation via Coloring Despite C's register keyword, we don't allocate variables; instead we allocate live ranges. A value corresponds to a defnition A live range is composed oF one or more values connected by common uses. A single variable may be represented by many live ranges; Furthermore, many live ranges aren't visible in the source. We construct an interference graph, where Vertices represent live ranges Each edges represents an interference between 2 live ranges; i.e., both live ranges are simultaneously live and cannot occupy the same register. A k-coloring represents a register assignment. Live Ranges Consider the live ranges in this example: i = 1 j = i + 2 i = 3 + j j = 4 * i i = 5 * j return i Chaitin called the process of Fnding live ranges getting the right number of names . Others called it web analysis . I call it renumbering and implement it using SSA. Interference...
View Full Document

This note was uploaded on 02/09/2012 for the course CSE 403 taught by Professor Staff during the Spring '08 term at University of Washington.

Page1 / 37

Lecture10 - Register Allocation CSE 501 Lecture 10 April...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online