Trait cranelift_codegen::binemit::CodeSink[][src]

pub trait CodeSink {
    fn offset(&self) -> CodeOffset;
fn put1(&mut self, _: u8);
fn put2(&mut self, _: u16);
fn put4(&mut self, _: u32);
fn put8(&mut self, _: u64);
fn reloc_external(
        &mut self,
        _: SourceLoc,
        _: Reloc,
        _: &ExternalName,
        _: Addend
    );
fn trap(&mut self, _: TrapCode, _: SourceLoc);
fn begin_jumptables(&mut self);
fn begin_rodata(&mut self);
fn end_codegen(&mut self); fn add_call_site(&mut self, _: Opcode, _: SourceLoc) { ... } }
Expand description

Abstract interface for adding bytes to the code segment.

A CodeSink will receive all of the machine code for a function. It also accepts relocations which are locations in the code section that need to be fixed up when linking.

Required methods

Get the current position.

Add 1 byte to the code section.

Add 2 bytes to the code section.

Add 4 bytes to the code section.

Add 8 bytes to the code section.

Add a relocation referencing an external symbol plus the addend at the current offset.

Add trap information for the current offset.

Machine code output is complete, jump table data may follow.

Jump table output is complete, raw read-only data may follow.

Read-only data output is complete, we’re done.

Provided methods

Add a call site for a call with the given opcode, returning at the current offset.

Implementors