Promote the BasicBlock tuple to a real struct;
It makes reading code that uses it easier to understand.
This commit is contained in:
committed by
Dan Gohman
parent
ce177d643e
commit
f72ff791b4
@@ -3,7 +3,7 @@
|
||||
use cursor::{Cursor, FuncCursor};
|
||||
use dominator_tree::DominatorTree;
|
||||
use entity::{EntityList, ListPool};
|
||||
use flowgraph::ControlFlowGraph;
|
||||
use flowgraph::{BasicBlock, ControlFlowGraph};
|
||||
use fx::FxHashSet;
|
||||
use ir::{DataFlowGraph, Ebb, Function, Inst, InstBuilder, Layout, Opcode, Type, Value};
|
||||
use loop_analysis::{Loop, LoopAnalysis};
|
||||
@@ -77,7 +77,10 @@ fn create_pre_header(
|
||||
for typ in header_args_types {
|
||||
pre_header_args_value.push(func.dfg.append_ebb_param(pre_header, typ), pool);
|
||||
}
|
||||
for (_, last_inst) in cfg.pred_iter(header) {
|
||||
for BasicBlock {
|
||||
inst: last_inst, ..
|
||||
} in cfg.pred_iter(header)
|
||||
{
|
||||
// We only follow normal edges (not the back edges)
|
||||
if !domtree.dominates(header, last_inst, &func.layout) {
|
||||
change_branch_jump_destination(last_inst, pre_header, func);
|
||||
@@ -106,7 +109,11 @@ fn has_pre_header(
|
||||
) -> Option<(Ebb, Inst)> {
|
||||
let mut result = None;
|
||||
let mut found = false;
|
||||
for (pred_ebb, last_inst) in cfg.pred_iter(header) {
|
||||
for BasicBlock {
|
||||
ebb: pred_ebb,
|
||||
inst: last_inst,
|
||||
} in cfg.pred_iter(header)
|
||||
{
|
||||
// We only count normal edges (not the back edges)
|
||||
if !domtree.dominates(header, last_inst, layout) {
|
||||
if found {
|
||||
|
||||
Reference in New Issue
Block a user