Reference Guide
2.5.0
|
Public Member Functions | |
def | __init__ (self, variable, sub_sig=None) |
def | is_structure (self) |
def | __len__ (self) |
def | __getitem__ (self, indx) |
def | __str__ (self) |
def | to_language (self, component_indices=None, language_writer=None) |
def | __repr__ (self) |
def | __hash__ (self) |
def | __eq__ (self, other) |
def | __ne__ (self, other) |
def | __lt__ (self, other) |
def | __le__ (self, other) |
def | __gt__ (self, other) |
def | __ge__ (self, other) |
def | var_name (self) |
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. :param variable: the variable that is accessed. :type variable: str or tuple of str or list of str :param sub_sig: a signature that is to be added to this new signature. :type sub_sig: :py:class:`psyclone.core.Signature`
Definition at line 46 of file signature.py.
def psyclone.core.signature.Signature.__eq__ | ( | self, | |
other | |||
) |
Required in order to use a Signature instance as a key. Compares two objects (one of which might not be a Signature).
Definition at line 205 of file signature.py.
References psyclone.core.signature.Signature._signature, and psyclone.core.single_variable_access_info.SingleVariableAccessInfo._signature.
def psyclone.core.signature.Signature.__ge__ | ( | self, | |
other | |||
) |
Required to compare signatures. It just compares the tuples.
Definition at line 245 of file signature.py.
References psyclone.core.signature.Signature._signature, and psyclone.core.single_variable_access_info.SingleVariableAccessInfo._signature.
def psyclone.core.signature.Signature.__gt__ | ( | self, | |
other | |||
) |
Required to compare signatures. It just compares the tuples.
Definition at line 237 of file signature.py.
References psyclone.core.signature.Signature._signature, and psyclone.core.single_variable_access_info.SingleVariableAccessInfo._signature.
def psyclone.core.signature.Signature.__hash__ | ( | self | ) |
This returns a hash value that is independent of the instance. I.e. two instances with the same signature will have the same hash key.
Definition at line 197 of file signature.py.
References psyclone.core.signature.Signature._signature, and psyclone.core.single_variable_access_info.SingleVariableAccessInfo._signature.
def psyclone.core.signature.Signature.__le__ | ( | self, | |
other | |||
) |
Required to compare signatures. It just compares the tuples.
Definition at line 229 of file signature.py.
References psyclone.core.signature.Signature._signature, and psyclone.core.single_variable_access_info.SingleVariableAccessInfo._signature.
def psyclone.core.signature.Signature.__len__ | ( | self | ) |
:returns: the number of components of this signature. :rtype: int
Definition at line 94 of file signature.py.
References psyclone.core.signature.Signature._signature, and psyclone.core.single_variable_access_info.SingleVariableAccessInfo._signature.
def psyclone.core.signature.Signature.__lt__ | ( | self, | |
other | |||
) |
Required to sort signatures. It just compares the tuples.
Definition at line 221 of file signature.py.
References psyclone.core.signature.Signature._signature, and psyclone.core.single_variable_access_info.SingleVariableAccessInfo._signature.
def psyclone.core.signature.Signature.__ne__ | ( | self, | |
other | |||
) |
Required for != comparisons of Signatures with python2. Compares two objects (one of which might not be a Signature).
Definition at line 213 of file signature.py.
References psyclone.core.signature.Signature._signature, and psyclone.core.single_variable_access_info.SingleVariableAccessInfo._signature.
def psyclone.core.signature.Signature.is_structure | ( | self | ) |
:returns: True if this signature represents a structure. :rtype: bool
Definition at line 87 of file signature.py.
References psyclone.core.signature.Signature._signature, and psyclone.core.single_variable_access_info.SingleVariableAccessInfo._signature.
def psyclone.core.signature.Signature.to_language | ( | self, | |
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. :param component_indices: the indices for each component of \ the signature. :type component_indices: None (default is scalar access), or \ :py:class:`psyclone.core.component_indices.ComponentIndices` :param language_writer: a backend visitor to convert PSyIR \ expressions to a representation in the selected language. \ This is used when creating error and warning messages. :type language_writer: None (default is Fortran), or an instance of \ :py:class:`psyclone.psyir.backend.language_writer.LanguageWriter` :raises InternalError: if the number of components in this signature \ is different from the number of indices in component_indices.
Definition at line 110 of file signature.py.
References psyclone.core.signature.Signature._signature, and psyclone.core.single_variable_access_info.SingleVariableAccessInfo._signature.
def psyclone.core.signature.Signature.var_name | ( | self | ) |
:returns: the actual variable name, i.e. the first component of the signature. :rtype: str
Definition at line 254 of file signature.py.
References psyclone.core.signature.Signature._signature, and psyclone.core.single_variable_access_info.SingleVariableAccessInfo._signature.