From 3750e0b5709a28229856e03c537523a348fee93a Mon Sep 17 00:00:00 2001 From: Chris Fallin Date: Thu, 2 Dec 2021 23:34:57 -0800 Subject: [PATCH] WIP. --- src/ir.rs | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/src/ir.rs b/src/ir.rs index ea21a5f..2dff0c2 100644 --- a/src/ir.rs +++ b/src/ir.rs @@ -166,39 +166,27 @@ pub enum ValueDef { impl ValueDef { pub fn visit_uses(&self, mut f: F) { match self { - &ValueDef::Parameter { .. } => {} + &ValueDef::Arg { .. } => {} + &ValueDef::BlockParam { .. } => {} &ValueDef::Operator { ref args, .. } => { for &arg in args { f(arg); } } &ValueDef::PickOutput { from, .. } => f(from), - &ValueDef::Phi { ref inputs, .. } => { - for &input in inputs { - f(input); - } - } - &ValueDef::LocalGet { .. } => {} - &ValueDef::LocalSet { value, .. } => f(value), } } pub fn update_uses(&mut self, mut f: F) { match self { - &mut ValueDef::Parameter { .. } => {} + &mut ValueDef::Arg { .. } => {} + &mut ValueDef::BlockParam { .. } => {} &mut ValueDef::Operator { ref mut args, .. } => { - for &mut arg in args { + for arg in args { f(arg); } } &mut ValueDef::PickOutput { ref mut from, .. } => f(from), - &mut ValueDef::Phi { ref mut inputs, .. } => { - for &mut input in inputs { - f(input); - } - } - &mut ValueDef::LocalGet { .. } => {} - &mut ValueDef::LocalSet { ref mut value, .. } => f(value), } } } @@ -234,12 +222,12 @@ impl Terminator { pub fn visit_successors(&self, mut f: F) { match self { Terminator::Return { .. } => {} - Terminator::Br { target, .. } => f(target), + Terminator::Br { target, .. } => f(*target), Terminator::CondBr { if_true, if_false, .. } => { - f(if_true); - f(if_false); + f(*if_true); + f(*if_false); } Terminator::Select { ref targets, @@ -249,7 +237,7 @@ impl Terminator { for &target in targets { f(target); } - f(default); + f(*default); } Terminator::None => {} }