pub enum Instruction {
R(RInstruction),
I(IInstruction),
S(SInstruction),
J(JInstruction),
U(UInstruction),
SB(SBInstruction),
}
Variants§
Implementations§
Source§impl Instruction
impl Instruction
pub fn with_ir(self, ir: Option<String>) -> InstructionWithLabel
pub fn mv(rd: Register, rs1: Register) -> Instruction
pub fn li(rd: Register, imm: Immediate) -> Instruction
pub fn ret() -> Instruction
pub fn nop() -> Instruction
Sourcepub fn sw(rs2: Register, rs1: Register, imm: Immediate) -> Instruction
pub fn sw(rs2: Register, rs1: Register, imm: Immediate) -> Instruction
Store rs2
to mem[rs1 + imm]
Sourcepub fn lw(rd: Register, rs1: Register, imm: Immediate) -> Instruction
pub fn lw(rd: Register, rs1: Register, imm: Immediate) -> Instruction
Load mem[rs1 + imm]
to rd
pub fn addi(rd: Register, rs1: Register, imm: i32) -> Instruction
pub fn add(rd: Register, rs1: Register, rs2: Register) -> Instruction
Trait Implementations§
Source§impl Clone for Instruction
impl Clone for Instruction
Source§fn clone(&self) -> Instruction
fn clone(&self) -> Instruction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Instruction
impl Debug for Instruction
Source§impl Display for Instruction
impl Display for Instruction
Source§impl From<Instruction> for InstructionWithLabel
impl From<Instruction> for InstructionWithLabel
Source§fn from(value: Instruction) -> Self
fn from(value: Instruction) -> Self
Converts to this type from the input type.
Source§impl PartialEq for Instruction
impl PartialEq for Instruction
impl StructuralPartialEq for Instruction
Auto Trait Implementations§
impl Freeze for Instruction
impl RefUnwindSafe for Instruction
impl Send for Instruction
impl Sync for Instruction
impl Unpin for Instruction
impl UnwindSafe for Instruction
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more