tvm_tirx.script.ir_builder.parser_protocol#
Shared structural contract for source-to-builder rewriting.
The source namespace selects language variant X; shared module support uses I.
For example, target()[index()] = value() lowers to
X.setitem_(value=value(), target=target(), key=index()). Python evaluates the
keywords in that order, preserving the assignment’s RHS-first semantics.
Native frames own construction state. Language variant implementations live in
builder.parser_protocol; shared defaults cover module operations and metadata,
while language-specific contract stubs raise NotImplementedError.
Special syntax markers are documented in the special protocol section below.
Functions and Modules#
Start a ir_module frame. |
|
|
Register a function signature or a completed function in the active module. |
|
Create the native function frame used for signature and body construction. |
|
Add a parameter to the active native function signature. |
|
Set the active native function's source name. |
|
Set the active native function's return annotation. |
Bindings and Statements#
|
Resolve a named global-info selector in the current module context. |
|
Construct a call to a declared module function. |
|
Register a concrete function member or retain ordinary class setup. |
|
Apply the language variant's ordinary assignment policy. |
|
Introduce explicitly declared mutable storage. |
|
Emit an update through an existing mutable handle without rebinding it. |
|
Expose elements for ordinary Python target unpacking. |
|
Consume a source expression statement. |
|
Apply an indexed assignment using already-evaluated operands. |
|
Apply an attribute assignment using already-evaluated operands. |
Control Flow#
|
Create the native conditional frame for a source if statement. |
|
Create the true branch of the active conditional. |
|
Create the false branch of the active conditional. |
|
Configure and return the native iteration frame for a source for loop. |
|
Create a native while-loop frame. |
|
Normalize builtin range syntax to a native serial loop frame. |
|
Emit break for the enclosing language variant loop. |
|
Emit continue for the enclosing language variant loop. |
|
Record a language variant function return while continuing Python construction. |
|
Emit a runtime assertion. |
Operators#
|
Construct conditional evaluation from eagerly constructed operands. |
|
Construct a conjunction from ordinary boolean or comparison operands. |
|
Construct a disjunction from already-evaluated operands. |
|
Negate a host or language variant boolean without coercing IR truth in Python. |
|
Construct the < comparison in written operand order. |
|
Construct the <= comparison in written operand order. |
|
Construct the > comparison in written operand order. |
|
Construct the >= comparison in written operand order. |
|
Construct the == comparison in written operand order. |
|
Construct the != comparison in written operand order. |