pub enum NnilInstruction {
Show 38 variants
Add {
lhs: Insn,
rhs: Insn,
},
Sub {
lhs: Insn,
rhs: Insn,
},
Mul {
lhs: Insn,
rhs: Insn,
},
Mulh {
lhs: Insn,
rhs: Insn,
},
Div {
lhs: Insn,
rhs: Insn,
},
Mod {
lhs: Insn,
rhs: Insn,
},
Fdiv {
lhs: Insn,
rhs: Insn,
size: usize,
},
And {
lhs: Insn,
rhs: Insn,
},
Or {
lhs: Insn,
rhs: Insn,
},
Xor {
lhs: Insn,
rhs: Insn,
},
Sll {
lhs: Insn,
rhs: Insn,
},
Srl {
lhs: Insn,
rhs: Insn,
},
Sra {
lhs: Insn,
rhs: Insn,
},
Slt {
lhs: Insn,
rhs: Insn,
},
Mov {
dst: Insn,
src: Insn,
},
Set {
dst: Insn,
src: Insn,
},
Jr {
dst: Insn,
},
Jmp {
dst: Insn,
},
Beq {
lhs: Insn,
rhs: Insn,
ttgt: Label,
ftgt: Label,
},
Bne {
lhs: Insn,
rhs: Insn,
ttgt: Label,
ftgt: Label,
},
Blt {
lhs: Insn,
rhs: Insn,
ttgt: Label,
ftgt: Label,
},
Bgt {
lhs: Insn,
rhs: Insn,
ttgt: Label,
ftgt: Label,
},
Load {
dst: Insn,
src: Insn,
size: u64,
},
Store {
dst: Insn,
src: Insn,
size: u64,
},
Sext {
size: usize,
dst: Insn,
},
Zext {
size: usize,
dst: Insn,
},
Signed {
dst: Insn,
},
Unsigned {
dst: Insn,
},
IntToFloat {
src: Insn,
src_size: usize,
signed: bool,
dst_size: usize,
},
Imm {
imm: i64,
},
Reg {
reg: u64,
},
TmpReg {
reg: u64,
},
Syscall {},
Sysbreak {},
Lr {
dst: Insn,
src: Insn,
size: u64,
},
Sc {
dst: Insn,
src: Insn,
addr: Insn,
size: u64,
},
Amo {
op: AmoOp,
dst: Insn,
src: Insn,
addr: Insn,
size: u64,
},
Fence {
mode: u8,
pred: u8,
succ: u8,
},
}Expand description
Represents guest semantics in a form that the JIT can emit directly.
Most operands are Insn handles. lhs and rhs are value inputs. A dst can be a value
input or a write target, depending on the operation. Load, Mov, Set, LR, SC, and AMO use
a register-like dst as a write target. The operation index is also its result handle.
Variants§
Add
Adds two bit patterns with wrapping semantics because guest overflow does not panic.
Sub
Subtracts with wrapping semantics for the same guest-overflow rule.
Mul
Produces the low backend-width part of an integer product.
Mulh
Produces the high backend-width part of a double-width product. Signedness markers on the operands select MULH, MULHSU, or MULHU behavior.
Fields
Div
Divides integer values. Operand markers select signed or unsigned behavior.
Fields
Mod
Produces an integer remainder. Operand markers select signed or unsigned behavior.
Fields
Fdiv
Divides IEEE floating-point bit patterns at the selected byte width.
Fields
And
Performs bitwise AND without a signedness distinction.
Or
Performs bitwise OR without a signedness distinction.
Xor
Performs bitwise exclusive OR without a signedness distinction.
Sll
Shifts left and fills low bits with zero.
Srl
Shifts right and fills high bits with zero.
Sra
Shifts right and copies the sign bit into high bits.
Slt
Returns one or zero for a less-than comparison. Operand markers tell the backend whether it must compare signed or unsigned values.
Mov
Copies a value to a write target.
Set
Writes a computed value to a guest register or temporary target.
Fields
Jr
Transfers control to a computed address value and ends the current basic block.
Jmp
Transfers control to a direct or computed value and ends the current basic block.
Beq
Branches to ttgt when two values are equal. Otherwise it branches to ftgt.
Fields
Bne
Branches to ttgt when two values differ. Otherwise it branches to ftgt.
Fields
Blt
Branches on less-than. Operand markers select signed or unsigned comparison.
Fields
Bgt
Branches on greater-than. Operand markers select signed or unsigned comparison.
Fields
Load
Reads size bytes at address src and writes the result through dst.
A later Unsigned marker requests zero extension. Integer loads otherwise sign-extend.
Fields
Store
Writes the low size bytes of src to address dst.
Fields
Sext
Sign-extends the low size bytes to the backend value width.
Zext
Zero-extends the low size bytes to the backend value width.
Signed
Marks a value for signed arithmetic without changing its bits.
Unsigned
Marks a value for unsigned arithmetic without changing its bits.
IntToFloat
Converts an integer value to an IEEE floating-point bit pattern.
Fields
Imm
Creates a constant. Signed storage keeps negative RISC-V immediates direct.
Reg
Reads one architectural register. The backend enforces special rules such as x0.
TmpReg
Reads one translator-private temporary register without using a guest register number.
Syscall
Returns control to the runtime for an execution-environment call.
Sysbreak
Returns control to the runtime for a guest breakpoint.
Lr
Loads a value and starts an atomic reservation for the addressed memory. The current Rust backend does not keep reservation state, which is an implementation limit.
Fields
Sc
Stores through a reservation and writes the success code through dst.
The current Rust backend always reports success because it does not model reservations.
Fields
Amo
Performs one atomic read-modify-write operation and returns the old memory value.
Fields
Fence
Carries guest memory-order information even when a single-threaded backend needs no code.
Trait Implementations§
Source§impl Clone for NnilInstruction
impl Clone for NnilInstruction
Source§fn clone(&self) -> NnilInstruction
fn clone(&self) -> NnilInstruction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for NnilInstruction
Source§impl Debug for NnilInstruction
impl Debug for NnilInstruction
impl Eq for NnilInstruction
Source§impl PartialEq for NnilInstruction
impl PartialEq for NnilInstruction
Source§fn eq(&self, other: &NnilInstruction) -> bool
fn eq(&self, other: &NnilInstruction) -> bool
self and other values to be equal, and is used by ==.