fhelium.compile._pipeline
Compose Compile passes over Programs and shared workspace data.
DecisionRecord
class View source
DecisionRecord(subject: str, selected: str | None = None, candidates: tuple[str, ...] = (), details: tuple[str, ...] = ())Describe one inspectable choice made during a transformation.
Attributes
| Name | Type | Default/value |
|---|---|---|
subject | str | |
selected | str | None | None |
candidates | tuple[str, ...] | () |
details | tuple[str, ...] | () |
Pass
class View source
Pass()Bases: Protocol
Define one locally applicable transformation or analysis step.
name
property
name: strStable name used in pipeline composition and reports.
run
method
def run(compilation: Compilation, /) -> PassResult: ...Inspect or transform the current Compilation and report the outcome.
PassReport
class View source
PassReport(name: str, stats: PassStats, diagnostics: tuple[str, ...] = (), decisions: tuple[DecisionRecord, ...] = ())Record one pass's activity, diagnostics, and choices.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | str | |
stats | PassStats | |
diagnostics | tuple[str, ...] | () |
decisions | tuple[DecisionRecord, ...] | () |
PassResult
class View source
PassResult(program: Program, stats: PassStats = PassStats(), diagnostics: tuple[str, ...] = (), decisions: tuple[DecisionRecord, ...] = ())Program, counts, diagnostics, and choices returned by one pass.
Attributes
| Name | Type | Default/value |
|---|---|---|
program | Program | |
stats | PassStats | PassStats() |
diagnostics | tuple[str, ...] | () |
decisions | tuple[DecisionRecord, ...] | () |
changed
property
changed: boolWhether the reported counts describe an IR change.
unchanged
method
def unchanged(program: Program, *, matched: int=0, skipped: int=0, diagnostics: tuple[str, ...]=(), decisions: tuple[DecisionRecord, ...]=()) -> PassResult: ...Record a normal pass result that preserves the Program.
PassStats
class View source
PassStats(matched: int = 0, transformed: int = 0, inserted: int = 0, removed: int = 0, skipped: int = 0)Count one pass's observed and changed patterns.
Attributes
| Name | Type | Default/value |
|---|---|---|
matched | int | 0 |
transformed | int | 0 |
inserted | int | 0 |
removed | int | 0 |
skipped | int | 0 |
Pipeline
class View source
Pipeline(passes: tuple[Pass, ...] = ())Run an ordered, dependency-free tuple of partial transformations.
Attributes
| Name | Type | Default/value |
|---|---|---|
passes | tuple[Pass, ...] | () |
names
property
names: tuple[str, ...]Return pass names in execution order.
run
method
def run(compilation: Compilation) -> Compilation: ...Clone and transform one Compilation while retaining its workspace.
then
method
def then(*passes: Pass) -> Pipeline: ...Append passes in order.
before
method
def before(target: str, *passes: Pass) -> Pipeline: ...Insert passes before one uniquely named pass.
after
method
def after(target: str, *passes: Pass) -> Pipeline: ...Insert passes after one uniquely named pass.
replace
method
def replace(target: str, *passes: Pass) -> Pipeline: ...Replace one uniquely named pass.
TransformError
class View source
TransformError()Bases: RuntimeError
Report a malformed Compile transformation request or result.