Returns the number of "generic" parameters `operand` "takes", either because it's specialized by, or it refers to a "generic" global/function. In the latter case, the `&Generic` for that global/function is also returned.
(&self, operand: &Operand)
| 552 | /// because it's specialized by, or it refers to a "generic" global/function. |
| 553 | /// In the latter case, the `&Generic` for that global/function is also returned. |
| 554 | fn params_needed_by(&self, operand: &Operand) -> (u32, Option<&Generic>) { |
| 555 | if self.specialization.specialize_operand(operand) { |
| 556 | // Each operand we specialize by is one leaf "generic" parameter. |
| 557 | (1, None) |
| 558 | } else if let Operand::IdRef(id) = operand { |
| 559 | self.generics |
| 560 | .get(id) |
| 561 | .map_or((0, None), |generic| (generic.param_count, Some(generic))) |
| 562 | } else { |
| 563 | (0, None) |
| 564 | } |
| 565 | } |
| 566 | |
| 567 | fn collect_generics(&mut self, module: &Module) { |
| 568 | // Process all defining instructions for globals (types, constants, |
no test coverage detected