use serde::{Deserialize, Serialize}; use super::ids::{ConstId, FunctionId, TypeId, ValueId}; /// Instructions within a basic block. #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub enum Instr { /// Placeholder for constant loading. PushConst(ConstId), /// Placeholder for function calls. Call(FunctionId, u32), /// Host calls (syscalls). HostCall(u32), /// Variable access. GetLocal(u32), SetLocal(u32), /// Stack operations. Pop, Dup, /// Arithmetic. Add, Sub, Mul, Div, Neg, /// Logical/Comparison. Eq, Neq, Lt, Lte, Gt, Gte, And, Or, Not, /// HIP operations. Alloc { ty: TypeId, slots: u32 }, BeginPeek { gate: ValueId }, BeginBorrow { gate: ValueId }, BeginMutate { gate: ValueId }, EndPeek, EndBorrow, EndMutate, /// Reads from heap at reference + offset. Pops reference, pushes value. LoadRef(u32), /// Writes to heap at reference + offset. Pops reference and value. StoreRef(u32), Free, }