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,
)
| 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`. |
no test coverage detected