Struct regalloc2::moves::ParallelMoves
source · pub struct ParallelMoves<T: Clone + Copy + Default> { /* private fields */ }
Expand description
A ParallelMoves
represents a list of alloc-to-alloc moves that
must happen in parallel – i.e., all reads of sources semantically
happen before all writes of destinations, and destinations are
allowed to overwrite sources. It can compute a list of sequential
moves that will produce the equivalent data movement, possibly
using a scratch register if one is necessary.
Implementations§
source§impl<T: Clone + Copy + Default + PartialEq> ParallelMoves<T>
impl<T: Clone + Copy + Default + PartialEq> ParallelMoves<T>
pub fn new() -> Self
pub fn add(&mut self, from: Allocation, to: Allocation, t: T)
sourcepub fn resolve(self) -> MoveVecWithScratch<T>
pub fn resolve(self) -> MoveVecWithScratch<T>
Resolve the parallel-moves problem to a sequence of separate
moves, such that the combined effect of the sequential moves
is as-if all of the moves added to this ParallelMoves
resolver happened in parallel.
Sometimes, if there is a cycle, a scratch register is
necessary to allow the moves to occur sequentially. In this
case, Allocation::none()
is returned to represent the
scratch register. The caller may choose to always hold a
separate scratch register unused to allow this to be trivially
rewritten; or may dynamically search for or create a free
register as needed, if none are available.