This commit is contained in:
Nilton Constantino
2026-01-29 17:00:27 +00:00
parent c34166435f
commit fe00eda925
11 changed files with 140 additions and 125 deletions
@@ -14,3 +14,8 @@ pub struct ConstId(pub u32);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct TypeId(pub u32);
/// Unique identifier for a value (usually a local slot).
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ValueId(pub u32);
@@ -1,5 +1,5 @@
use serde::{Deserialize, Serialize};
use super::ids::{ConstId, FunctionId};
use super::ids::{ConstId, FunctionId, TypeId, ValueId};
/// Instructions within a basic block.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
@@ -33,8 +33,12 @@ pub enum Instr {
Or,
Not,
/// HIP operations.
Alloc,
Free, // Not used in v0 but good to have in Core IR
ReadGate,
WriteGate,
Alloc { ty: TypeId, slots: u32 },
BeginPeek { gate: ValueId },
BeginBorrow { gate: ValueId },
BeginMutate { gate: ValueId },
EndPeek,
EndBorrow,
EndMutate,
Free,
}