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

Function shift_ids

crates/rustc_codegen_spirv/src/linker/simple_passes.rs:9–25  ·  view source on GitHub ↗
(module: &mut Module, add: u32)

Source from the content-addressed store, hash-verified

7use std::mem::take;
8
9pub fn shift_ids(module: &mut Module, add: u32) {
10 module.all_inst_iter_mut().for_each(|inst| {
11 if let Some(ref mut result_id) = &mut inst.result_id {
12 *result_id += add;
13 }
14
15 if let Some(ref mut result_type) = &mut inst.result_type {
16 *result_type += add;
17 }
18
19 inst.operands.iter_mut().for_each(|op| {
20 if let Some(w) = op.id_ref_any_mut() {
21 *w += add;
22 }
23 });
24 });
25}
26
27/// spir-v requires basic blocks to be ordered so that if A dominates B, A appears before B (except
28/// in the case of backedges). Reverse post-order is a good ordering that satisfies this condition

Callers 1

linkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected