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 InstructionWriter
s share.
Required Methods§
sourcefn new(code_address: u64) -> Self
fn new(code_address: u64) -> Self
Create a new InstructionWriter
to write code to the given address
sourcefn code_offset(&self) -> u64
fn code_offset(&self) -> u64
Retrieve the writer’s current code offset.
sourcefn can_branch_directly_between(&self, source: u64, target: u64) -> bool
fn can_branch_directly_between(&self, source: u64, target: u64) -> bool
Check if we can branch directly between the given source and target addresses.
sourcefn put_label(&self, id: u64) -> bool
fn put_label(&self, id: u64) -> bool
Add a label at the curent point in the instruction stream.
sourcefn put_branch_address(&self, address: u64) -> bool
fn put_branch_address(&self, address: u64) -> bool
Add a branch to an immediate address
Provided Methods§
sourcefn can_branch_directly_to(&self, target: u64) -> bool
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.