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

Method insert_inst

cranelift/codegen/src/ir/layout.rs:474–492  ·  view source on GitHub ↗

Insert `inst` before the instruction `before` in the same block.

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

Source from the content-addressed store, hash-verified

472
473 /// Insert `inst` before the instruction `before` in the same block.
474 pub fn insert_inst(&mut self, inst: Inst, before: Inst) {
475 debug_assert_eq!(self.inst_block(inst), None);
476 let block = self
477 .inst_block(before)
478 .expect("Instruction before insertion point not in the layout");
479 let after = self.insts[before].prev;
480 {
481 let inst_node = &mut self.insts[inst];
482 inst_node.block = block.into();
483 inst_node.next = before.into();
484 inst_node.prev = after;
485 }
486 self.insts[before].prev = inst.into();
487 match after.expand() {
488 None => self.blocks[block].first_inst = inst.into(),
489 Some(a) => self.insts[a].next = inst.into(),
490 }
491 self.assign_inst_seq(inst);
492 }
493
494 /// Remove `inst` from the layout.
495 pub fn remove_inst(&mut self, inst: Inst) {

Callers 5

mutateMethod · 0.45
insert_instFunction · 0.45
build_aux_instMethod · 0.45
maybe_remat_argMethod · 0.45
process_elab_stackMethod · 0.45

Calls 4

inst_blockMethod · 0.80
assign_inst_seqMethod · 0.80
expectMethod · 0.45
expandMethod · 0.45

Tested by 1

insert_instFunction · 0.36