MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / prev_inst_position

Method prev_inst_position

cranelift/codegen/src/cursor.rs:471–494  ·  view source on GitHub ↗

Get the position that a `cursor.prev_inst()` call would move this cursor to, but do not update this cursor's position.

(&self)

Source from the content-addressed store, hash-verified

469 /// Get the position that a `cursor.prev_inst()` call would move this cursor
470 /// to, but do not update this cursor's position.
471 fn prev_inst_position(&self) -> Option<CursorPosition> {
472 use self::CursorPosition::*;
473 match self.position() {
474 Nowhere | Before(..) => None,
475 At(inst) => {
476 if let Some(prev) = self.layout().prev_inst(inst) {
477 Some(At(prev))
478 } else {
479 Some(Before(
480 self.layout()
481 .inst_block(inst)
482 .expect("current instruction removed?"),
483 ))
484 }
485 }
486 After(block) => {
487 if let Some(prev) = self.layout().last_inst(block) {
488 Some(At(prev))
489 } else {
490 Some(Before(block))
491 }
492 }
493 }
494 }
495
496 /// Move to the previous instruction in the same block and return it.
497 ///

Callers 2

prev_positionMethod · 0.80
prev_instMethod · 0.80

Implementers 2

cursor.rscranelift/codegen/src/cursor.rs
layout.rscranelift/codegen/src/ir/layout.rs

Calls 6

inst_blockMethod · 0.80
last_instMethod · 0.80
positionMethod · 0.45
prev_instMethod · 0.45
layoutMethod · 0.45
expectMethod · 0.45

Tested by

no test coverage detected