stak_code/ir/
operand.rs

1use core::fmt::{self, Display, Formatter};
2
3/// An instruction operand.
4#[derive(Clone, Copy, Debug, Eq, PartialEq)]
5pub enum Operand {
6    /// A symbol operand.
7    Symbol(u64),
8    /// An integer operand.
9    Integer(u64),
10}
11
12impl Display for Operand {
13    fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
14        match self {
15            Self::Symbol(index) => write!(formatter, "s{index}"),
16            Self::Integer(integer) => write!(formatter, "i{integer}"),
17        }
18    }
19}