[−][src]Struct cranelift_codegen::machinst::sections::MachSection
A section of output to be emitted to a CodeSink / RelocSink in bulk. Multiple sections may be created with known start offsets in advance; the usual use-case is to create the .text (code) and .rodata (constant pool) at once, after computing the length of the code, so that constant references can use known offsets as instructions are emitted.
Fields
start_offset: CodeOffset
The starting offset of this section.
length_limit: CodeOffset
The limit of this section, defined by the start of the next section.
data: Vec<u8>
The section contents, as raw bytes.
relocs: Vec<MachReloc>
Any relocations referring to this section.
traps: Vec<MachTrap>
Any trap records referring to this section.
call_sites: Vec<MachCallSite>
Any call site records referring to this section.
srclocs: Vec<MachSrcLoc>
Any source location mappings referring to this section.
cur_srcloc: Option<(CodeOffset, SourceLoc)>
The current source location in progress (after start_srcloc()
and before end_srcloc()
).
This is a (start_offset, src_loc) tuple.
Methods
impl MachSection
[src]
pub fn new(start_offset: CodeOffset, length_limit: CodeOffset) -> MachSection
[src]
Create a new section, known to start at start_offset
and with a size limited to length_limit
.
pub fn emit<CS: CodeSink>(&self, sink: &mut CS)
[src]
Emit this section to the CodeSink and other associated sinks. The current offset of the CodeSink must match the starting offset of this section.
Trait Implementations
impl MachSectionOutput for MachSection
[src]
fn cur_offset_from_start(&self) -> CodeOffset
[src]
fn start_offset(&self) -> CodeOffset
[src]
fn put1(&mut self, value: u8)
[src]
fn put_data(&mut self, data: &[u8])
[src]
fn add_reloc(
&mut self,
srcloc: SourceLoc,
kind: Reloc,
name: &ExternalName,
addend: Addend
)
[src]
&mut self,
srcloc: SourceLoc,
kind: Reloc,
name: &ExternalName,
addend: Addend
)
fn add_trap(&mut self, srcloc: SourceLoc, code: TrapCode)
[src]
fn add_call_site(&mut self, srcloc: SourceLoc, opcode: Opcode)
[src]
fn start_srcloc(&mut self, loc: SourceLoc)
[src]
fn end_srcloc(&mut self)
[src]
fn put2(&mut self, value: u16)
[src]
fn put4(&mut self, value: u32)
[src]
fn put8(&mut self, value: u64)
[src]
fn align_to(&mut self, align_to: CodeOffset)
[src]
Auto Trait Implementations
impl RefUnwindSafe for MachSection
impl Send for MachSection
impl Sync for MachSection
impl Unpin for MachSection
impl UnwindSafe for MachSection
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,