IR

IR

40 members

The intermediate representation every backend reads: nodes, statements and declarations.

The signature, the description and the examples come from the compiler's own source at commit 26de7be8.

AddressSpace Type
The BindingDecl.space a resource binding lives in: WGSL's var<uniform> or var<storage, ...>.
ALL_CAPABILITIES Constant
Every Capability, as a runtime value: the list a capability matrix, a doc generator or a coverage check iterates.
ASSEMBLED_AS Constant
Non-enumerable marker key on a FuncDecl: the name the declaration was last assembled under by module.
BindingDecl Interface
A ModuleDecl.bindings entry: a resource bound at a slot.
BinOp Type
The operator tag on Expr.binop: arithmetic (+ - * /), remainder (%) and bitwise.
Capability Type
A GPU or language feature a target backend may or may not support.
CmpOp Type
The operator tag on Expr.compare: the six relational operators.
ConstDecl Interface
A ModuleDecl.consts entry: a module-scope constant.
DeclarableCapability Type
The capabilities a module may name in ModuleDecl.enables: Capability minus the nine capabilities derived from the module's shape.
DiagnosticDirective Interface
One WGSL diagnostic; directive.
EntryParam Interface
An entry-point parameter: it carries a @builtin(...) or a @location(n).
Expr Type
Every expression shape the IR can hold: the closed set that Node and ReadonlyNode build and that the WGSL, GLSL and CPU backends walk to emit or evaluate.
ExternVarDecl Interface
A host-provided global, the declaration behind externVar.
FuncDecl Interface
A ModuleDecl.funcs entry: a WGSL/GLSL function, either an ordinary helper or a pipeline entry point (stage set).
grad Function
Differentiate a function of a module with respect to one of its parameters, in forward mode, and add the derivative as a new function.
GradOptions Interface
Options for grad.
GradResult Interface
What grad returns: the module with the derivative function added, and its name.
installStmtSink Function
Installs the statement sink that Node.assign() writes through.
isNodeValue Function
Runtime type guard for "is this value a node".
lift Function
Normalizes a NodeLike operand to a ReadonlyNode: a JS number becomes an f32 literal, and an existing node passes through unchanged.
LogOp Type
The operator tag on Expr.logical: the short-circuiting boolean operators && and ||.
ModuleDecl Interface
The whole-shader unit: everything a backend needs to emit a complete WGSL or GLSL ES 3.00 module, or to evaluate one on the CPU oracle.
ModuleVarDecl Interface
One entry of ModuleDecl.vars: a module-scope variable that is not a resource.
Node Class
The write-capable node.
NODE_BRAND Constant
The symbol every node carries as a brand, installed once on the ReadonlyNode prototype.
OverrideDecl Interface
A pipeline specialization constant, the declaration behind overrideConst.
RawPayload Type
The argument to rawStmt: the wgsl and glsl source text of a raw statement.
RawStmt Type
The raw statement node: a fragment of target source spliced verbatim into a function body, spelled per target.
ReadonlyNode Class
The read-only base of every value node: every literal, parameter, constRef and Let() binding is a ReadonlyNode.
renameVarrefsInFunc Function
Renames variable references in the body of f.
rewriteExprsInFunc Function
Applies rewrite to every expression in the body of f and returns the rewritten function.
SourceSpan Interface
Where an IR node came from in its authored source: the file, the exact UTF-16 offsets, and the line and character of each end for display.
sourceSpanOf Function
The authored source span of an IR node, or undefined when it has none.
stageOf Function
The stage of a function declaration: 'vertex', 'fragment' or 'compute' for an entry point, undefined for a helper.
Stmt Type
Every statement shape the IR can hold: the ordered readonly Stmt[] that makes up a FuncDecl.body.
StructDecl Interface
A ModuleDecl.structs entry: a WGSL struct declaration.
StructField Interface
One field of a StructDecl: a plain data member of a uniform or storage struct, or, in a vertex/fragment I/O struct, a member carrying a @builtin or @location attribute.
WorkgroupShape Type
The x, y and z extents of a compute entry's workgroup, WGSL's @workgroup_size(x, y, z).
workgroupShapeOf Function
The workgroup shape of a compute entry: the structured workgroupShape field first, then [workgroupSize, 1, 1], then the extents of the @workgroup_size(x, y, z) attribute string; undefined when none is present.
workgroupSizeOf Function
The x workgroup size of a compute entry: the structured workgroupSize field first, then the @workgroup_size(n) attribute string; undefined when neither is present.

Edit this page Report a problem