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

Method mutate

cranelift/src/bugpoint.rs:127–139  ·  view source on GitHub ↗
(&mut self, mut func: Function)

Source from the content-addressed store, hash-verified

125 }
126
127 fn mutate(&mut self, mut func: Function) -> Option<(Function, String, ProgressStatus)> {
128 next_inst_ret_prev(&func, &mut self.block, &mut self.inst).map(|(prev_block, prev_inst)| {
129 func.layout.remove_inst(prev_inst);
130 let msg = if func.layout.block_insts(prev_block).next().is_none() {
131 // Make sure empty blocks are removed, as `next_inst_ret_prev` depends on non empty blocks
132 func.layout.remove_block(prev_block);
133 format!("Remove inst {prev_inst} and empty block {prev_block}")
134 } else {
135 format!("Remove inst {prev_inst}")
136 };
137 (func, msg, ProgressStatus::ExpandedOrShrinked)
138 })
139 }
140}
141
142/// Try to replace instructions with `iconst` or `fconst`.

Callers 1

reduceFunction · 0.45

Calls 15

next_inst_ret_prevFunction · 0.85
replace_with_constFunction · 0.85
block_instsMethod · 0.80
remove_blockMethod · 0.80
first_resultMethod · 0.80
inst_argsMethod · 0.80
value_defMethod · 0.80
instMethod · 0.80
at_instMethod · 0.80
clear_resultsMethod · 0.80
last_instMethod · 0.80
num_block_paramsMethod · 0.80

Tested by

no test coverage detected