use crate::id::{Rnid, Sid};
#[derive(Debug, Clone, strum::EnumString, strum::Display)]
#[strum(serialize_all = "lowercase")]
pub enum UniOpType {
Not,
Inc,
Dec,
Neg,
Redand,
Redor,
Redxor,
}
#[derive(Debug, Clone)]
pub struct UniOp {
pub sid: Sid,
pub ty: UniOpType,
pub a: Rnid,
}
#[derive(Debug, Clone, strum::EnumString, strum::Display)]
#[strum(serialize_all = "lowercase")]
pub enum BiOpType {
Iff,
Implies,
Eq,
Neq,
Sgt,
Ugt,
Sgte,
Ugte,
Slt,
Ult,
Slte,
Ulte,
And,
Nand,
Nor,
Or,
Xnor,
Xor,
Rol,
Ror,
Sll,
Sra,
Srl,
Add,
Mul,
Sdiv,
Udiv,
Smod,
Srem,
Urem,
Sub,
Saddo,
Uaddo,
Sdivo,
Udivo,
Smulo,
Umulo,
Ssubo,
Usubo,
Concat,
Read,
}
#[derive(Debug, Clone)]
pub struct BiOp {
pub sid: Sid,
pub ty: BiOpType,
pub a: Rnid,
pub b: Rnid,
}
#[derive(Debug, Clone, strum::EnumString, strum::Display)]
#[strum(serialize_all = "lowercase")]
pub enum TriOpType {
Ite,
Write,
}
#[derive(Debug, Clone)]
pub struct TriOp {
pub sid: Sid,
pub ty: TriOpType,
pub a: Rnid,
pub b: Rnid,
pub c: Rnid,
}
#[derive(Debug, Clone, strum::EnumString, strum::Display)]
#[strum(serialize_all = "lowercase")]
pub enum ExtOpType {
Sext,
Uext,
}
#[derive(Debug, Clone)]
pub struct ExtOp {
pub sid: Sid,
pub ty: ExtOpType,
pub a: Rnid,
pub length: u32,
}
#[derive(Debug, Clone)]
pub struct SliceOp {
pub sid: Sid,
pub a: Rnid,
pub upper_bit: u32,
pub lower_bit: u32,
}