flâneur — a map of the web's best reading

5.5 Register Allocation

students.cs.ubc.ca · 5,733 words · saved by 1 readers

With Asm-lang v2, we introduced abstract locations to free the programmer from thinking about physical locations. Unfortunately, our implementation strategy has a severe limitation. While it’s simple and works, generates extremely slow code! Each and every variable assignment or reference accesses memory. While memory accesses have improved a lot compared to old computers due to caching, accessing memory are still orders of magnitude slower than accessing a register when our variable is not in the cache (and, in general, it won’t be in cache). Our compiler will have better performance if we help the machine out by using registers as much as possible. Assigning abstract locations to registers automatically is a non-trivial task. We started out by compiling to frame variables because there are infinitely many frame variables, but only 16 registers. Actually, fewer than 16, since the compiler and run-time system reserve some of those for various purposes. To assign an abstract location a

5.5 Register Allocation ► CPSC 411 2022w2 - Introduction to Compiler Construction 1 Syllabus 2 COVID Syllabus Addendum 3 Course Calendar 4 Course Project Logistics 5 Book 6 Project Milestones 7 CPSC 411 Infrastructure Package 8 Credits ▼ 5 Book 5.1 A Compiler Begins with a Language 5.2 Abstracting Boilerplate ( v1 ) 5.3 Abstract Locations 5.4 Value Orientation 5.5 Register Allocation 5.6 Structured Control Flow 5.7 Procedural Abstraction: Call 5.8 Procedural Abstraction: Return 5.9 Algebraic Expressions 5.10 Data types: Immediates 5.11 Data types: Structured Data and Heap Allocatio

Explore this link on the map →

related reading