MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / reg_for_class

Method reg_for_class

winch/codegen/src/regset.rs:87–94  ·  view source on GitHub ↗

Allocate the next available register of the given class, returning `None` if there are no more registers available.

(&mut self, class: RegClass)

Source from the content-addressed store, hash-verified

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> {

Callers 2

test_any_gprFunction · 0.45
test_free_regFunction · 0.45

Calls 4

fromFunction · 0.85
availableMethod · 0.80
trailing_zerosMethod · 0.80
allocateMethod · 0.45

Tested by 2

test_any_gprFunction · 0.36
test_free_regFunction · 0.36