Skip to main content

Emitter

Struct Emitter 

Source
pub struct Emitter<'a, 'p, 's, C: PcodeLoweringContext + ?Sized, S: PcodeSink + ?Sized> { /* private fields */ }
Expand description

The emission pass: lowers statements one at a time into a PcodeSink.

This is emit_instruction with the statement loop handed to the producer. A producer that resolves its source template on the fly feeds each statement as a StmtKind over its own ExprNode, so no instruction-wide AST exists between it and the sink.

plan must come from a Planner fed the same statements, in the same order, over the same context.

Implementations§

Source§

impl<'a, 'p, 's, C: PcodeLoweringContext + ?Sized, S: PcodeSink + ?Sized> Emitter<'a, 'p, 's, C, S>

Source

pub fn new(context: &'a C, plan: &'p PcodePlan, sink: &'s mut S) -> Self

Starts emitting one instruction into sink.

Source

pub fn statement<E: ExprNode>( &mut self, statement: StmtKind<'_, E>, ) -> Result<(), PcodeLowerError>

Lowers the next statement, reporting its operations to the sink.

An error leaves the sink with a partially emitted instruction, which the caller discards.

Auto Trait Implementations§

§

impl<'a, 'p, 's, C, S> !UnwindSafe for Emitter<'a, 'p, 's, C, S>

§

impl<'a, 'p, 's, C, S> Freeze for Emitter<'a, 'p, 's, C, S>
where &'a C: Freeze, &'s mut S: Freeze, C: ?Sized, S: ?Sized,

§

impl<'a, 'p, 's, C, S> RefUnwindSafe for Emitter<'a, 'p, 's, C, S>

§

impl<'a, 'p, 's, C, S> Send for Emitter<'a, 'p, 's, C, S>
where &'a C: Send, &'s mut S: Send, C: ?Sized, S: ?Sized,

§

impl<'a, 'p, 's, C, S> Sync for Emitter<'a, 'p, 's, C, S>
where &'a C: Sync, &'s mut S: Sync, C: ?Sized, S: ?Sized,

§

impl<'a, 'p, 's, C, S> Unpin for Emitter<'a, 'p, 's, C, S>
where &'a C: Unpin, &'s mut S: Unpin, C: ?Sized, S: ?Sized,

§

impl<'a, 'p, 's, C, S> UnsafeUnpin for Emitter<'a, 'p, 's, C, S>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.