Loop analysis of the IL

* Implemented in two passes
* First pass discovers the loops headers (they dominate one of their predecessors)
* Second pass traverses the blocks of each loop
* Discovers the loop tree structure
* Offers a new LoopAnalysis data structure queried from outside the module
This commit is contained in:
Denis Merigoux
2017-06-02 15:00:29 -07:00
committed by Jakob Stoklund Olesen
parent 4f26764e71
commit b02ccea8dc
6 changed files with 360 additions and 5 deletions

View File

@@ -12,6 +12,7 @@
use dominator_tree::DominatorTree;
use flowgraph::ControlFlowGraph;
use ir::Function;
use loop_analysis::LoopAnalysis;
use isa::TargetIsa;
use legalize_function;
use regalloc;
@@ -32,6 +33,9 @@ pub struct Context {
/// Register allocation context.
pub regalloc: regalloc::Context,
/// Loop analysis of `func`.
pub loop_analysis: LoopAnalysis,
}
impl Context {
@@ -45,6 +49,7 @@ impl Context {
cfg: ControlFlowGraph::new(),
domtree: DominatorTree::new(),
regalloc: regalloc::Context::new(),
loop_analysis: LoopAnalysis::new(),
}
}