5.5 Register Allocation
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
- 5.3 Abstract Locationsstudents.cs.ubc.ca
- Building a Performant Compiler from Scratch — Bowen Chengbowencheng.dev
- A Gentle Introduction to LLVM IR · mcyoungmcyoung.xyz
- Understanding static single assignment formsblog.yossarian.net
- how I think when I think about programming - alice mazalicemaz.com
- abseil / Performance Hintsabseil.io
- Destroy All Values: Designing Deinitialization in Programming Languages - Faultloregankra.github.io
- Compiler Optimizations Are Hard Because They Forget - Faultlorefaultlore.com
- Write your Own Virtual Machinejmeiners.com
- What is Ownership? - The Rust Programming Languagedoc.rust-lang.org
- Zenbleedlock.cmpxchg8b.com
- A Gentle Introduction to LLVM IR · mcyoungmcyoung.xyz