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

Method find_reachable_blocks

cranelift/codegen/src/egraph/mod.rs:955–968  ·  view source on GitHub ↗

Find the set of blocks reachable from the entry block by traversing the current CFG. Must be called after branch simplification and the CFG has been recomputed to reflect post-optimization control flow.

(&self)

Source from the content-addressed store, hash-verified

953 /// Must be called after branch simplification and the CFG has been
954 /// recomputed to reflect post-optimization control flow.
955 fn find_reachable_blocks(&self) -> EntitySet<Block> {
956 let mut reachable = EntitySet::<Block>::with_capacity(self.func.dfg.num_blocks());
957 let entry = self.func.layout.entry_block().unwrap();
958 let mut stack = vec![entry];
959 reachable.insert(entry);
960 while let Some(block) = stack.pop() {
961 for successor in self.cfg.succ_iter(block) {
962 if reachable.insert(successor) {
963 stack.push(successor);
964 }
965 }
966 }
967 reachable
968 }
969
970 /// Execute a simplification of an instruction in the side-effectful
971 /// skeleton.

Callers 1

runMethod · 0.80

Calls 7

succ_iterMethod · 0.80
num_blocksMethod · 0.45
unwrapMethod · 0.45
entry_blockMethod · 0.45
insertMethod · 0.45
popMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected