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

Method map_values

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

Replace the values used in this instruction according to the given function.

(
        &mut self,
        pool: &mut ValueListPool,
        jump_tables: &mut ir::JumpTables,
        exception_tables: &mut ir::ExceptionTables,
        mut f: impl FnMut(Value) -> Value,
    )

Source from the content-addressed store, hash-verified

472 /// Replace the values used in this instruction according to the given
473 /// function.
474 pub fn map_values(
475 &mut self,
476 pool: &mut ValueListPool,
477 jump_tables: &mut ir::JumpTables,
478 exception_tables: &mut ir::ExceptionTables,
479 mut f: impl FnMut(Value) -> Value,
480 ) {
481 // Map all normal operator args.
482 for arg in self.arguments_mut(pool) {
483 *arg = f(*arg);
484 }
485
486 // Map all BlockCall args.
487 for block in self.branch_destination_mut(jump_tables, exception_tables) {
488 block.update_args(pool, |arg| arg.map_value(|val| f(val)));
489 }
490
491 // Map all context items.
492 if let Some(et) = self.exception_table() {
493 for ctx in exception_tables[et].contexts_mut() {
494 *ctx = f(*ctx);
495 }
496 }
497 }
498
499 /// If this is a trapping instruction, get its trap code. Otherwise, return
500 /// `None`.

Callers 3

resolve_all_aliasesMethod · 0.80
map_inst_valuesMethod · 0.80
overwrite_inst_valuesMethod · 0.80

Calls 6

update_argsMethod · 0.80
contexts_mutMethod · 0.80
fFunction · 0.50
map_valueMethod · 0.45
exception_tableMethod · 0.45

Tested by

no test coverage detected