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

Function undef_for

crates/rustc_codegen_spirv/src/linker/mem2reg.rs:398–413  ·  view source on GitHub ↗

These can't be part of the Renamer impl due to borrowck rules.

(
    header: &mut ModuleHeader,
    types_global_values: &mut Vec<Instruction>,
    ty: Word,
)

Source from the content-addressed store, hash-verified

396
397// These can't be part of the Renamer impl due to borrowck rules.
398fn undef_for(
399 header: &mut ModuleHeader,
400 types_global_values: &mut Vec<Instruction>,
401 ty: Word,
402) -> Word {
403 // TODO: This is horribly slow, fix this
404 let existing = types_global_values
405 .iter()
406 .find(|inst| inst.class.opcode == Op::Undef && inst.result_type.unwrap() == ty);
407 if let Some(existing) = existing {
408 return existing.result_id.unwrap();
409 }
410 let inst_id = id(header);
411 types_global_values.push(Instruction::new(Op::Undef, Some(ty), Some(inst_id), vec![]));
412 inst_id
413}
414fn top_stack_or_undef(
415 header: &mut ModuleHeader,
416 types_global_values: &mut Vec<Instruction>,

Callers 1

top_stack_or_undefFunction · 0.85

Calls 2

idFunction · 0.85
iterMethod · 0.80

Tested by

no test coverage detected