psyclone.core.variables_access_map#
This module provides management of variable access information.
Classes#
VariablesAccessMap: This dictionary stores AccessSequence instances indexed by
- class psyclone.core.variables_access_map.VariablesAccessMap[source]#
This dictionary stores AccessSequence instances indexed by their signature.
Inheritance

- add_access(signature, access_type, node)[source]#
Adds access information for the variable with the given signature.
- Parameters:
signature (
Signature) – the signature of the variable.access_type (
AccessType) – the type of access (READ, WRITE, …)node (
Node) – Node in PSyIR in which the access happens.
- Return type:
None
- property all_data_accesses: List[Signature]#
- Returns:
all Signatures in this instance that have a data access (i.e. the data associated with them is read or written).
- property all_signatures#
- Returns:
all signatures contained in this instance, sorted (in order to make test results reproducible).
- Return type:
List[
psyclone.core.Signature]
- has_read_write(signature)[source]#
Checks if the specified variable signature has at least one READWRITE access (which is typically only used in a function call).
- Parameters:
signature (
psyclone.core.Signature) – signature of the variable- Returns:
True if the specified variable name has (at least one) READWRITE access.
- Return type:
bool
- Raises:
KeyError if the signature cannot be found.
- is_called(signature)[source]#
- Parameters:
signature (
Signature) – signature of the variable.- Return type:
bool- Returns:
True if the specified variable is called at least once.
- is_read(signature)[source]#
Checks if the specified variable signature is at least read once.
- Parameters:
signature (
psyclone.core.Signature) – signature of the variable- Return type:
bool- Returns:
True if the specified variable name is read (at least once).
- Raises:
KeyError if the signature cannot be found.
- is_written(signature)[source]#
Checks if the specified variable signature is at least written once.
- Parameters:
signature (
Signature) – signature of the variable.- Return type:
bool- Returns:
True if the specified variable is written (at least once).
- Raises:
KeyError if the signature name cannot be found.
- update(other_access_map)[source]#
Updates this dictionary with the entries in the provided VariablesAccessMap. If there are repeated signatures, the provided values are appended to the existing sequence of accesses.
- Parameters:
other_access_map (
VariablesAccessMap) – the other VariablesAccessMap instance.- Return type:
None