Add some convenience bits to op_traits
, and export MemoryArg
.
This commit is contained in:
parent
21b2907e17
commit
9f4310f729
|
@ -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::*;
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue