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

Function outgoing_edges

crates/rustc_codegen_spirv/src/linker/simple_passes.rs:85–101  ·  view source on GitHub ↗
(block: &Block)

Source from the content-addressed store, hash-verified

83}
84
85pub fn outgoing_edges(block: &Block) -> impl Iterator<Item = Word> + '_ {
86 let terminator = block.instructions.last().unwrap();
87 // https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#Termination
88 let operand_indices = match terminator.class.opcode {
89 Op::Branch => (0..1).step_by(1),
90 Op::BranchConditional => (1..3).step_by(1),
91 Op::Switch => (1..terminator.operands.len()).step_by(2),
92 Op::Return
93 | Op::ReturnValue
94 | Op::Kill
95 | Op::Unreachable
96 | Op::IgnoreIntersectionKHR
97 | Op::TerminateRayKHR => (0..0).step_by(1),
98 _ => panic!("Invalid block terminator: {terminator:?}"),
99 };
100 operand_indices.map(move |i| terminator.operands[i].unwrap_id_ref())
101}
102
103pub fn compact_ids(module: &mut Module) -> u32 {
104 let mut remap = FxHashMap::default();

Callers 6

recurseFunction · 0.85
compute_predsFunction · 0.85
renameMethod · 0.85
compute_predsFunction · 0.85
rewrite_phi_sourcesFunction · 0.85
visit_postorderFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected