tvm_tirx.script.parser.protocol_registry.register_mutable_decl

tvm_tirx.script.parser.protocol_registry.register_mutable_decl#

tvm_tirx.script.parser.protocol_registry.register_mutable_decl(namespace_path, *, syntax='call')#

Register persistent mutable storage syntax at a fixed namespace path.

Parameters:
  • namespace_path (str) – Canonical registered namespace alias and exported constructor path.

  • syntax (str, optional) – Declaration form: "call" (the default) for a constructor call, "annotation" for an annotated local declaration, or "parameter" for a function parameter annotation. Repeated registration adds forms for the same path without removing existing ones.

Returns:

Callable – Registration decorator that returns its constructor unchanged.

Raises:

ValueError – If syntax is not one of the three supported forms.

Return type:

Callable[[_Callable], _Callable]

Notes

Explicit declarations take precedence over mutable target updates; storage creation and updates stay outside ordinary bind_.

register_mutable_decl("tirx.int32", syntax="annotation")(T.int32)
# Source: x: T.int32 = 0
# Builder: x = X.decl_mutable_cell_(0, ty=X.int32, name="x")