Tidy up calls to analyze_branch.
This commit is contained in:
@@ -340,7 +340,7 @@ impl DominatorTree {
|
|||||||
/// post-order except for the insertion of the new EBB header at the split point.
|
/// post-order except for the insertion of the new EBB header at the split point.
|
||||||
fn push_successors(&mut self, func: &Function, ebb: Ebb) {
|
fn push_successors(&mut self, func: &Function, ebb: Ebb) {
|
||||||
for inst in func.layout.ebb_insts(ebb) {
|
for inst in func.layout.ebb_insts(ebb) {
|
||||||
match func.dfg[inst].analyze_branch(&func.dfg.value_lists) {
|
match func.dfg.analyze_branch(inst) {
|
||||||
BranchInfo::SingleDest(succ, _) => {
|
BranchInfo::SingleDest(succ, _) => {
|
||||||
if self.nodes[succ].rpo_number == 0 {
|
if self.nodes[succ].rpo_number == 0 {
|
||||||
self.nodes[succ].rpo_number = SEEN;
|
self.nodes[succ].rpo_number = SEEN;
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ impl ControlFlowGraph {
|
|||||||
|
|
||||||
fn compute_ebb(&mut self, func: &Function, ebb: Ebb) {
|
fn compute_ebb(&mut self, func: &Function, ebb: Ebb) {
|
||||||
for inst in func.layout.ebb_insts(ebb) {
|
for inst in func.layout.ebb_insts(ebb) {
|
||||||
match func.dfg[inst].analyze_branch(&func.dfg.value_lists) {
|
match func.dfg.analyze_branch(inst) {
|
||||||
BranchInfo::SingleDest(dest, _) => {
|
BranchInfo::SingleDest(dest, _) => {
|
||||||
self.add_edge((ebb, inst), dest);
|
self.add_edge((ebb, inst), dest);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -908,7 +908,7 @@ impl<'a> Context<'a> {
|
|||||||
|
|
||||||
let inst = self.cur.current_inst().expect("Not on an instruction");
|
let inst = self.cur.current_inst().expect("Not on an instruction");
|
||||||
let ctx = self.liveness.context(&self.cur.func.layout);
|
let ctx = self.liveness.context(&self.cur.func.layout);
|
||||||
match self.cur.func.dfg[inst].analyze_branch(&self.cur.func.dfg.value_lists) {
|
match self.cur.func.dfg.analyze_branch(inst) {
|
||||||
NotABranch => false,
|
NotABranch => false,
|
||||||
SingleDest(ebb, _) => {
|
SingleDest(ebb, _) => {
|
||||||
let lr = &self.liveness[value];
|
let lr = &self.liveness[value];
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ impl LiveValueTracker {
|
|||||||
) -> (&[LiveValue], &[LiveValue], &[LiveValue]) {
|
) -> (&[LiveValue], &[LiveValue], &[LiveValue]) {
|
||||||
// Save a copy of the live values before any branches or jumps that could be somebody's
|
// Save a copy of the live values before any branches or jumps that could be somebody's
|
||||||
// immediate dominator.
|
// immediate dominator.
|
||||||
match dfg[inst].analyze_branch(&dfg.value_lists) {
|
match dfg.analyze_branch(inst) {
|
||||||
BranchInfo::NotABranch => {}
|
BranchInfo::NotABranch => {}
|
||||||
_ => self.save_idom_live_set(inst),
|
_ => self.save_idom_live_set(inst),
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ impl<'a> LocationVerifier<'a> {
|
|||||||
};
|
};
|
||||||
let dfg = &self.func.dfg;
|
let dfg = &self.func.dfg;
|
||||||
|
|
||||||
match dfg[inst].analyze_branch(&dfg.value_lists) {
|
match dfg.analyze_branch(inst) {
|
||||||
NotABranch => {
|
NotABranch => {
|
||||||
panic!(
|
panic!(
|
||||||
"No branch information for {}",
|
"No branch information for {}",
|
||||||
|
|||||||
@@ -693,7 +693,7 @@ impl<'a> Verifier<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn typecheck_variable_args(&self, inst: Inst) -> Result {
|
fn typecheck_variable_args(&self, inst: Inst) -> Result {
|
||||||
match self.func.dfg[inst].analyze_branch(&self.func.dfg.value_lists) {
|
match self.func.dfg.analyze_branch(inst) {
|
||||||
BranchInfo::SingleDest(ebb, _) => {
|
BranchInfo::SingleDest(ebb, _) => {
|
||||||
let iter = self.func.dfg.ebb_params(ebb).iter().map(|&v| {
|
let iter = self.func.dfg.ebb_params(ebb).iter().map(|&v| {
|
||||||
self.func.dfg.value_type(v)
|
self.func.dfg.value_type(v)
|
||||||
|
|||||||
@@ -620,7 +620,7 @@ where
|
|||||||
val: Value,
|
val: Value,
|
||||||
var: Variable,
|
var: Variable,
|
||||||
) -> Option<(Ebb, Block, Inst)> {
|
) -> Option<(Ebb, Block, Inst)> {
|
||||||
match func.dfg[jump_inst].analyze_branch(&func.dfg.value_lists) {
|
match func.dfg.analyze_branch(jump_inst) {
|
||||||
BranchInfo::NotABranch => {
|
BranchInfo::NotABranch => {
|
||||||
panic!("you have declared a non-branch instruction as a predecessor to an ebb");
|
panic!("you have declared a non-branch instruction as a predecessor to an ebb");
|
||||||
}
|
}
|
||||||
@@ -855,7 +855,7 @@ mod tests {
|
|||||||
cur.ins().iadd(x_use3, y_use3)
|
cur.ins().iadd(x_use3, y_use3)
|
||||||
};
|
};
|
||||||
ssa.def_var(y_var, y2_ssa, block2);
|
ssa.def_var(y_var, y2_ssa, block2);
|
||||||
match func.dfg[jump_inst].analyze_branch(&func.dfg.value_lists) {
|
match func.dfg.analyze_branch(jump_inst) {
|
||||||
BranchInfo::SingleDest(dest, jump_args) => {
|
BranchInfo::SingleDest(dest, jump_args) => {
|
||||||
assert_eq!(dest, ebb1);
|
assert_eq!(dest, ebb1);
|
||||||
assert_eq!(jump_args.len(), 0);
|
assert_eq!(jump_args.len(), 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user