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:
@@ -209,11 +209,7 @@ impl<'a, F: Function> Env<'a, F> {
|
||||
for vreg in 0..self.vregs.len() {
|
||||
let vreg = VRegIndex::new(vreg);
|
||||
|
||||
let pinned_alloc = if self.vregs[vreg.index()].is_pinned {
|
||||
self.func.is_pinned_vreg(self.vreg_regs[vreg.index()])
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let pinned_alloc = self.func.is_pinned_vreg(self.vreg_regs[vreg.index()]);
|
||||
|
||||
// For each range in each vreg, insert moves or
|
||||
// half-moves. We also scan over `blockparam_ins` and
|
||||
|
||||
Reference in New Issue
Block a user