[][src]Struct cranelift_codegen::cursor::EncCursor

pub struct EncCursor<'f> {
    pub func: &'f mut Function,
    pub isa: &'f dyn TargetIsa,
    // some fields omitted
}

Encoding cursor.

An EncCursor can be used to insert instructions that are immediately assigned an encoding. The cursor holds a mutable reference to the whole function which can be re-borrowed from the public pos.func member.

Fields

func: &'f mut Function

The referenced function.

isa: &'f dyn TargetIsa

The target ISA that will be used to encode instructions.

Methods

impl<'f> EncCursor<'f>[src]

pub fn new(func: &'f mut Function, isa: &'f dyn TargetIsa) -> Self[src]

Create a new EncCursor pointing nowhere.

pub fn use_srcloc(&mut self, inst: Inst)[src]

Use the source location of inst for future instructions.

pub fn ins(&mut self) -> InsertBuilder<&mut EncCursor<'f>>[src]

Create an instruction builder that will insert an encoded instruction at the current position.

The builder will panic if it is used to insert an instruction that can't be encoded for self.isa.

pub fn built_inst(&self) -> Inst[src]

Get the last built instruction.

This returns the last instruction that was built using the ins() method on this cursor. Panics if no instruction was built.

pub fn display_inst(&self, inst: Inst) -> DisplayInst[src]

Return an object that can display inst.

This is a convenience wrapper for the DFG equivalent.

Trait Implementations

impl<'f> Cursor for EncCursor<'f>[src]

fn with_srcloc(self, srcloc: SourceLoc) -> Self where
    Self: Sized
[src]

Exchange this cursor for one with a set source location. Read more

fn at_position(self, pos: CursorPosition) -> Self where
    Self: Sized
[src]

Rebuild this cursor positioned at pos.

fn at_inst(self, inst: Inst) -> Self where
    Self: Sized
[src]

Rebuild this cursor positioned at inst. Read more

fn at_first_insertion_point(self, ebb: Ebb) -> Self where
    Self: Sized
[src]

Rebuild this cursor positioned at the first insertion point for ebb. This differs from at_first_inst in that it doesn't assume that any instructions have been inserted into ebb yet. Read more

fn at_first_inst(self, ebb: Ebb) -> Self where
    Self: Sized
[src]

Rebuild this cursor positioned at the first instruction in ebb. Read more

fn at_last_inst(self, ebb: Ebb) -> Self where
    Self: Sized
[src]

Rebuild this cursor positioned at the last instruction in ebb. Read more

fn after_inst(self, inst: Inst) -> Self where
    Self: Sized
[src]

Rebuild this cursor positioned after inst. Read more

fn at_top(self, ebb: Ebb) -> Self where
    Self: Sized
[src]

Rebuild this cursor positioned at the top of ebb. Read more

fn at_bottom(self, ebb: Ebb) -> Self where
    Self: Sized
[src]

Rebuild this cursor positioned at the bottom of ebb. Read more

fn current_ebb(&self) -> Option<Ebb>[src]

Get the EBB corresponding to the current position.

fn current_inst(&self) -> Option<Inst>[src]

Get the instruction corresponding to the current position, if any.

fn goto_after_inst(&mut self, inst: Inst)[src]

Go to the position after a specific instruction, which must be inserted in the layout. New instructions will be inserted after inst. Read more

fn goto_inst(&mut self, inst: Inst)[src]

Go to a specific instruction which must be inserted in the layout. New instructions will be inserted before inst. Read more

fn goto_first_insertion_point(&mut self, ebb: Ebb)[src]

Go to the position for inserting instructions at the beginning of ebb, which unlike goto_first_inst doesn't assume that any instructions have been inserted into ebb yet. Read more

fn goto_first_inst(&mut self, ebb: Ebb)[src]

Go to the first instruction in ebb.

fn goto_last_inst(&mut self, ebb: Ebb)[src]

Go to the last instruction in ebb.

fn goto_top(&mut self, ebb: Ebb)[src]

Go to the top of ebb which must be inserted into the layout. At this position, instructions cannot be inserted, but next_inst() will move to the first instruction in ebb. Read more

fn goto_bottom(&mut self, ebb: Ebb)[src]

Go to the bottom of ebb which must be inserted into the layout. At this position, inserted instructions will be appended to ebb. Read more

fn next_ebb(&mut self) -> Option<Ebb>[src]

Go to the top of the next EBB in layout order and return it. Read more

fn prev_ebb(&mut self) -> Option<Ebb>[src]

Go to the bottom of the previous EBB in layout order and return it. Read more

fn next_inst(&mut self) -> Option<Inst>[src]

Move to the next instruction in the same EBB and return it. Read more

fn prev_inst(&mut self) -> Option<Inst>[src]

Move to the previous instruction in the same EBB and return it. Read more

fn insert_inst(&mut self, inst: Inst)[src]

Insert an instruction at the current position. Read more

fn remove_inst(&mut self) -> Inst[src]

Remove the instruction under the cursor. Read more

fn remove_inst_and_step_back(&mut self) -> Inst[src]

Remove the instruction under the cursor. Read more

fn insert_ebb(&mut self, new_ebb: Ebb)[src]

Insert an EBB at the current position and switch to it. Read more

impl<'c, 'f> InstInserterBase<'c> for &'c mut EncCursor<'f>[src]

Auto Trait Implementations

impl<'f> Unpin for EncCursor<'f>

impl<'f> Send for EncCursor<'f>

impl<'f> Sync for EncCursor<'f>

impl<'f> !RefUnwindSafe for EncCursor<'f>

impl<'f> !UnwindSafe for EncCursor<'f>

Blanket Implementations

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> Into<U> for T where
    U: From<T>, 
[src]

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

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.

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

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

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