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

Method insert_inst

cranelift/codegen/src/cursor.rs:535–542  ·  view source on GitHub ↗

Insert an instruction at the current position. - If pointing at an instruction, the new instruction is inserted before the current instruction. - If pointing at the bottom of a block, the new instruction is appended to the block. - Otherwise panic. In either case, the cursor is not moved, such that repeated calls to `insert_inst()` causes instructions to appear in insertion order in the block.

(&mut self, inst: ir::Inst)

Source from the content-addressed store, hash-verified

533 /// In either case, the cursor is not moved, such that repeated calls to `insert_inst()` causes
534 /// instructions to appear in insertion order in the block.
535 fn insert_inst(&mut self, inst: ir::Inst) {
536 use self::CursorPosition::*;
537 match self.position() {
538 Nowhere | Before(..) => panic!("Invalid insert_inst position"),
539 At(cur) => self.layout_mut().insert_inst(inst, cur),
540 After(block) => self.layout_mut().append_inst(inst, block),
541 }
542 }
543
544 /// Remove the instruction under the cursor.
545 ///

Callers 3

replace_instMethod · 0.45
insert_built_instMethod · 0.45
insert_aux_instMethod · 0.45

Implementers 2

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

Calls 3

append_instMethod · 0.80
positionMethod · 0.45
layout_mutMethod · 0.45

Tested by

no test coverage detected