fhelium.ir._program
Neutral mixed-dialect xDSL program representation.
Program
class View source
Program(module: ModuleOp)Own one structurally valid, mixed-level xDSL module.
The module may contain registered FHElium operations, unknown extension dialects, partial state, and operations from several abstraction levels. Numerical analysis, transformation, backend coverage, and execution are responsibilities of consumers rather than this representation object.
material_descriptions
property
material_descriptions: dict[str, dict[str, object]]Return saved material annotations, independently of live bindings.
Descriptions are open JSON objects. They explain data to callers and preparation tools; numerical execution does not validate against them. Mutate descriptions with set_material_description.
set_material_description
method
def set_material_description(symbol: str, description: Mapping[str, object]) -> None: ...Set an annotation without checking binding identity or correctness.
empty
method
def empty(operations: Iterable[Operation]=(), *, attributes: Mapping[str, Attribute] | None=None) -> Program: ...Construct a structurally valid module with default version marks.
from_function
method
def from_function(block: Block, result_types: Sequence[Attribute]=(), *, name: str='main', visibility: str | None=None, module_attributes: Mapping[str, Attribute] | None=None) -> Program: ...Wrap one caller-built block in a top-level function.
parse
method
def parse(text: str, *, source_name: str='<unknown>') -> Program: ...Parse structural IR while preserving unknown dialect content.
load
method
def load(path: str | PathLike[str]) -> Program: ...Load one UTF-8 textual module.
to_text
method
def to_text(*, generic: bool=False, include_locations: bool=False) -> str: ...Return xDSL text for the current module.
save
method
def save(path: str | PathLike[str]) -> None: ...Write the current module and symbolic references as UTF-8 text.
clone
method
def clone() -> Program: ...Return a structurally independent copy.
verify_structure
method
def verify_structure() -> None: ...Run xDSL structural verification on the current module.
walk
method
def walk(*, include_module: bool=False) -> Iterator[Operation]: ...Traverse operations in structural preorder.
functions
property
functions: tuple[FuncOp, ...]Return registered top-level functions in module order.
function
method
def function(name: str='main') -> FuncOp: ...Return the uniquely named top-level registered function.
single_block
method
def single_block(name: str='main') -> Block: ...Return one function's block when a consumer needs that form.