Allocate the next available register of the given class, returning `None` if there are no more registers available.
(&mut self, class: RegClass)
| 85 | /// Allocate the next available register of the given class, |
| 86 | /// returning `None` if there are no more registers available. |
| 87 | pub fn reg_for_class(&mut self, class: RegClass) -> Option<Reg> { |
| 88 | self.available(class).then(|| { |
| 89 | let bitset = &self[class]; |
| 90 | let index = bitset.allocatable.trailing_zeros(); |
| 91 | self.allocate(class, index.into()); |
| 92 | Reg::from(class, index as usize) |
| 93 | }) |
| 94 | } |
| 95 | |
| 96 | /// Request a specific register. |
| 97 | pub fn reg(&mut self, reg: Reg) -> Option<Reg> { |