MCPcopy Create free account
hub / github.com/Amanieu/regalloc3 / compute_preds_and_dominators

Function compute_preds_and_dominators

src/debug_utils/generic_function/parse.rs:360–376  ·  view source on GitHub ↗
(func: &mut GenericFunction)

Source from the content-addressed store, hash-verified

358}
359
360fn compute_preds_and_dominators(func: &mut GenericFunction) {
361 let mut preds = SecondaryMap::<Block, Vec<Block>>::with_max_index(func.num_blocks());
362 for (block, data) in &func.blocks {
363 for &succ in &data.succs {
364 preds[succ].push(block);
365 }
366 }
367 for (block, preds) in &preds {
368 func.blocks[block].preds = preds.clone();
369 }
370 let postorder = PostOrder::for_function(func);
371 let mut dominator_tree = DominatorTree::new();
372 dominator_tree.compute(func, &postorder);
373 for (block, data) in &mut func.blocks {
374 data.immediate_dominator = dominator_tree.immediate_dominator(block).into();
375 }
376}
377
378impl GenericFunction {
379 /// Parses a textual representation of a [`Function`] into a

Callers 1

parseMethod · 0.85

Calls 5

pushMethod · 0.80
cloneMethod · 0.80
immediate_dominatorMethod · 0.80
num_blocksMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected