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

Method assign_loop_levels

cranelift/codegen/src/loop_analysis.rs:281–301  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

279 }
280
281 fn assign_loop_levels(&mut self) {
282 let mut stack: SmallVec<[Loop; 8]> = SmallVec::new();
283 for lp in self.loops.keys() {
284 if self.loops[lp].level == LoopLevel::invalid() {
285 stack.push(lp);
286 while let Some(&lp) = stack.last() {
287 if let Some(parent) = self.loops[lp].parent.into() {
288 if self.loops[parent].level != LoopLevel::invalid() {
289 self.loops[lp].level = self.loops[parent].level.inc();
290 stack.pop();
291 } else {
292 stack.push(parent);
293 }
294 } else {
295 self.loops[lp].level = LoopLevel::root().inc();
296 stack.pop();
297 }
298 }
299 }
300 }
301 }
302}
303
304#[cfg(test)]

Callers 1

computeMethod · 0.80

Calls 6

newFunction · 0.50
keysMethod · 0.45
pushMethod · 0.45
lastMethod · 0.45
incMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected