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

Method find_loop_headers

cranelift/codegen/src/loop_analysis.rs:203–212  ·  view source on GitHub ↗

Traverses the CFG in reverse postorder and create a loop object for every block having a back edge.

(&mut self, cfg: &ControlFlowGraph, domtree: &DominatorTree)

Source from the content-addressed store, hash-verified

201 // Traverses the CFG in reverse postorder and create a loop object for every block having a
202 // back edge.
203 fn find_loop_headers(&mut self, cfg: &ControlFlowGraph, domtree: &DominatorTree) {
204 for &block in domtree
205 .cfg_rpo()
206 .filter(|&&block| Self::is_block_loop_header(block, cfg, domtree))
207 {
208 // This block is a loop header, so we create its associated loop
209 let lp = self.loops.push(LoopData::new(block, None));
210 self.block_loop_map[block] = lp.into();
211 }
212 }
213
214 // Intended to be called after `find_loop_headers`. For each detected loop header,
215 // discovers all the block belonging to the loop and its inner loops. After a call to this

Callers 1

computeMethod · 0.80

Calls 3

cfg_rpoMethod · 0.80
newFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected