Reset and compute a CFG post-order and dominator tree, using Semi-NCA algorithm, described in the paper: Linear-Time Algorithms for Dominators and Related Problems. Loukas Georgiadis, Princeton University, November 2005. The same algorithm is used by Julia, SpiderMonkey and LLVM, the implementation is heavily inspired by them.
(&mut self, func: &Function, cfg: &ControlFlowGraph)
| 348 | /// The same algorithm is used by Julia, SpiderMonkey and LLVM, |
| 349 | /// the implementation is heavily inspired by them. |
| 350 | pub fn compute(&mut self, func: &Function, cfg: &ControlFlowGraph) { |
| 351 | let _tt = timing::domtree(); |
| 352 | debug_assert!(cfg.is_valid()); |
| 353 | |
| 354 | self.clear(); |
| 355 | self.compute_spanning_tree(func); |
| 356 | self.compute_domtree(cfg); |
| 357 | self.compute_domtree_preorder(); |
| 358 | |
| 359 | self.valid = true; |
| 360 | } |
| 361 | |
| 362 | /// Clear the data structures used to represent the dominator tree. This will leave the tree in |
| 363 | /// a state where `is_valid()` returns false. |
no test coverage detected