Most of the time, register coloring is almost trivial: just pick available registers for the values defined by the current instruction. However, some instructions have register operand constraints, and it may be necessary to move live registers around to satisfy the constraints. Sometimes the instruction's own operands can interfere with each other in a way that you can't just pick a register assignment for each output in order. This is complicated enough that it is worthwhile to represent as a constraint satisfaction problem in a separate solver module. The representation is chosen to be very fast in the common case where the constraints are trivial to solve. The current implementation is still incomplete, but as functional as the code it's replacing. Missing features: - Handle tied operand constraints. - Handle ABI constraints on calls and return instructions. - Execute a constraint solution by emitting regmove instructions. - Handling register diversions before leaving the EBB.
19 lines
399 B
Rust
19 lines
399 B
Rust
//! Register allocation.
|
|
//!
|
|
//! This module contains data structures and algorithms used for register allocation.
|
|
|
|
pub mod liverange;
|
|
pub mod liveness;
|
|
pub mod allocatable_set;
|
|
pub mod live_value_tracker;
|
|
pub mod coloring;
|
|
|
|
mod affinity;
|
|
mod context;
|
|
mod diversion;
|
|
mod solver;
|
|
|
|
pub use self::allocatable_set::AllocatableSet;
|
|
pub use self::context::Context;
|
|
pub use self::diversion::RegDiversions;
|