Repository navigation
Register Allocation 12 glossary
Mugundan edited this page Nov 27, 2026
·
1 revision
Relevant source files
The following files were used as context for generating this wiki page:
A reference page. Terms are in alphabetical order.
| Term | Meaning | Page |
|---|---|---|
| Allocation order | The order in which an allocator tries physical registers for a class: hints first, then the class order with reserved registers removed and callee-saved registers last | Framework |
| AllocationPriority | TableGen field (0–31) that pushes a register class earlier in Greedy's queue | TableGen |
| Callee-saved register | Preserved across calls; a function that uses it must save and restore it | Registers |
| Caller-saved (clobbered) register | Destroyed by calls; values live across a call cannot stay in one | Registers |
| Cascade number | Greedy's counter that prevents eviction loops | Greedy |
| Coalescing | Merging the source and destination of a COPY into one register so the copy disappears |
Coalescer |
| Complement | Interval 0 in SplitEditor: everything not given to a new split interval |
Splitting |
| Copy hint | A preferred register derived from a copy to or from it | Spill weights |
| Early-clobber | A definition that is written before the instruction's uses are read, so it cannot share a register with them | Liveness |
| Edge bundle | A set of block boundaries that must agree on register-or-memory for a value; used by region splitting | Splitting |
| Eviction | Unassigning a lower-priority interval so the current one can take its register; the evicted interval is requeued | Greedy |
| Frame index | Abstract stack slot number (%stack.N) replaced by an address in prologue/epilogue insertion |
Rewriting |
| Identity copy |
$r = COPY $r; deleted by the rewriter |
Rewriting |
| Interference | Two registers live at the same point with different values; they cannot share a physical register | Liveness |
| Lane mask | Bit set describing which parts of a register a sub-register index covers | Registers |
| Live interval |
LiveInterval: the set of program points where a virtual register is live, as segments plus value numbers |
Liveness |
| LiveRegMatrix | Per-register-unit record of which virtual registers are assigned where; answers interference queries | Framework |
| Local interval | An interval contained in one basic block | Greedy |
| MIR | Machine IR: MachineInstrs in MachineBasicBlocks |
Overview |
| PHI-def | A value number defined at a block start where several incoming values merge | Liveness |
| Physical register | A real hardware register ($w0) |
Registers |
| Region split | Greedy split that keeps a value in one register over a set of blocks | Splitting |
| Register class | Set of interchangeable physical registers a virtual register may use | Registers |
| Register mask (regmask) | Call operand listing preserved registers; all others are clobbered | Registers |
| Register scavenger | Finds a free physical register after allocation, spilling to an emergency slot if needed | TRI hooks |
| Register unit | Smallest piece of register state never shared in part; physical liveness and interference are tracked per unit | Registers |
| Rematerialisation | Recomputing a cheap value instead of storing and reloading it | Inline spiller |
| Reserved register | Never allocated (sp, wzr, frame pointer when used, ...) |
TRI hooks |
| Rewriter |
VirtRegRewriter: replaces virtual registers with their assigned physical registers |
Rewriting |
| Slot index | Position number of an instruction; four slots per instruction (B, e, r, d), 16 apart | Liveness |
| Snippet | A tiny split piece connected only by copies, spilled together with its sibling | Inline spiller |
| Spill | Keeping a value in a stack slot, with a store after each definition and a load before each use | Spilling |
| Spill weight | Estimated cost of spilling an interval: weighted uses divided by length | Spill weights |
| Split | Cutting an interval into pieces joined by copies | Splitting |
| Stage | Greedy's per-interval progress: RS_New, RS_Assign, RS_Split, RS_Split2, RS_Spill, RS_Done
|
Greedy |
| Sub-register | Named part of a register (sub_32 of x0 is w0) |
Registers |
| Tied operand | A use that must be in the same register as a definition; handled by two-address lowering | Two-address |
| Value number |
VNInfo: one definition of a register; lets liveness distinguish values |
Liveness |
| Virtual register | Unlimited register name created by instruction selection (%5) |
Registers |
| VirtRegMap | Records the physical register or stack slot chosen for each virtual register | Framework |
| Question | Look at |
|---|---|
| Which passes run around allocation, and in what order? |
TargetPassConfig::addOptimizedRegAlloc, addFastRegAlloc (Pipeline) |
Why does this value use w19 instead of w8? |
It is live across a call; regmask on the call (Walkthrough 2) |
| Why is a copy still there after allocation? | Coalescer output, then hints (Tooling) |
| Why was this spilled? |
-pass-remarks-missed=regalloc, then -stop-after=virtregrewriter (Tooling) |
Why are these stp/ldp at entry? |
Callee-saved saves from prologue insertion, not spills (Spilling) |
| How does Greedy decide what to do? |
RAGreedy::selectOrSplitImpl (Greedy) |
| How is spill code inserted? |
InlineSpiller::spillAroundUses and your storeRegToStackSlot (Inline spiller) |
| What must my new backend implement? | Custom backend and its checklist |
| "ran out of registers" | Operand constraints, reserved set, class sizes (Checklist) |
Target didn't implement ... |
The named TargetInstrInfo hook (TII hooks) |
| Liveness verifier errors after my pass | Update LiveIntervals (Liveness) |
- Computer Architecture Overview
- Fundamentals: CPU, Memory and Instructions
- Pipelining
- Branches and Remedies
- Instruction-Level Parallelism
- Memory and Ordering
- Caches and Coherence
- Multicore
- Multithreading in Hardware
- SIMD and GPUs
- Glossary and Summary
- Hexagon Overview and Processor Properties
- ISA Fundamentals: Packets, Slots and Threads
- Registers
- Instruction Encoding and Mnemonics
- Data, Memory and Control Instructions
- Floating Point, HVX and Alignment
- Caches, MMU and Glossary
- Operating Systems Overview
- Processes
- Threads
- CPU Scheduling
- Synchronization
- Deadlock
- Memory Management
- Virtual Memory
- Files, Storage and I/O
- Kernel and System Calls
- Interview Q&A and Glossary
- C++ for LLVM Development: Overview
- C++ Basics
- Classes and RAII
- Ownership and Move Semantics
- Templates and Lambdas
- LLVM Data Structures (ADT)
- LLVM-Style RTTI: isa, cast, dyn_cast
- Errors, Output and Assertions
- Iterators and Ranges
- Building, Debugging and Exercises
- LLVM IR Overview
- Structure: Modules, Functions, Blocks and Values
- Type System
- Arithmetic, Bitwise and Cast Instructions
- Compare and Select
- Memory: alloca, load, store and getelementptr
- Control Flow: br, switch, ret and call
- SSA and Phi
- Control Flow Graph and Loops
- Dominance, Dominator Tree and Dominance Frontier
- Data-flow Analysis
- Writing an IR Pass
- Common Passes
- Exercises, Tooling and Glossary
- SelectionDAG Overview
- Pipeline, Phases and Traversal Orders
- Core Data Structures
- DAG Construction
- DAG Combiner
- Legalization
- Type Legalization
- Operation and Vector Legalization
- Instruction Selection
- TableGen Pattern Language
- Matcher Interpreter and Folding
- AArch64 Instruction Selection
- Scheduling and MIR Emission
- PHI Node Resolution
- AArch64 Walkthroughs
- Arithmetic and Data Movement
- Memory Instructions
- Control Flow and Calls
- End-to-End Example
- Tooling, Debugging and Extending
- Selector Comparison and Glossary
- Assignments: Build the Toy Backend
- Stage 1: Build Setup
- Stage 2: Target Registration
- Stage 3: TableGen Skeleton
- Stage 4: MC Layer for Assembly Output
- Stage 5: TargetMachine and Subtarget
- Stage 6: TargetLowering, Arguments and Returns
- Stage 7: Instruction Selection and the First Function
- Stage 8: Registers, Copies and Spills
- Stage 9: Frame Lowering
- Stage 10: Memory, Globals and Control Flow
- Stage 11: Calls
- Stage 12: Scheduling Model
- Stage 13: Object Files
- Stage 14: Capstone, a Complete Toy Backend
- Target Bring-up Overview
- Directory Layout, CMake and Registration
- The Target .td File
- TargetMachine and Subtarget
- TargetLowering Setup
- Calling Conventions
- Instructions and Instruction Selection
- Registers and Allocation Hooks
- Frame Lowering
- AsmPrinter and the MC Layer
- Scheduling
- A Minimal Toy Target
- Bring-up Checklist and AArch64 File Map
- Tooling and Glossary
- Calling Conventions Overview
- The CallingConv.td Language
- CCState and CCValAssign
- LowerFormalArguments
- LowerCall
- LowerReturn and CanLowerReturn
- Varargs, byval, sret and swifterror
- Tail Calls and Sibling Calls
- Custom Backend Guide and Checklist
- AArch64 Walkthroughs
- Tooling and Glossary
- Frame Lowering Overview
- MachineFrameInfo
- TargetFrameLowering Hooks
- The PEI Pass
- Callee-Saved Registers and Stack Layout
- Frame Index Elimination and the Register Scavenger
- Shrink Wrapping
- CFI and Unwind Information
- Custom Backend Guide and Checklist
- AArch64 Walkthroughs
- Tooling and Glossary
- MC Layer Overview
- Core Data Structures
- Streamers
- Assembler and Layout
- Fixups and Relocations
- Writing an MC Layer for a Custom Backend
- MCAsmInfo and the Instruction Printer
- Code Emitter
- AsmBackend and Object Writer
- Assembly Parser and Disassembler
- Bring-up Checklist and Common Failures
- Tooling and Glossary
- Register Allocation Overview
- The Register Allocation Pipeline
- Registers, Virtual Registers and Register Classes
- Liveness: Slot Indexes and Live Intervals
- Preparing Code for Allocation
- PHI Elimination and Two-Address Lowering
- Register Coalescer
- Allocation Framework
- The Register Allocators
- Fast Register Allocator
- Basic Register Allocator
- Greedy Register Allocator
- PBQP Register Allocator
- Spilling and Splitting
- Spill Weights and Copy Hints
- The Inline Spiller
- Live Range Splitting
- Rewriting and Post-RA Passes
- Writing Register Allocation Support for a Custom Backend
- Register Definitions in TableGen
- TargetRegisterInfo Hooks
- TargetInstrInfo Hooks
- Pass Pipeline Hooks
- Bring-up Checklist and Common Failures
- AArch64 Walkthroughs
- Tooling and Debugging
- Glossary and Where Do I Look