Struct cranelift_codegen::cursor::FuncCursor[][src]

pub struct FuncCursor<'f> {
    pub func: &'f mut Function,
    // some fields omitted
}
Expand description

Function cursor.

A FuncCursor holds a mutable reference to a whole ir::Function while keeping a position too. The function can be re-borrowed by accessing the public cur.func member.

This cursor is for use before legalization. The inserted instructions are not given an encoding.

Fields

func: &'f mut Function

The referenced function.

Implementations

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

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

Create a new FuncCursor 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 FuncCursor<'f>>[src]

Create an instruction builder that inserts an instruction at the current position.

Trait Implementations

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

fn position(&self) -> CursorPosition[src]

Get the current cursor position.

fn set_position(&mut self, pos: CursorPosition)[src]

Set the current position.

fn srcloc(&self) -> SourceLoc[src]

Get the source location that should be assigned to new instructions.

fn set_srcloc(&mut self, srcloc: SourceLoc)[src]

Set the source location that should be assigned to new instructions.

fn layout(&self) -> &Layout[src]

Borrow a reference to the function layout that this cursor is navigating.

fn layout_mut(&mut self) -> &mut Layout[src]

Borrow a mutable reference to the function layout that this cursor is navigating.

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, block: Block) -> Self where
    Self: Sized
[src]

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

fn at_first_inst(self, block: Block) -> Self where
    Self: Sized
[src]

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

fn at_last_inst(self, block: Block) -> Self where
    Self: Sized
[src]

Rebuild this cursor positioned at the last instruction in block. 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, block: Block) -> Self where
    Self: Sized
[src]

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

fn at_bottom(self, block: Block) -> Self where
    Self: Sized
[src]

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

fn current_block(&self) -> Option<Block>[src]

Get the block 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, block: Block)[src]

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

fn goto_first_inst(&mut self, block: Block)[src]

Go to the first instruction in block.

fn goto_last_inst(&mut self, block: Block)[src]

Go to the last instruction in block.

fn goto_top(&mut self, block: Block)[src]

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

fn goto_bottom(&mut self, block: Block)[src]

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

fn next_block(&mut self) -> Option<Block>[src]

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

fn prev_block(&mut self) -> Option<Block>[src]

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

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

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

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

Move to the previous instruction in the same block 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_block(&mut self, new_block: Block)[src]

Insert a block at the current position and switch to it. Read more

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

fn data_flow_graph(&self) -> &DataFlowGraph[src]

Get an immutable reference to the data flow graph.

fn data_flow_graph_mut(&mut self) -> &mut DataFlowGraph[src]

Get a mutable reference to the data flow graph.

fn insert_built_inst(self, inst: Inst, _: Type) -> &'c mut DataFlowGraph[src]

Insert a new instruction which belongs to the DFG.

Auto Trait Implementations

impl<'f> RefUnwindSafe for FuncCursor<'f>

impl<'f> Send for FuncCursor<'f>

impl<'f> Sync for FuncCursor<'f>

impl<'f> Unpin for FuncCursor<'f>

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

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

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

Performs the conversion.