qat.experimental.frontend.importer.environment module
- class EnvironmentTracker
Bases:
Generic[_AttributeType]Models an environment to track named variables and their current SSA values.
This is not designed to support stacked environments or deal with phi nodes; it is intended to support simple linear programs that translate a linear list of operations, but has scope for generalisations in the future.
This is a simple wrapper around a
bidictthat provides a more convenient interface for looking up and setting variables by name. It encapsulates the responsibility of tracking SSA values without exposing the underlying implementation.- get_by_name(name, default=None)
Get the current SSA value for a variable by name.
- Parameters:
- Return type:
Optional[SSAValue[TypeVar(_AttributeType, bound=Attribute)]]- Returns:
The current SSA value for the variable, or default when the name is not present.
- items()
Returns name and value pairs.
- set_by_name(name, value)
Set the current SSA value for a variable by name.
- set_by_value(value, new_value)
Set the current SSA value for a variable by value.