psyclone.core.signature

This module provides management of variable access information.

Classes

  • Signature: Given a variable access of the form a(i,j)%b(k,l)%c, the signature

class psyclone.core.signature.Signature(variable, sub_sig=None)

Given a variable access of the form a(i,j)%b(k,l)%c, the signature of this access is the tuple (a,b,c). For a simple scalar variable a the signature would just be (a,). The signature is the key used in VariablesAccessInfo. In order to make sure two different signature objects containing the same variable can be used as a key, this class implements __hash__ and other special functions. The constructor also supports appending an existing signature to this new signature using the sub_sig argument. This is used in StructureReference to assemble the overall signature of a structure access.

Parameters:
  • variable (str or tuple of str or list of str) – the variable that is accessed.

  • sub_sig (psyclone.core.Signature) – a signature that is to be added to this new signature.

Inheritance

Inheritance diagram of Signature
property is_structure
Returns:

True if this signature represents a structure.

Return type:

bool

to_language(component_indices=None, language_writer=None)

Converts this signature with the provided indices to a string in the selected language.

TODO 1320 This subroutine can be removed when we stop supporting strings - then we can use a PSyIR writer for the ReferenceNode to provide the right string.

Parameters:
Raises:

InternalError – if the number of components in this signature is different from the number of indices in component_indices.

property var_name
Returns:

the actual variable name, i.e. the first component of the signature.

Return type:

str