psyclone.psyir.symbols.generic_interface_symbol#

This module contains the GenericInterfaceSymbol.

Classes#

class psyclone.psyir.symbols.generic_interface_symbol.GenericInterfaceSymbol(name, routines, **kwargs)[source]#

Symbol identifying a generic interface that maps to a number of different callable routines.

Unlike the parent classes, the constructor for this class cannot be supplied with the ‘is_pure’, ‘is_elemental’ or ‘datatype’ properties as these are derived from the RoutineSymbols contained within this interface.

Parameters:
  • name (str) – name of the interface.

  • routines (list[tuple[ psyclone.psyir.symbols.RoutineSymbol, bool]]) – the routines that this interface provides access to and whether or not each of them is a module procedure.

  • kwargs (unwrapped dict.) – additional keyword arguments provided by psyclone.psyir.symbols.TypedSymbol. Note that ‘is_pure’, ‘is_elemental’ and ‘datatype’ are not supported.

Raises:

ValueError – if passed the ‘is_pure’, ‘is_elemental’ or ‘datatype’ properties.

Inheritance

Inheritance diagram of GenericInterfaceSymbol
class RoutineInfo(symbol, from_container)[source]#

Holds information on a single routine member of an interface.

Parameters:
  • symbol (RoutineSymbol) – the symbol representing the routine.

  • from_container (bool) – whether or not this routine is from a Container (i.e. a ‘module procedure’ in Fortran).

property container_routines#
Returns:

those routines that are defined in a Container.

Return type:

list[psyclone.psyir.symbols.RoutineSymbol]

copy()[source]#

Create and return a copy of this object. Any references to the original will not be affected so the copy will not be referred to by any other object.

Returns:

A symbol object with the same properties as this symbol object.

Return type:

psyclone.psyir.symbols.GenericInterfaceSymbol

copy_properties(symbol_in, exclude_interface=False)[source]#

Replace all properties in this object with the properties from symbol_in, apart from the name (which is immutable) and visibility. If exclude_interface is True, the interface is also not updated.

Parameters:
  • symbol_in (RoutineSymbol) – the Symbol to copy properties from.

  • exclude_interface (bool) – whether or not to copy the interface property of the provided Symbol (default is to include it).

property datatype: DataType | DataTypeSymbol#
Returns:

the datatype of this symbol if it can be determined.

property external_routines#
Returns:

those routines that are external procedures.

Return type:

list[psyclone.psyir.symbols.RoutineSymbol]

get_all_accessed_symbols()[source]#
Return type:

set[Symbol]

Returns:

a set of all the symbols accessed inside this interface.

property is_elemental: bool | None#
Returns:

whether the routine represented by this Symbol is elemental (acts element-by-element on supplied array arguments) or None if this is not known.

property is_pure: bool | None#
Returns:

whether the routine represented by this Symbol has no side effects (guarantees that the routine always returns the same result for a given set of inputs).

replace_symbols_using(table_or_symbol)[source]#

Replace any Symbols referred to by this object with those in the supplied SymbolTable (or just the supplied Symbol instance) if they have matching names. If there is no match for a given Symbol then it is left unchanged.

Before performing any replacement, the supplied symbol is specialised to a RoutineSymbol, if necessary.

Parameters:

table_or_symbol (psyclone.psyir.symbols.SymbolTable | psyclone.psyir.symbols.Symbol) – the symbol table from which to get replacement symbols or a single, replacement Symbol.

property routines#
Returns:

information on all of the routines to which this interface provides access.

Return type:

list[tuple[psyclone.psyir.symbols.RoutineSymbol, bool]]