Trait cranelift_codegen::binemit::CodeSink [−][src]
pub trait CodeSink {
Show methods
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 reloc_constant(&mut self, _: Reloc, _: ConstantOffset);
fn reloc_jt(&mut self, _: Reloc, _: JumpTable);
fn trap(&mut self, _: TrapCode, _: SourceLoc);
fn begin_jumptables(&mut self);
fn begin_rodata(&mut self);
fn end_codegen(&mut self);
fn add_stack_map(&mut self, _: &[Value], _: &Function, _: &dyn TargetIsa);
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
fn offset(&self) -> CodeOffset[src]
fn offset(&self) -> CodeOffset[src]Get the current position.
fn put1(&mut self, _: u8)[src]
fn put1(&mut self, _: u8)[src]Add 1 byte to the code section.
fn put2(&mut self, _: u16)[src]
fn put2(&mut self, _: u16)[src]Add 2 bytes to the code section.
fn put4(&mut self, _: u32)[src]
fn put4(&mut self, _: u32)[src]Add 4 bytes to the code section.
fn put8(&mut self, _: u64)[src]
fn put8(&mut self, _: u64)[src]Add 8 bytes to the code section.
fn reloc_external(
&mut self,
_: SourceLoc,
_: Reloc,
_: &ExternalName,
_: Addend
)[src]
fn reloc_external(
&mut self,
_: SourceLoc,
_: Reloc,
_: &ExternalName,
_: Addend
)[src]Add a relocation referencing an external symbol plus the addend at the current offset.
fn reloc_constant(&mut self, _: Reloc, _: ConstantOffset)[src]
fn reloc_constant(&mut self, _: Reloc, _: ConstantOffset)[src]Add a relocation referencing a constant.
fn reloc_jt(&mut self, _: Reloc, _: JumpTable)[src]
fn reloc_jt(&mut self, _: Reloc, _: JumpTable)[src]Add a relocation referencing a jump table.
fn trap(&mut self, _: TrapCode, _: SourceLoc)[src]
fn trap(&mut self, _: TrapCode, _: SourceLoc)[src]Add trap information for the current offset.
fn begin_jumptables(&mut self)[src]
fn begin_jumptables(&mut self)[src]Machine code output is complete, jump table data may follow.
fn begin_rodata(&mut self)[src]
fn begin_rodata(&mut self)[src]Jump table output is complete, raw read-only data may follow.
fn end_codegen(&mut self)[src]
fn end_codegen(&mut self)[src]Read-only data output is complete, we’re done.
Provided methods
fn add_call_site(&mut self, _: Opcode, _: SourceLoc)[src]
fn add_call_site(&mut self, _: Opcode, _: SourceLoc)[src]Add a call site for a call with the given opcode, returning at the current offset.
Implementors
impl<'a> CodeSink for MemoryCodeSink<'a>[src]
impl<'a> CodeSink for MemoryCodeSink<'a>[src]fn offset(&self) -> CodeOffset[src]
fn put1(&mut self, x: u8)[src]
fn put2(&mut self, x: u16)[src]
fn put4(&mut self, x: u32)[src]
fn put8(&mut self, x: u64)[src]
fn reloc_external(
&mut self,
srcloc: SourceLoc,
rel: Reloc,
name: &ExternalName,
addend: Addend
)[src]
&mut self,
srcloc: SourceLoc,
rel: Reloc,
name: &ExternalName,
addend: Addend
)
fn reloc_constant(&mut self, rel: Reloc, constant_offset: ConstantOffset)[src]
fn reloc_jt(&mut self, rel: Reloc, jt: JumpTable)[src]
fn trap(&mut self, code: TrapCode, srcloc: SourceLoc)[src]
fn begin_jumptables(&mut self)[src]
fn begin_rodata(&mut self)[src]
fn end_codegen(&mut self)[src]
fn add_stack_map(
&mut self,
val_list: &[Value],
func: &Function,
isa: &dyn TargetIsa
)[src]
&mut self,
val_list: &[Value],
func: &Function,
isa: &dyn TargetIsa
)