pub struct Nnil { /* private fields */ }Expand description
Owns one lifted region so its value handles and address maps stay valid together.
Implementations§
Source§impl Nnil
impl Nnil
Sourcepub fn with_base(address: u64) -> Self
pub fn with_base(address: u64) -> Self
Starts at a guest address so that branches and fault reports use process addresses.
Sourcepub fn create_label(&mut self, addr: u64) -> Label
pub fn create_label(&mut self, addr: u64) -> Label
Reuses a label for each address so that all incoming branches have one identity.
Sourcepub fn new_insn(&mut self)
pub fn new_insn(&mut self)
Records a guest-instruction boundary before its NNIL operations are appended.
Sourcepub fn advance_by(&mut self, amount: u64)
pub fn advance_by(&mut self, amount: u64)
Advances the guest PC separately because one guest instruction can emit many operations.
Sourcepub fn entrypoint(&self) -> Option<Address>
pub fn entrypoint(&self) -> Option<Address>
Returns the lowest mapped guest address, or None for an empty region.
Sourcepub fn insns(&self) -> &[NnilInstruction]
pub fn insns(&self) -> &[NnilInstruction]
Returns operations in handle order so a backend can resolve operands by index.
Sourcepub fn instruction_starts(&self) -> &BTreeMap<Address, Insn>
pub fn instruction_starts(&self) -> &BTreeMap<Address, Insn>
Returns guest-instruction boundaries for basic-block collection and diagnostics.
Sourcepub fn labels(&self) -> &BTreeMap<Address, Label>
pub fn labels(&self) -> &BTreeMap<Address, Label>
Returns the address-to-label map for direct control-flow edges.
Sourcepub fn label_for_address(&self, addr: Address) -> Option<Label>
pub fn label_for_address(&self, addr: Address) -> Option<Label>
Finds the stable label for a guest address when one was created.
Sourcepub fn label_address(&self, label: Label) -> Option<Address>
pub fn label_address(&self, label: Label) -> Option<Address>
Resolves a label back to its guest address.
Sourcepub fn imm(&mut self, imm: i64) -> Insn
pub fn imm(&mut self, imm: i64) -> Insn
Appends a signed immediate bit pattern.
Signed storage represents negative sign-extended immediates without a separate flag.
Sourcepub fn reg(&mut self, reg: u64) -> Insn
pub fn reg(&mut self, reg: u64) -> Insn
Appends a read of one register in the combined NNIL register namespace.
RISC-V integer registers use indices 0 through 31. The lifter adds 32 for floating-point registers so integer and floating-point state cannot have the same NNIL index.
Sourcepub fn tmp_reg(&mut self, reg: u64) -> Insn
pub fn tmp_reg(&mut self, reg: u64) -> Insn
Appends a read of a translator-private temporary.
A separate variant prevents a temporary index from aliasing guest architectural state.
Sourcepub fn add(&mut self, lhs: Insn, rhs: Insn) -> Insn
pub fn add(&mut self, lhs: Insn, rhs: Insn) -> Insn
Appends this two-input value operation and returns its stable result handle.
Sourcepub fn sub(&mut self, lhs: Insn, rhs: Insn) -> Insn
pub fn sub(&mut self, lhs: Insn, rhs: Insn) -> Insn
Appends this two-input value operation and returns its stable result handle.
Sourcepub fn mul(&mut self, lhs: Insn, rhs: Insn) -> Insn
pub fn mul(&mut self, lhs: Insn, rhs: Insn) -> Insn
Appends this two-input value operation and returns its stable result handle.
Sourcepub fn mulh(&mut self, lhs: Insn, rhs: Insn) -> Insn
pub fn mulh(&mut self, lhs: Insn, rhs: Insn) -> Insn
Appends this two-input value operation and returns its stable result handle.
Sourcepub fn div(&mut self, lhs: Insn, rhs: Insn) -> Insn
pub fn div(&mut self, lhs: Insn, rhs: Insn) -> Insn
Appends this two-input value operation and returns its stable result handle.
Sourcepub fn mod(&mut self, lhs: Insn, rhs: Insn) -> Insn
pub fn mod(&mut self, lhs: Insn, rhs: Insn) -> Insn
Appends this two-input value operation and returns its stable result handle.
Sourcepub fn and(&mut self, lhs: Insn, rhs: Insn) -> Insn
pub fn and(&mut self, lhs: Insn, rhs: Insn) -> Insn
Appends this two-input value operation and returns its stable result handle.
Sourcepub fn or(&mut self, lhs: Insn, rhs: Insn) -> Insn
pub fn or(&mut self, lhs: Insn, rhs: Insn) -> Insn
Appends this two-input value operation and returns its stable result handle.
Sourcepub fn xor(&mut self, lhs: Insn, rhs: Insn) -> Insn
pub fn xor(&mut self, lhs: Insn, rhs: Insn) -> Insn
Appends this two-input value operation and returns its stable result handle.
Sourcepub fn sll(&mut self, lhs: Insn, rhs: Insn) -> Insn
pub fn sll(&mut self, lhs: Insn, rhs: Insn) -> Insn
Appends this two-input value operation and returns its stable result handle.
Sourcepub fn srl(&mut self, lhs: Insn, rhs: Insn) -> Insn
pub fn srl(&mut self, lhs: Insn, rhs: Insn) -> Insn
Appends this two-input value operation and returns its stable result handle.
Sourcepub fn sra(&mut self, lhs: Insn, rhs: Insn) -> Insn
pub fn sra(&mut self, lhs: Insn, rhs: Insn) -> Insn
Appends this two-input value operation and returns its stable result handle.
Sourcepub fn slt(&mut self, lhs: Insn, rhs: Insn) -> Insn
pub fn slt(&mut self, lhs: Insn, rhs: Insn) -> Insn
Appends this two-input value operation and returns its stable result handle.
Sourcepub fn mov(&mut self, dst: Insn, src: Insn) -> Insn
pub fn mov(&mut self, dst: Insn, src: Insn) -> Insn
Appends a value move and writes its result through dst.
Sourcepub fn set(&mut self, dst: Insn, src: Insn) -> Insn
pub fn set(&mut self, dst: Insn, src: Insn) -> Insn
Appends a guest-state write after a pure NNIL calculation.
Sourcepub fn jr(&mut self, dst: Insn) -> Insn
pub fn jr(&mut self, dst: Insn) -> Insn
Appends an indirect transfer and ends linear execution.
Sourcepub fn beq(&mut self, lhs: Insn, rhs: Insn, ttgt: Label, ftgt: Label) -> Insn
pub fn beq(&mut self, lhs: Insn, rhs: Insn, ttgt: Label, ftgt: Label) -> Insn
Appends this comparison branch with explicit true and false targets.
Sourcepub fn bne(&mut self, lhs: Insn, rhs: Insn, ttgt: Label, ftgt: Label) -> Insn
pub fn bne(&mut self, lhs: Insn, rhs: Insn, ttgt: Label, ftgt: Label) -> Insn
Appends this comparison branch with explicit true and false targets.
Sourcepub fn blt(&mut self, lhs: Insn, rhs: Insn, ttgt: Label, ftgt: Label) -> Insn
pub fn blt(&mut self, lhs: Insn, rhs: Insn, ttgt: Label, ftgt: Label) -> Insn
Appends this comparison branch with explicit true and false targets.
Sourcepub fn bgt(&mut self, lhs: Insn, rhs: Insn, ttgt: Label, ftgt: Label) -> Insn
pub fn bgt(&mut self, lhs: Insn, rhs: Insn, ttgt: Label, ftgt: Label) -> Insn
Appends this comparison branch with explicit true and false targets.
Sourcepub fn load(&mut self, dst: Insn, src: Insn, size: u64) -> Insn
pub fn load(&mut self, dst: Insn, src: Insn, size: u64) -> Insn
Appends this memory operation with an explicit byte width.
Sourcepub fn store(&mut self, dst: Insn, src: Insn, size: u64) -> Insn
pub fn store(&mut self, dst: Insn, src: Insn, size: u64) -> Insn
Appends this memory operation with an explicit byte width.
Sourcepub fn sext(&mut self, size: usize, dst: Insn) -> Insn
pub fn sext(&mut self, size: usize, dst: Insn) -> Insn
Appends this width extension so the backend does not infer a guest width.
Sourcepub fn zext(&mut self, size: usize, dst: Insn) -> Insn
pub fn zext(&mut self, size: usize, dst: Insn) -> Insn
Appends this width extension so the backend does not infer a guest width.
Sourcepub fn signed(&mut self, dst: Insn) -> Insn
pub fn signed(&mut self, dst: Insn) -> Insn
Appends this arithmetic interpretation marker without changing the input bits.
Sourcepub fn unsigned(&mut self, dst: Insn) -> Insn
pub fn unsigned(&mut self, dst: Insn) -> Insn
Appends this arithmetic interpretation marker without changing the input bits.
Sourcepub fn fdiv(&mut self, size: usize, lhs: Insn, rhs: Insn) -> Insn
pub fn fdiv(&mut self, size: usize, lhs: Insn, rhs: Insn) -> Insn
Appends floating-point division for a value width in bytes.
Sourcepub fn int_to_float(
&mut self,
src: Insn,
src_size: usize,
signed: bool,
dst_size: usize,
) -> Insn
pub fn int_to_float( &mut self, src: Insn, src_size: usize, signed: bool, dst_size: usize, ) -> Insn
Appends an integer-to-floating-point conversion with explicit source and result widths.
Explicit widths prevent the backend host type from changing guest conversion behavior.
Sourcepub fn syscall(&mut self) -> Insn
pub fn syscall(&mut self) -> Insn
Appends this runtime exit and returns its stable operation handle.
Sourcepub fn sysbreak(&mut self) -> Insn
pub fn sysbreak(&mut self) -> Insn
Appends this runtime exit and returns its stable operation handle.
Sourcepub fn lr(&mut self, dst: Insn, src: Insn, size: u64) -> Insn
pub fn lr(&mut self, dst: Insn, src: Insn, size: u64) -> Insn
Appends an atomic load-reserved of size bytes from address src.
Sourcepub fn sc(&mut self, dst: Insn, src: Insn, addr: Insn, size: u64) -> Insn
pub fn sc(&mut self, dst: Insn, src: Insn, addr: Insn, size: u64) -> Insn
Appends an atomic store-conditional and its architectural success result.