(func: &mut GenericFunction)
| 358 | } |
| 359 | |
| 360 | fn 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 | |
| 378 | impl GenericFunction { |
| 379 | /// Parses a textual representation of a [`Function`] into a |
no test coverage detected