This repository has been archived on 2026-09-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
OxideJS/crates/oxide_ir/src/operand.rs
T
2026-08-05 19:34:44 +08:00

23 lines
720 B
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//! 类型安全操作数。IR 中不出现裸寄存器下标。
//!
//! - `Reg(u32)`:寄存器。本阶段存物理号(≤253);254/255 为 VM 保留,语义由 `This`/`NewTarget` 表达
//! - `Const(u16)`:常量池下标
//! - `Label(u32)`:跳转目标(`LabelId`)
//! - `Imm(u16)`:立即数
//! - `This` / `NewTarget`:语义化特殊寄存器,由 lowering 映射物理 254/255(IR 中禁止裸下标)
//! - `None`:操作数槽未使用
/// 统一跳转目标标识(取代语义化 `Label` 枚举)。
pub type LabelId = u32;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Operand {
Reg(u32),
Const(u16),
Label(u32),
Imm(u16),
This,
NewTarget,
None,
}