Reference Guide
2.5.0
|
Classes | |
class | Visibility |
Public Member Functions | |
def | __init__ (self, name, visibility=DEFAULT_VISIBILITY, interface=None) |
def | copy (self) |
def | copy_properties (self, symbol_in) |
def | specialise (self, subclass, **kwargs) |
def | get_external_symbol (self) |
def | resolve_type (self) |
def | name (self) |
def | visibility (self) |
def | visibility (self, value) |
def | interface (self) |
def | interface (self, value) |
def | is_automatic (self) |
def | is_modulevar (self) |
def | is_import (self) |
def | is_argument (self) |
def | is_commonblock (self) |
def | is_static (self) |
def | is_unresolved (self) |
def | is_unknown_interface (self) |
def | find_symbol_table (self, node) |
def | __str__ (self) |
def | is_array (self) |
def | is_array_access (self, index_variable=None, access_info=None) |
Public Attributes | |
interface | |
visibility | |
Static Public Attributes | |
DEFAULT_VISIBILITY = Visibility.PUBLIC | |
Generic Symbol item for the Symbol Table and PSyIR References. It has an immutable name label because it must always match with the key in the SymbolTable. If the symbol is private then it is only visible to those nodes that are descendants of the Node to which its containing Symbol Table belongs. :param str name: name of the symbol. :param visibility: the visibility of the symbol. :type visibility: :py:class:`psyclone.psyir.symbols.Symbol.Visibility` :param interface: optional object describing the interface to this \ symbol (i.e. whether it is passed as a routine argument or \ accessed in some other way). Defaults to \ :py:class:`psyclone.psyir.symbols.AutomaticInterface` :type interface: Optional[ \ :py:class:`psyclone.psyir.symbols.symbol.SymbolInterface`] :raises TypeError: if the name is not a str.
def psyclone.psyir.symbols.symbol.Symbol.copy | ( | self | ) |
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. :rtype: :py:class:`psyclone.psyir.symbols.Symbol`
Reimplemented in psyclone.psyir.symbols.typed_symbol.TypedSymbol, psyclone.psyir.symbols.generic_interface_symbol.GenericInterfaceSymbol, psyclone.psyir.symbols.datasymbol.DataSymbol, psyclone.psyir.symbols.data_type_symbol.DataTypeSymbol, and psyclone.psyir.symbols.containersymbol.ContainerSymbol.
Definition at line 137 of file symbol.py.
References psyclone.psyir.symbols.datasymbol.DataSymbol.interface, psyclone.psyir.symbols.symbol.Symbol.interface, psyclone.psyir.symbols.typed_symbol.TypedSymbol.interface, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.GridArg.name, psyclone.domain.gocean.transformations.gocean_const_loop_bounds_trans.GOConstLoopBoundsTrans.name(), psyclone.domain.gocean.transformations.gocean_move_iteration_boundaries_inside_kernel_trans.GOMoveIterationBoundariesInsideKernelTrans.name(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans.name(), psyclone.domain.lfric.kernel.lfric_kernel_metadata.LFRicKernelMetadata.name, psyclone.domain.nemo.transformations.create_nemo_invoke_schedule_trans.CreateNemoInvokeScheduleTrans.name(), psyclone.domain.nemo.transformations.create_nemo_psy_trans.CreateNemoPSyTrans.name(), psyclone.domain.nemo.transformations.nemo_allarrayrange2loop_trans.NemoAllArrayRange2LoopTrans.name(), psyclone.domain.nemo.transformations.nemo_arrayrange2loop_trans.NemoArrayRange2LoopTrans.name(), psyclone.domain.nemo.transformations.nemo_outerarrayrange2loop_trans.NemoOuterArrayRange2LoopTrans.name(), psyclone.dynamo0p3.DynamoPSy.name(), psyclone.expression.FunctionVar.name, psyclone.expression.NamedArg.name(), psyclone.gocean1p0.GOKernelGridArgument.name(), psyclone.gocean1p0.GOStencil.name(), psyclone.parse.algorithm.FileInfo.name(), psyclone.parse.algorithm.InvokeCall.name(), psyclone.parse.kernel.KernelProcedure.name(), psyclone.parse.kernel.KernelType.name(), psyclone.parse.module_info.ModuleInfo.name(), psyclone.psyad.transformations.assignment_trans.AssignmentTrans.name(), psyclone.psyGen.PSy.name(), psyclone.psyGen.Invoke.name(), psyclone.psyGen.Kern.name(), psyclone.psyGen.CodedKern.name, psyclone.psyGen.Argument.name(), psyclone.psyGen.Transformation.name(), psyclone.psyGen.DummyTransformation.name(), psyclone.psyir.nodes.container.Container.name, psyclone.psyir.nodes.member.Member.name, psyclone.psyir.nodes.reference.Reference.name(), psyclone.psyir.nodes.routine.Routine.name, psyclone.psyir.symbols.symbol.Symbol.name(), psyclone.psyir.transformations.allarrayaccess2loop_trans.AllArrayAccess2LoopTrans.name(), psyclone.psyir.transformations.arrayrange2loop_trans.ArrayRange2LoopTrans.name(), psyclone.psyir.transformations.fold_conditional_return_expressions_trans.FoldConditionalReturnExpressionsTrans.name(), psyclone.psyir.transformations.loop_trans.LoopTrans.name(), psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans.name(), psyclone.psyir.transformations.psy_data_trans.PSyDataTrans.name(), psyclone.transformations.OMPSingleTrans.name(), psyclone.transformations.OMPMasterTrans.name(), psyclone.transformations.OMPParallelTrans.name(), psyclone.transformations.MoveTrans.name(), psyclone.transformations.Dynamo0p3AsyncHaloExchangeTrans.name(), psyclone.transformations.Dynamo0p3KernelConstTrans.name(), psyclone.transformations.ACCEnterDataTrans.name(), psyclone.transformations.ACCRoutineTrans.name(), psyclone.transformations.ACCKernelsTrans.name(), psyclone.transformations.ACCDataTrans.name(), psyclone.transformations.KernelImportsToArguments.name(), and psyclone.psyir.symbols.symbol.Symbol.visibility.
def psyclone.psyir.symbols.symbol.Symbol.copy_properties | ( | self, | |
symbol_in | |||
) |
Replace all properties in this object with the properties from symbol_in, apart from the name (which is immutable) and visibility. :param symbol_in: the symbol from which the properties are copied. :type symbol_in: :py:class:`psyclone.psyir.symbols.Symbol` :raises TypeError: if the argument is not the expected type.
Reimplemented in psyclone.psyir.symbols.typed_symbol.TypedSymbol, psyclone.psyir.symbols.datasymbol.DataSymbol, and psyclone.psyir.symbols.data_type_symbol.DataTypeSymbol.
Definition at line 152 of file symbol.py.
References psyclone.psyir.symbols.symbol.Symbol._interface.
def psyclone.psyir.symbols.symbol.Symbol.find_symbol_table | ( | self, | |
node | |||
) |
Searches back up the PSyIR tree for the SymbolTable that contains this Symbol. :param node: the PSyIR node from which to search. :type node: :py:class:`psyclone.psyir.nodes.Node` :returns: the SymbolTable containing this Symbol or None. :rtype: :py:class:`psyclone.psyir.symbols.SymbolTable` or NoneType :raises TypeError: if the supplied `node` argument is not a PSyIR Node.
Definition at line 384 of file symbol.py.
References psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.GridArg.name, psyclone.domain.gocean.transformations.gocean_const_loop_bounds_trans.GOConstLoopBoundsTrans.name(), psyclone.domain.gocean.transformations.gocean_move_iteration_boundaries_inside_kernel_trans.GOMoveIterationBoundariesInsideKernelTrans.name(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans.name(), psyclone.domain.lfric.kernel.lfric_kernel_metadata.LFRicKernelMetadata.name, psyclone.domain.nemo.transformations.create_nemo_invoke_schedule_trans.CreateNemoInvokeScheduleTrans.name(), psyclone.domain.nemo.transformations.create_nemo_psy_trans.CreateNemoPSyTrans.name(), psyclone.domain.nemo.transformations.nemo_allarrayrange2loop_trans.NemoAllArrayRange2LoopTrans.name(), psyclone.domain.nemo.transformations.nemo_arrayrange2loop_trans.NemoArrayRange2LoopTrans.name(), psyclone.domain.nemo.transformations.nemo_outerarrayrange2loop_trans.NemoOuterArrayRange2LoopTrans.name(), psyclone.dynamo0p3.DynamoPSy.name(), psyclone.expression.FunctionVar.name, psyclone.expression.NamedArg.name(), psyclone.gocean1p0.GOKernelGridArgument.name(), psyclone.gocean1p0.GOStencil.name(), psyclone.parse.algorithm.FileInfo.name(), psyclone.parse.algorithm.InvokeCall.name(), psyclone.parse.kernel.KernelProcedure.name(), psyclone.parse.kernel.KernelType.name(), psyclone.parse.module_info.ModuleInfo.name(), psyclone.psyad.transformations.assignment_trans.AssignmentTrans.name(), psyclone.psyGen.PSy.name(), psyclone.psyGen.Invoke.name(), psyclone.psyGen.Kern.name(), psyclone.psyGen.CodedKern.name, psyclone.psyGen.Argument.name(), psyclone.psyGen.Transformation.name(), psyclone.psyGen.DummyTransformation.name(), psyclone.psyir.nodes.container.Container.name, psyclone.psyir.nodes.member.Member.name, psyclone.psyir.nodes.reference.Reference.name(), psyclone.psyir.nodes.routine.Routine.name, psyclone.psyir.symbols.symbol.Symbol.name(), psyclone.psyir.transformations.allarrayaccess2loop_trans.AllArrayAccess2LoopTrans.name(), psyclone.psyir.transformations.arrayrange2loop_trans.ArrayRange2LoopTrans.name(), psyclone.psyir.transformations.fold_conditional_return_expressions_trans.FoldConditionalReturnExpressionsTrans.name(), psyclone.psyir.transformations.loop_trans.LoopTrans.name(), psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans.name(), psyclone.psyir.transformations.psy_data_trans.PSyDataTrans.name(), psyclone.transformations.OMPSingleTrans.name(), psyclone.transformations.OMPMasterTrans.name(), psyclone.transformations.OMPParallelTrans.name(), psyclone.transformations.MoveTrans.name(), psyclone.transformations.Dynamo0p3AsyncHaloExchangeTrans.name(), psyclone.transformations.Dynamo0p3KernelConstTrans.name(), psyclone.transformations.ACCEnterDataTrans.name(), psyclone.transformations.ACCRoutineTrans.name(), psyclone.transformations.ACCKernelsTrans.name(), psyclone.transformations.ACCDataTrans.name(), and psyclone.transformations.KernelImportsToArguments.name().
def psyclone.psyir.symbols.symbol.Symbol.get_external_symbol | ( | self | ) |
Looks-up and returns the Symbol referred to by this Symbol's Import Interface. :raises SymbolError: if the module pointed to by the symbol interface \ does not contain the symbol (or the symbol is \ not public). :raises NotImplementedError: if this symbol does not have an \ ImportInterface.
Definition at line 197 of file symbol.py.
References psyclone.psyir.symbols.datasymbol.DataSymbol.interface, psyclone.psyir.symbols.symbol.Symbol.interface, psyclone.psyir.symbols.typed_symbol.TypedSymbol.interface, psyclone.psyir.symbols.symbol.Symbol.is_import(), psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.GridArg.name, psyclone.domain.gocean.transformations.gocean_const_loop_bounds_trans.GOConstLoopBoundsTrans.name(), psyclone.domain.gocean.transformations.gocean_move_iteration_boundaries_inside_kernel_trans.GOMoveIterationBoundariesInsideKernelTrans.name(), psyclone.domain.gocean.transformations.gocean_opencl_trans.GOOpenCLTrans.name(), psyclone.domain.lfric.kernel.lfric_kernel_metadata.LFRicKernelMetadata.name, psyclone.domain.nemo.transformations.create_nemo_invoke_schedule_trans.CreateNemoInvokeScheduleTrans.name(), psyclone.domain.nemo.transformations.create_nemo_psy_trans.CreateNemoPSyTrans.name(), psyclone.domain.nemo.transformations.nemo_allarrayrange2loop_trans.NemoAllArrayRange2LoopTrans.name(), psyclone.domain.nemo.transformations.nemo_arrayrange2loop_trans.NemoArrayRange2LoopTrans.name(), psyclone.domain.nemo.transformations.nemo_outerarrayrange2loop_trans.NemoOuterArrayRange2LoopTrans.name(), psyclone.dynamo0p3.DynamoPSy.name(), psyclone.expression.FunctionVar.name, psyclone.expression.NamedArg.name(), psyclone.gocean1p0.GOKernelGridArgument.name(), psyclone.gocean1p0.GOStencil.name(), psyclone.parse.algorithm.FileInfo.name(), psyclone.parse.algorithm.InvokeCall.name(), psyclone.parse.kernel.KernelProcedure.name(), psyclone.parse.kernel.KernelType.name(), psyclone.parse.module_info.ModuleInfo.name(), psyclone.psyad.transformations.assignment_trans.AssignmentTrans.name(), psyclone.psyGen.PSy.name(), psyclone.psyGen.Invoke.name(), psyclone.psyGen.Kern.name(), psyclone.psyGen.CodedKern.name, psyclone.psyGen.Argument.name(), psyclone.psyGen.Transformation.name(), psyclone.psyGen.DummyTransformation.name(), psyclone.psyir.nodes.container.Container.name, psyclone.psyir.nodes.member.Member.name, psyclone.psyir.nodes.reference.Reference.name(), psyclone.psyir.nodes.routine.Routine.name, psyclone.psyir.symbols.symbol.Symbol.name(), psyclone.psyir.transformations.allarrayaccess2loop_trans.AllArrayAccess2LoopTrans.name(), psyclone.psyir.transformations.arrayrange2loop_trans.ArrayRange2LoopTrans.name(), psyclone.psyir.transformations.fold_conditional_return_expressions_trans.FoldConditionalReturnExpressionsTrans.name(), psyclone.psyir.transformations.loop_trans.LoopTrans.name(), psyclone.psyir.transformations.omp_task_trans.OMPTaskTrans.name(), psyclone.psyir.transformations.psy_data_trans.PSyDataTrans.name(), psyclone.transformations.OMPSingleTrans.name(), psyclone.transformations.OMPMasterTrans.name(), psyclone.transformations.OMPParallelTrans.name(), psyclone.transformations.MoveTrans.name(), psyclone.transformations.Dynamo0p3AsyncHaloExchangeTrans.name(), psyclone.transformations.Dynamo0p3KernelConstTrans.name(), psyclone.transformations.ACCEnterDataTrans.name(), psyclone.transformations.ACCRoutineTrans.name(), psyclone.transformations.ACCKernelsTrans.name(), psyclone.transformations.ACCDataTrans.name(), and psyclone.transformations.KernelImportsToArguments.name().
def psyclone.psyir.symbols.symbol.Symbol.interface | ( | self | ) |
:returns: the an object describing the interface to this Symbol. :rtype: Sub-class of \ :py:class:`psyclone.psyir.symbols.symbol.SymbolInterface`
Definition at line 286 of file symbol.py.
References psyclone.psyir.symbols.symbol.Symbol._interface.
def psyclone.psyir.symbols.symbol.Symbol.interface | ( | self, | |
value | |||
) |
Setter for the Interface associated with this Symbol. :param value: an Interface object describing how the Symbol is \ accessed. :type value: Sub-class of \ :py:class:`psyclone.psyir.symbols.symbol.SymbolInterface` :raises TypeError: if the supplied `value` is of the wrong type.
Definition at line 295 of file symbol.py.
References psyclone.psyir.symbols.symbol.Symbol._interface.
def psyclone.psyir.symbols.symbol.Symbol.is_argument | ( | self | ) |
:returns: whether the Symbol has an ArgumentInterface. :rtype: bool
Definition at line 340 of file symbol.py.
References psyclone.psyir.symbols.symbol.Symbol._interface.
def psyclone.psyir.symbols.symbol.Symbol.is_array | ( | self | ) |
:returns: True if this symbol is an array and False if it is not or there is not enough symbol information to determine it. :rtype: bool
Reimplemented in psyclone.psyir.symbols.typed_symbol.TypedSymbol.
Definition at line 426 of file symbol.py.
def psyclone.psyir.symbols.symbol.Symbol.is_array_access | ( | self, | |
index_variable = None , |
|||
access_info = None |
|||
) |
This method detects if a variable is used as an array or not. If available, it will use the access information, i.e. how the variable is used (e.g. if it has indices somewhere, like `a(i)%b`). This can be incorrect in case of implicit loops (e.g. `a=b+1`, where `a` and `b` are arrays) where the variable usage information will not have information about indices. In this case this function will fallback to querying the symbol itself. This can cause significant slowdown if this symbol is imported from a module, since then these modules need to be parsed. # TODO #1213: Parsing modules is not yet supported. If a `loop_variable` is specified, a variable access will only be considered an array access if the specified variable is used in at least one of the indices. For example: >>> do i=1, n >>> a(j) = 2 the access to `a` is not considered an array if `loop_variable` is set to `i`. If `loop_variable` is specified, `access_information` must be specified. :param str index_variable: optional loop variable that is used to \ to determine if an access is an array access using this variable. :param access_info: variable access information, optional. :type access_info: \ :py:class:`psyclone.core.SingleVariableAccessInfo` :returns: if the variable is an array. :rtype bool: :raises InternalError: if a loop_variable is specified, but no \ access information is given.
Definition at line 435 of file symbol.py.
References psyclone.core.component_indices.ComponentIndices.is_array(), psyclone.core.single_variable_access_info.AccessInfo.is_array(), psyclone.psyir.nodes.array_mixin.ArrayMixin.is_array(), psyclone.psyir.nodes.member.Member.is_array(), psyclone.psyir.nodes.reference.Reference.is_array(), psyclone.psyir.symbols.symbol.Symbol.is_array(), psyclone.psyir.symbols.typed_symbol.TypedSymbol.is_array(), and psyclone.core.single_variable_access_info.SingleVariableAccessInfo.is_array().
def psyclone.psyir.symbols.symbol.Symbol.is_automatic | ( | self | ) |
:returns: whether the Symbol has an AutomaticInterface. :rtype: bool
Definition at line 313 of file symbol.py.
References psyclone.psyir.symbols.symbol.Symbol._interface.
def psyclone.psyir.symbols.symbol.Symbol.is_commonblock | ( | self | ) |
:returns: whether the Symbol has a CommonBlockInterface. :rtype: bool
Definition at line 349 of file symbol.py.
References psyclone.psyir.symbols.symbol.Symbol._interface.
def psyclone.psyir.symbols.symbol.Symbol.is_import | ( | self | ) |
:returns: whether the Symbol has an ImportInterface. :rtype: bool
Definition at line 331 of file symbol.py.
References psyclone.psyir.symbols.symbol.Symbol._interface.
def psyclone.psyir.symbols.symbol.Symbol.is_modulevar | ( | self | ) |
:returns: whether the Symbol has a DefaultModuleInterface. :rtype: bool
Definition at line 322 of file symbol.py.
References psyclone.psyir.symbols.symbol.Symbol._interface.
def psyclone.psyir.symbols.symbol.Symbol.is_static | ( | self | ) |
:returns: whether the Symbol has a StaticInterface. :rtype: bool
Definition at line 358 of file symbol.py.
References psyclone.psyir.symbols.symbol.Symbol._interface.
def psyclone.psyir.symbols.symbol.Symbol.is_unknown_interface | ( | self | ) |
:returns: whether the Symbol has an UnknownInterface. :rtype: bool
Definition at line 376 of file symbol.py.
References psyclone.psyir.symbols.symbol.Symbol._interface.
def psyclone.psyir.symbols.symbol.Symbol.is_unresolved | ( | self | ) |
:returns: whether the Symbol has an UnresolvedInterface. :rtype: bool
Definition at line 367 of file symbol.py.
References psyclone.psyir.symbols.symbol.Symbol._interface.
def psyclone.psyir.symbols.symbol.Symbol.name | ( | self | ) |
:returns: name of the Symbol. :rtype: str
Definition at line 255 of file symbol.py.
References psyclone.domain.common.algorithm.psyir.AlgorithmInvokeCall._name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata._name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.GridArg._name, psyclone.domain.lfric.kernel.lfric_kernel_metadata.LFRicKernelMetadata._name, psyclone.dynamo0p3.DynFuncDescriptor03._name, psyclone.expression.NamedArg._name, psyclone.gocean1p0.GOKernelGridArgument._name, psyclone.gocean1p0.GOStencil._name, psyclone.nemo.NemoInvoke._name, psyclone.nemo.NemoPSy._name, psyclone.parse.algorithm.FileInfo._name, psyclone.parse.algorithm.InvokeCall._name, psyclone.parse.kernel.KernelProcedure._name, psyclone.parse.kernel.KernelType._name, psyclone.parse.module_info.ModuleInfo._name, psyclone.psyGen.PSy._name, psyclone.psyGen.Invoke._name, psyclone.psyGen.Kern._name, psyclone.psyGen.Argument._name, psyclone.psyir.nodes.container.Container._name, psyclone.psyir.nodes.routine.Routine._name, and psyclone.psyir.symbols.symbol.Symbol._name.
def psyclone.psyir.symbols.symbol.Symbol.resolve_type | ( | self | ) |
Update the properties of this Symbol by using the definition imported from the external Container. If this symbol does not have an ImportInterface then there is no lookup needed and we just return this symbol. :returns: a symbol object with the class and type determined by examining the Container from which it is imported. :rtype: subclass of :py:class:`psyclone.psyir.symbols.Symbol`
Reimplemented in psyclone.psyir.symbols.typed_symbol.TypedSymbol.
Definition at line 229 of file symbol.py.
References psyclone.psyir.symbols.symbol.Symbol.get_external_symbol(), psyclone.psyir.symbols.symbol.Symbol.is_import(), and psyclone.psyir.symbols.symbol.Symbol.specialise().
def psyclone.psyir.symbols.symbol.Symbol.specialise | ( | self, | |
subclass, | |||
** | kwargs | ||
) |
Specialise this symbol so that it becomes an instance of the class provided in the subclass argument. This allows this instance to become a subclass without any references to it becoming invalid. :param subclass: the class that this symbol will become. :type subclass: type of sub-class of \ :py:class:`psyclone.psyir.symbols.Symbol` :raises TypeError: if subclass is not a sub-class of Symbol.
Definition at line 167 of file symbol.py.
References psyclone.psyir.symbols.symbol.Symbol.__class__, psyclone.psyir.symbols.containersymbol.ContainerSymbol._process_arguments(), psyclone.psyir.symbols.datasymbol.DataSymbol._process_arguments(), psyclone.psyir.symbols.routinesymbol.RoutineSymbol._process_arguments(), psyclone.psyir.symbols.typed_symbol.TypedSymbol._process_arguments(), and psyclone.psyir.symbols.symbol.Symbol._process_arguments().
def psyclone.psyir.symbols.symbol.Symbol.visibility | ( | self | ) |
:returns: the visibility of this Symbol. :rtype: :py:class:`psyclone.psyir.symbol.Symbol.Visibility`
Definition at line 263 of file symbol.py.
References psyclone.psyir.symbols.symbol.Symbol._visibility.
def psyclone.psyir.symbols.symbol.Symbol.visibility | ( | self, | |
value | |||
) |
Setter for the visibility attribute. :raises TypeError: if the supplied value is not an instance of \ Symbol.Visibility.
Definition at line 271 of file symbol.py.
References psyclone.psyir.symbols.symbol.Symbol._visibility.