Struct cranelift_codegen::cursor::EncCursor [−][src]
pub struct EncCursor<'f> { pub func: &'f mut Function, pub isa: &'f dyn TargetIsa, // some fields omitted }
Expand description
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.
Implementations
Create a new EncCursor
pointing nowhere.
Use the source location of inst
for future instructions.
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
.
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.
Return an object that can display inst
.
This is a convenience wrapper for the DFG equivalent.
Trait Implementations
Get the current cursor position.
Set the current position.
Get the source location that should be assigned to new instructions.
Set the source location that should be assigned to new instructions.
Borrow a reference to the function layout that this cursor is navigating.
Borrow a mutable reference to the function layout that this cursor is navigating.
Exchange this cursor for one with a set source location. Read more
Rebuild this cursor positioned at pos
.
Rebuild this cursor positioned at inst
. Read more
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
Rebuild this cursor positioned at the first instruction in block
. Read more
Rebuild this cursor positioned at the last instruction in block
. Read more
Rebuild this cursor positioned after inst
. Read more
Rebuild this cursor positioned at the top of block
. Read more
Rebuild this cursor positioned at the bottom of block
. Read more
Get the block corresponding to the current position.
Get the instruction corresponding to the current position, if any.
Go to the position after a specific instruction, which must be inserted
in the layout. New instructions will be inserted after inst
. Read more
Go to a specific instruction which must be inserted in the layout.
New instructions will be inserted before inst
. Read more
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
Go to the first instruction in block
.
Go to the last instruction in block
.
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
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
Go to the top of the next block in layout order and return it. Read more
Go to the bottom of the previous block in layout order and return it. Read more
Move to the next instruction in the same block and return it. Read more
Move to the previous instruction in the same block and return it. Read more
Insert an instruction at the current position. Read more
Remove the instruction under the cursor. Read more
Remove the instruction under the cursor. Read more
Insert a block at the current position and switch to it. Read more
Get an immutable reference to the data flow graph.
Get a mutable reference to the data flow graph.
Insert a new instruction which belongs to the DFG.