Maybe construct from a `regalloc2::VReg`, checking if the index is in-range for our bit-packing.
(vreg: regalloc2::VReg)
| 70 | /// Maybe construct from a `regalloc2::VReg`, checking if the |
| 71 | /// index is in-range for our bit-packing. |
| 72 | pub fn from_virtual_reg_checked(vreg: regalloc2::VReg) -> Option<Reg> { |
| 73 | let bits = vreg.bits() as u32; |
| 74 | if bits <= REG_SPILLSLOT_MASK { |
| 75 | Some(Reg(bits)) |
| 76 | } else { |
| 77 | None |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | /// Get the physical register (`RealReg`), if this register is |
| 82 | /// one. |