pub trait InstructionWriter {
    // Required methods
    fn new(code_address: u64) -> Self;
    fn pc(&self) -> u64;
    fn code_offset(&self) -> u64;
    fn can_branch_directly_between(&self, source: u64, target: u64) -> bool;
    fn put_bytes(&self, bytes: &[u8]) -> bool;
    fn put_label(&self, id: u64) -> bool;
    fn reset(&self, code_address: u64);
    fn put_branch_address(&self, address: u64) -> bool;
    fn flush(&self) -> bool;

    // Provided method
    fn can_branch_directly_to(&self, target: u64) -> bool { ... }
}
Expand description

A trait all InstructionWriters share.

Required Methods§

source

fn new(code_address: u64) -> Self

Create a new InstructionWriter to write code to the given address

source

fn pc(&self) -> u64

Retrieve the writer’s current program counter.

source

fn code_offset(&self) -> u64

Retrieve the writer’s current code offset.

source

fn can_branch_directly_between(&self, source: u64, target: u64) -> bool

Check if we can branch directly between the given source and target addresses.

source

fn put_bytes(&self, bytes: &[u8]) -> bool

Add the bytes specified to the instruction stream.

source

fn put_label(&self, id: u64) -> bool

Add a label at the curent point in the instruction stream.

source

fn reset(&self, code_address: u64)

Reset the writer to the given code address

source

fn put_branch_address(&self, address: u64) -> bool

Add a branch to an immediate address

source

fn flush(&self) -> bool

Flush the writer, outputing any pending ldr-immediates

Provided Methods§

source

fn can_branch_directly_to(&self, target: u64) -> bool

Check if we can branch directly to the target address from the current program counter.

Object Safety§

This trait is not object safe.

Implementors§