Struct cranelift_codegen::cursor::EncCursor
source · pub struct EncCursor<'f> {
pub func: &'f mut Function,
pub isa: &'f dyn TargetIsa,
/* private fields */
}
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§
source§impl<'f> EncCursor<'f>
impl<'f> EncCursor<'f>
sourcepub fn new(func: &'f mut Function, isa: &'f dyn TargetIsa) -> Self
pub fn new(func: &'f mut Function, isa: &'f dyn TargetIsa) -> Self
Create a new EncCursor
pointing nowhere.
sourcepub fn use_srcloc(&mut self, inst: Inst)
pub fn use_srcloc(&mut self, inst: Inst)
Use the source location of inst
for future instructions.
sourcepub fn ins(&mut self) -> InsertBuilder<'_, &mut EncCursor<'f>>
pub fn ins(&mut self) -> InsertBuilder<'_, &mut EncCursor<'f>>
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
.
sourcepub fn built_inst(&self) -> Inst
pub fn built_inst(&self) -> Inst
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.
sourcepub fn display_inst(&self, inst: Inst) -> DisplayInst<'_>
pub fn display_inst(&self, inst: Inst) -> DisplayInst<'_>
Return an object that can display inst
.
This is a convenience wrapper for the DFG equivalent.
Trait Implementations§
source§impl<'f> Cursor for EncCursor<'f>
impl<'f> Cursor for EncCursor<'f>
source§fn position(&self) -> CursorPosition
fn position(&self) -> CursorPosition
source§fn set_position(&mut self, pos: CursorPosition)
fn set_position(&mut self, pos: CursorPosition)
source§fn srcloc(&self) -> SourceLoc
fn srcloc(&self) -> SourceLoc
source§fn set_srcloc(&mut self, srcloc: SourceLoc)
fn set_srcloc(&mut self, srcloc: SourceLoc)
source§fn layout(&self) -> &Layout
fn layout(&self) -> &Layout
source§fn layout_mut(&mut self) -> &mut Layout
fn layout_mut(&mut self) -> &mut Layout
source§fn with_srcloc(self, srcloc: SourceLoc) -> Selfwhere
Self: Sized,
fn with_srcloc(self, srcloc: SourceLoc) -> Selfwhere
Self: Sized,
source§fn at_position(self, pos: CursorPosition) -> Selfwhere
Self: Sized,
fn at_position(self, pos: CursorPosition) -> Selfwhere
Self: Sized,
pos
.source§fn at_inst(self, inst: Inst) -> Selfwhere
Self: Sized,
fn at_inst(self, inst: Inst) -> Selfwhere
Self: Sized,
inst
. Read moresource§fn at_first_insertion_point(self, ebb: Ebb) -> Selfwhere
Self: Sized,
fn at_first_insertion_point(self, ebb: Ebb) -> Selfwhere
Self: Sized,
ebb
.
This differs from at_first_inst
in that it doesn’t assume that any
instructions have been inserted into ebb
yet. Read moresource§fn at_first_inst(self, ebb: Ebb) -> Selfwhere
Self: Sized,
fn at_first_inst(self, ebb: Ebb) -> Selfwhere
Self: Sized,
ebb
. Read moresource§fn at_last_inst(self, ebb: Ebb) -> Selfwhere
Self: Sized,
fn at_last_inst(self, ebb: Ebb) -> Selfwhere
Self: Sized,
ebb
. Read moresource§fn after_inst(self, inst: Inst) -> Selfwhere
Self: Sized,
fn after_inst(self, inst: Inst) -> Selfwhere
Self: Sized,
inst
. Read moresource§fn at_top(self, ebb: Ebb) -> Selfwhere
Self: Sized,
fn at_top(self, ebb: Ebb) -> Selfwhere
Self: Sized,
ebb
. Read moresource§fn at_bottom(self, ebb: Ebb) -> Selfwhere
Self: Sized,
fn at_bottom(self, ebb: Ebb) -> Selfwhere
Self: Sized,
ebb
. Read moresource§fn current_ebb(&self) -> Option<Ebb>
fn current_ebb(&self) -> Option<Ebb>
source§fn current_inst(&self) -> Option<Inst>
fn current_inst(&self) -> Option<Inst>
source§fn goto_after_inst(&mut self, inst: Inst)
fn goto_after_inst(&mut self, inst: Inst)
inst
. Read moresource§fn goto_inst(&mut self, inst: Inst)
fn goto_inst(&mut self, inst: Inst)
inst
. Read moresource§fn goto_first_insertion_point(&mut self, ebb: Ebb)
fn goto_first_insertion_point(&mut self, ebb: Ebb)
ebb
,
which unlike goto_first_inst
doesn’t assume that any instructions have
been inserted into ebb
yet. Read moresource§fn goto_first_inst(&mut self, ebb: Ebb)
fn goto_first_inst(&mut self, ebb: Ebb)
ebb
.source§fn goto_last_inst(&mut self, ebb: Ebb)
fn goto_last_inst(&mut self, ebb: Ebb)
ebb
.source§fn goto_top(&mut self, ebb: Ebb)
fn goto_top(&mut self, ebb: Ebb)
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 moresource§fn goto_bottom(&mut self, ebb: Ebb)
fn goto_bottom(&mut self, ebb: Ebb)
ebb
which must be inserted into the layout.
At this position, inserted instructions will be appended to ebb
. Read more