How a pass is written

A pass takes a whole module and its word count, changes it in place and returns the new count. It keeps no object per instruction: its tables are arrays indexed by id (the module's bound says how many) and by instruction, in one block that it frees before it returns. It walks the words a fixed number of times. What it does not know, it leaves: an instruction of an extension is kept, with everything its operands might name.


Made from docs/layers/gpu/spirv-opt.md at 69237645142c. GPL-3.0-or-later.