MCPcopy Create free account
hub / github.com/Rust-GPU/rust-gpu / params_needed_by

Method params_needed_by

crates/rustc_codegen_spirv/src/linker/specializer.rs:554–565  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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,

Callers 2

dump_instancesMethod · 0.80

Calls 2

specialize_operandMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected