Expand description
The hand-written A64 encoder — the inverse of decode.
Reconstructs the raw 32-bit instruction word from the semantics of an
Instruction (its Code/Mnemonic/operands/ip), never reading
Instruction::word. Dispatches on Instruction::code to per-group
encoders. no_std, zero-alloc, and total (returns encode::EncodeError
rather than panicking); unsupported codes and semantic operand shapes return
an error.
The A64 encoder — the inverse of crate::decode.
Reconstructs the raw 32-bit little-endian instruction word from the
semantics of an Instruction (its Code, Mnemonic, operands and
Instruction::ip). It deliberately never reads
Instruction::word: the whole point is to prove
the decode is invertible, so the encoder must rebuild the word purely from
the public projection.
Like the decoder, the encoder is no_std, zero-alloc, and total: it
never panics. Anything it cannot (yet) encode returns EncodeError.
Dispatch is on Instruction::code — the canonical encoding identity —
and routes to the matching group encoder. A code or semantic operand shape
that a group does not support returns EncodeError::Unsupported or a more
specific validation error.
Modules§
- apple
- Encoder for the Apple IMPLEMENTATION-DEFINED instructions (AMX / GXF).
- bits
- Inverse immediate helpers for the encoder — the exact inverses of the
shared decode pseudocode in
crate::decode::bits. - branch_
sys - Encoder for Branches, Exception generating and System instructions — the
exact inverse of
crate::decode::branch_sys(plus theUDFreserved path fromcrate::decode). - dp_imm
- Encoder for Data Processing – Immediate — the exact inverse of
crate::decode::dp_imm. - dp_reg
- Encoder for Data Processing – Register — the exact inverse of
crate::decode::dp_reg. - ldst
- Encoder for Loads and Stores — the exact inverse of
crate::decode::ldst. - ldst_
simd - Encoder for Advanced SIMD load/store structure instructions — the exact
inverse of
crate::decode::ldst_simd. - mops
- Encoder for FEAT_MOPS — Memory Copy / Memory Set — the exact inverse of
crate::decode::mops. - simd_fp
- Encoder for Data Processing – Scalar Floating-Point and Advanced SIMD — the
inverse of
crate::decode::simd_fp. - sme
- Encoder for the SME (Scalable Matrix Extension) group — the inverse of
crate::decode::sme. - sve
- Encoder for the SVE / SVE2 group — the inverse of
crate::decode::sve.
Enums§
- Encode
Error - Why an
Instructioncould not be encoded back to a 32-bit word.
Functions§
- encode
- Encode
insnback into its 32-bit little-endian A64 instruction word.