Expand description
Frontend for SPIR-V (Standard Portable Intermediate Representation).
§ID lookups
Our IR links to everything with Handle
, while SPIR-V uses IDs.
In order to keep track of the associations, the parser has many lookup tables.
There map spv::Word
into a specific IR handle, plus potentially a bit of
extra info, such as the related SPIR-V type ID.
TODO: would be nice to find ways that avoid looking up as much
§Inputs/Outputs
We create a private variable for each input/output. The relevant inputs are populated at the start of an entry point. The outputs are saved at the end.
The function associated with an entry point is wrapped in another function,
such that we can handle any Return
statements without problems.
§Row-major matrices
We don’t handle them natively, since the IR only expects column majority.
Instead, we detect when such matrix is accessed in the OpAccessChain
,
and we generate a parallel expression that loads the value, but transposed.
This value then gets used instead of OpLoad
result later on.
Modules§
Structs§
- Block
Context 🔒 - Fragments of Naga IR, to be assembled into
Statements
once data flow is resolved. - Body 🔒
- An intermediate representation of a Naga
Block
. - Decoration 🔒
- Decoration
Flags 🔒 - Entry
Point 🔒 - Frontend
- Instruction
- Lookup
Constant 🔒 - Lookup
Expression 🔒 - Information about SPIR-V result ids, stored in
Frontend::lookup_expression
. - Lookup
Function 🔒 - Lookup
Function 🔒Type - Lookup
Member 🔒 - Lookup
Type 🔒 - Lookup
Variable 🔒 - Options
- PhiExpression 🔒
Enums§
- Body
Fragment 🔒 - An intermediate representation of a Naga
Statement
. - Constant 🔒
- Error
- Extended
Class 🔒 - Lookup
Load 🔒Override - Majority 🔒
- Merge
Block 🔒Information - Module
State - Sign
Anchor 🔒 - Variable 🔒
Constants§
Traits§
Functions§
- is_
parent 🔒 - Helper function to check if
child
is in the scope ofparent
- make_
index_ 🔒literal - parse_
u8_ slice - resolve_
constant 🔒
Type Aliases§
- Body
Index 🔒 - An index into the
BlockContext::bodies
table. - Member
Index 🔒