[][src]Struct cranelift_codegen::machinst::sections::MachSection

pub struct MachSection {
    pub start_offset: CodeOffset,
    pub length_limit: CodeOffset,
    pub data: Vec<u8>,
    pub relocs: Vec<MachReloc>,
    pub traps: Vec<MachTrap>,
    pub call_sites: Vec<MachCallSite>,
    pub srclocs: Vec<MachSrcLoc>,
    pub cur_srcloc: Option<(CodeOffset, SourceLoc)>,
}

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]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.