diff --git a/src/lib.rs b/src/lib.rs index c527f4c..13623f1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,7 +18,7 @@ mod scoped_map; pub use errors::*; pub use ir::*; -pub use ops::{Ieee32, Ieee64, Operator}; +pub use ops::{Ieee32, Ieee64, MemoryArg, Operator}; mod interp; pub use interp::*; diff --git a/src/op_traits.rs b/src/op_traits.rs index bda859f..8e6a887 100644 --- a/src/op_traits.rs +++ b/src/op_traits.rs @@ -641,6 +641,20 @@ impl Operator { pub fn is_pure(&self) -> bool { self.effects().is_empty() } + + pub fn is_call(&self) -> bool { + match self { + Operator::Call { .. } | Operator::CallIndirect { .. } => true, + _ => false, + } + } + + pub fn accesses_memory(&self) -> bool { + self.effects().iter().any(|e| match e { + SideEffect::ReadMem | SideEffect::WriteMem => true, + _ => false, + }) + } } impl std::fmt::Display for Operator {