Detects the loops in a function. Needs the control flow graph and the dominator tree.
(&mut self, func: &Function, cfg: &ControlFlowGraph, domtree: &DominatorTree)
| 162 | impl LoopAnalysis { |
| 163 | /// Detects the loops in a function. Needs the control flow graph and the dominator tree. |
| 164 | pub fn compute(&mut self, func: &Function, cfg: &ControlFlowGraph, domtree: &DominatorTree) { |
| 165 | let _tt = timing::loop_analysis(); |
| 166 | self.loops.clear(); |
| 167 | self.block_loop_map.clear(); |
| 168 | self.block_loop_map.resize(func.dfg.num_blocks()); |
| 169 | self.find_loop_headers(cfg, domtree); |
| 170 | self.discover_loop_blocks(cfg, domtree); |
| 171 | self.assign_loop_levels(); |
| 172 | self.valid = true; |
| 173 | } |
| 174 | |
| 175 | /// Check if the loop analysis is in a valid state. |
| 176 | /// |