Apply `generic_args` to all the `ConcreteOrParam`s in this `Replacements` (i.e. replacing `Param(i)` with `generic_args[i]`), producing a stream of "replace the operand at `OperandLocation` with this concrete `CopyOperand`". The `concrete_instance_id` closure should look up and/or allocate an ID for a specific concrete `Instance`.
(
&'a self,
generic_args: &'a [CopyOperand],
mut concrete_instance_id: impl FnMut(Instance<SmallVec<[CopyOperand; 4]>>) -> Word + 'a,
)
| 478 | /// The `concrete_instance_id` closure should look up and/or allocate an ID |
| 479 | /// for a specific concrete `Instance`. |
| 480 | fn to_concrete<'a>( |
| 481 | &'a self, |
| 482 | generic_args: &'a [CopyOperand], |
| 483 | mut concrete_instance_id: impl FnMut(Instance<SmallVec<[CopyOperand; 4]>>) -> Word + 'a, |
| 484 | ) -> impl Iterator<Item = (OperandLocation, CopyOperand)> + 'a { |
| 485 | self.with_instance |
| 486 | .iter() |
| 487 | .flat_map(move |(instance, locations)| { |
| 488 | let concrete = CopyOperand::IdRef(concrete_instance_id( |
| 489 | instance |
| 490 | .as_ref() |
| 491 | .map_generic_args(|x| x.apply_generic_args(generic_args)), |
| 492 | )); |
| 493 | locations.iter().map(move |&loc| (loc, concrete)) |
| 494 | }) |
| 495 | .chain( |
| 496 | self.with_concrete_or_param |
| 497 | .iter() |
| 498 | .map(move |&(loc, x)| (loc, x.apply_generic_args(generic_args))), |
| 499 | ) |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | /// Computed "generic" shape for a SPIR-V global/function. In the interest of efficient |
no test coverage detected