fhelium.ir._state
Shared dataflow analysis for partially represented FHElium value state.
InferredValueState
class View source
InferredValueState(value: SSAValue, fields: Mapping[str, StateFact] = field(default_factory=dict))Describe inferred state for one SSA value without modifying its IR type.
Attributes
| Name | Type | Default/value |
|---|---|---|
value | SSAValue | |
fields | Mapping[str, StateFact] | field(default_factory=dict) |
field
method
def field(name: str) -> StateFact: ...Return one field or a dynamic placeholder when it is not represented.
with_fields
method
def with_fields(**updates: StateFact) -> InferredValueState: ...Return the same SSA identity with updated analysis fields.
StateFact
class View source
StateFact(status: StateStatus, value: object | None = None, conflicting_values: tuple[str, ...] = ())Record one known, symbolic, dynamic, or conflicting state property.
Attributes
| Name | Type | Default/value |
|---|---|---|
status | StateStatus | |
value | object | None | None |
conflicting_values | tuple[str, ...] | () |
known
method
def known(value: object) -> StateFact: ...Construct one represented or inferred known state property.
symbolic
method
def symbolic(operator: str, *operands: object) -> StateFact: ...Construct one symbolic state equation.
dynamic
method
def dynamic() -> StateFact: ...Construct one property that requires later specialization.
conflict
method
def conflict(*conflicting_values: str) -> StateFact: ...Construct one property from incompatible represented values.
StateStatus
type alias View source
StateStatus = Literal['known', 'symbolic', 'dynamic', 'conflict']SymbolicExpression
class View source
SymbolicExpression(operator: str, operands: tuple[object, ...])Represent a state equation whose operands are not all compile-time values.
Attributes
| Name | Type | Default/value |
|---|---|---|
operator | str | |
operands | tuple[object, ...] |
analyze_state_flow
function View source
def analyze_state_flow(program: Program, *, function: str='main') -> Mapping[SSAValue, InferredValueState]: ...Infer shared value-state equations through one single-block function.
Missing properties remain dynamic and incompatible represented properties become conflicts. The analysis does not reject or rewrite the Program.