Skip to main content

InstBuilder

Struct InstBuilder 

Source
pub struct InstBuilder<'a> { /* private fields */ }
Expand description

One instruction being built.

The order the operands are given in is the order they are stored in, and the builder is what insists that order is the one the printer and the parser agree on.

Implementations§

Source§

impl InstBuilder<'_>

Source

pub fn operand(self, operand: Operand) -> Self

Adds an operand.

§Panics

Panics if an operand the instruction writes is given after one it reads, or if either is given after the memory operand, because both make the instruction print as text that reads back as a different one.

Source

pub fn def(self, reg: Reg, class: RegClass) -> Self

Adds the operand the instruction writes, in the common case where nothing constrains it.

Source

pub fn uses(self, reg: Reg, class: RegClass) -> Self

Adds an operand the instruction reads, in the common case where nothing constrains it.

Source

pub fn mem(self, mem: Mem) -> Self

Gives the instruction a memory operand, whose registers become its last operands.

§Panics

Panics if it already has one.

Source

pub fn imm(self, value: i64) -> Self

Gives the instruction an immediate.

Source

pub fn symbol(self, symbol: Symbol) -> Self

Gives the instruction the symbol it names.

Source

pub fn at(self, span: Span) -> Self

Says where in the source the instruction came from.

Source

pub fn finish(self) -> Inst

Puts the instruction at the end of the block it was started in.

Trait Implementations§

Source§

impl<'a> Debug for InstBuilder<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for InstBuilder<'a>

§

impl<'a> Freeze for InstBuilder<'a>

§

impl<'a> RefUnwindSafe for InstBuilder<'a>

§

impl<'a> Send for InstBuilder<'a>

§

impl<'a> Sync for InstBuilder<'a>

§

impl<'a> Unpin for InstBuilder<'a>

§

impl<'a> UnsafeUnpin for InstBuilder<'a>

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.