use crate::ir::{Const16, Const32, Slot};
macro_rules! bail_unreachable {
($this:ident) => {{
if !$this.reachable {
return ::core::result::Result::Ok(());
}
}};
}
macro_rules! swap_ops {
($make_instr:path) => {{
|result: $crate::ir::Slot, lhs, rhs| -> $crate::ir::Op { $make_instr(result, rhs, lhs) }
}};
}
pub trait Reset: Sized {
fn reset(&mut self);
#[must_use]
fn into_reset(self) -> Self {
let mut this = self;
this.reset();
this
}
}
pub trait ReusableAllocations {
type Allocations: Default + Reset;
fn into_allocations(self) -> Self::Allocations;
}
pub type Input16<T> = Input<Const16<T>>;
pub type Input32<T> = Input<Const32<T>>;
pub enum Input<T> {
Slot(Slot),
Immediate(T),
}