(block: &Block)
| 83 | } |
| 84 | |
| 85 | pub 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 | |
| 103 | pub fn compact_ids(module: &mut Module) -> u32 { |
| 104 | let mut remap = FxHashMap::default(); |
no outgoing calls
no test coverage detected