Trait cranelift_codegen::binemit::CodeSink
source · 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_ebb(&mut self, _: Reloc, _: CodeOffset);
fn reloc_external(&mut self, _: Reloc, _: &ExternalName, _: Addend);
fn reloc_jt(&mut self, _: Reloc, _: JumpTable);
fn trap(&mut self, _: TrapCode, _: SourceLoc);
fn begin_rodata(&mut self);
}
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§
sourcefn offset(&self) -> CodeOffset
fn offset(&self) -> CodeOffset
Get the current position.
sourcefn reloc_ebb(&mut self, _: Reloc, _: CodeOffset)
fn reloc_ebb(&mut self, _: Reloc, _: CodeOffset)
Add a relocation referencing an EBB at the current offset.
sourcefn reloc_external(&mut self, _: Reloc, _: &ExternalName, _: Addend)
fn reloc_external(&mut self, _: Reloc, _: &ExternalName, _: Addend)
Add a relocation referencing an external symbol plus the addend at the current offset.
sourcefn begin_rodata(&mut self)
fn begin_rodata(&mut self)
Code output is complete, read-only data may follow.