pub trait CodeSink {
// Required methods
fn put1(&mut self, _: u8);
fn put2(&mut self, _: u16);
fn put4(&mut self, _: u32);
fn put8(&mut self, _: u64);
fn add_trap(&mut self, code: TrapCode);
fn use_target(&mut self, target: DeferredTarget);
fn known_offset(&self, offset: KnownOffset) -> i32;
}
Expand description
Describe how an instruction is emitted into a code buffer.
Required Methods§
Sourcefn add_trap(&mut self, code: TrapCode)
fn add_trap(&mut self, code: TrapCode)
Inform the code buffer of a possible trap at the current location; required for assembling memory accesses.
Sourcefn use_target(&mut self, target: DeferredTarget)
fn use_target(&mut self, target: DeferredTarget)
Inform the code buffer that a use of target
is about to happen at the
current offset.
After this method is called the bytes of the target are then expected to
be placed using one of the above put*
methods.
Sourcefn known_offset(&self, offset: KnownOffset) -> i32
fn known_offset(&self, offset: KnownOffset) -> i32
Resolves a KnownOffset
value to the actual signed offset.