Simplify pinned-vreg API: don't require slice of all pinned vregs. (#28)

Simplify pinned-vreg API: don't require slice of all pinned vregs.

Previously, we kept a bool flag `is_pinned` in the `VRegData`, and we
required a `&[VReg]` of all pinned vregs to be provided by
`Function::pinned_vregs()`. This was (I think) done for convenience, but
it turns out not to really be necessary, as we can just query
`is_pinned_vreg` where needed (and in the likely implementation, e.g. in
Cranelift, this will be a `< NUM_PINNED_VREGS` check that can be
inlined). This adds convenience for the embedder (the main benefit), and
also reduces complexity, removes some state, and avoids some work
initializing the regalloc state for a run.
This commit is contained in:
Chris Fallin
2022-03-04 15:12:16 -08:00
committed by GitHub
parent 14442df3fc
commit fe021ad6d4
5 changed files with 374 additions and 393 deletions

View File

@@ -981,11 +981,6 @@ pub trait Function {
None
}
/// Return a list of all pinned vregs.
fn pinned_vregs(&self) -> &[VReg] {
&[]
}
// --------------
// Spills/reloads
// --------------