tvm_tirx.script.ir_builder.parser_protocol.emit_

Contents

tvm_tirx.script.ir_builder.parser_protocol.emit_#

tvm_tirx.script.ir_builder.parser_protocol.emit_(value, *, loc=None)#

Consume a source expression statement.

Parameters:
  • value (Any) – Once-evaluated expression result. AlreadyEmitted receipts and None produce no additional emission.

  • loc (LocationEntry, Location or None, optional) – Location of the emitted statement and expression, or the existing node in an AlreadyEmitted receipt. UnknownLoc leaves explicit attribution unspecified. Active caller provenance is composed without adding a construction context; native frames retain the location for finalization.

Returns:

None – No source-visible value.

Return type:

None

Notes

Requires an active language variant function/region when emitting IR. TIRx adds statements, evaluates expressions, and can enter concise frames. Variables, text, layouts, and meta_class instances are inert; sequences are consumed elementwise. Relax accepts only void expressions (or None/AlreadyEmitted); unsupported values raise TypeError and non-void expressions raise ValueError. An explicit loc annotates the exact previously emitted node in a receipt without emitting it again. Known builder results need no separate result wrapper; opaque source calls keep their scoped provenance before this hook.

# Source
T.evaluate(1)
# Generated builder
X.emit_(X.evaluate(1), loc=_L_0)