Skip to content

Commit 428e6a4

Browse files
committed
WIP: experiments with split heuristics
1 parent ea81422 commit 428e6a4

2 files changed

Lines changed: 244 additions & 146 deletions

File tree

src/cfg.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ pub struct CFGInfo {
4343
/// indices. Otherwise, it will be approximate, but should still
4444
/// be usable for heuristic purposes.
4545
pub approx_loop_depth: Vec<u32>,
46+
/// What are the loop-depth transition points?
47+
pub loop_transition_points: Vec<ProgPoint>,
4648
}
4749

4850
impl CFGInfo {
@@ -145,6 +147,15 @@ impl CFGInfo {
145147
}
146148
}
147149

150+
let mut loop_transition_points = vec![];
151+
let mut last_depth = approx_loop_depth[0];
152+
for (block, &depth) in approx_loop_depth.iter().enumerate() {
153+
if depth > last_depth {
154+
loop_transition_points.push(block_entry[block]);
155+
}
156+
last_depth = depth;
157+
}
158+
148159
Ok(CFGInfo {
149160
postorder,
150161
domtree,
@@ -155,6 +166,7 @@ impl CFGInfo {
155166
block_exit,
156167
pred_pos,
157168
approx_loop_depth,
169+
loop_transition_points,
158170
})
159171
}
160172

0 commit comments

Comments
 (0)