Reference Guide  2.5.0
psyclone.psyir.nodes.routine.Routine Class Reference
Inheritance diagram for psyclone.psyir.nodes.routine.Routine:
Collaboration diagram for psyclone.psyir.nodes.routine.Routine:

Public Member Functions

def __init__ (self, name, is_program=False, **kwargs)
 
def __eq__ (self, other)
 
def create (cls, name, symbol_table, children, is_program=False, return_symbol_name=None)
 
def node_str (self, colour=True)
 
def dag_name (self)
 
def name (self)
 
def name (self, new_name)
 
def __str__ (self)
 
def is_program (self)
 
def return_symbol (self)
 
def return_symbol (self, value)
 
- Public Member Functions inherited from psyclone.psyir.nodes.schedule.Schedule
def __getitem__ (self, index)
 
def gen_code (self, parent)
 
- Public Member Functions inherited from psyclone.psyir.nodes.scoping_node.ScopingNode
def __init__ (self, children=None, parent=None, symbol_table=None)
 
def symbol_table (self)
 
- Public Member Functions inherited from psyclone.psyir.nodes.node.Node
def __init__ (self, ast=None, children=None, parent=None, annotations=None)
 
def coloured_name (self, colour=True)
 
def ast (self)
 
def ast_end (self)
 
def ast (self, ast)
 
def ast_end (self, ast_end)
 
def annotations (self)
 
def dag (self, file_name='dag', file_format='svg')
 
def dag_gen (self, graph)
 
def args (self)
 
def backward_dependence (self)
 
def forward_dependence (self)
 
def is_valid_location (self, new_node, position="before")
 
def depth (self)
 
def view (self, depth=0, colour=True, indent=" ", _index=None)
 
def addchild (self, child, index=None)
 
def children (self)
 
def children (self, my_children)
 
def parent (self)
 
def siblings (self)
 
def has_constructor_parent (self)
 
def position (self)
 
def abs_position (self)
 
def root (self)
 
def sameParent (self, node_2)
 
def walk (self, my_type, stop_type=None, depth=None)
 
def get_sibling_lists (self, my_type, stop_type=None)
 
def ancestor (self, my_type, excluding=None, include_self=False, limit=None, shared_with=None)
 
def kernels (self)
 
def following (self, routine=True)
 
def preceding (self, reverse=False, routine=True)
 
def immediately_precedes (self, node_2)
 
def immediately_follows (self, node_1)
 
def coded_kernels (self)
 
def loops (self)
 
def reductions (self, reprod=None)
 
def is_openmp_parallel (self)
 
def lower_to_language_level (self)
 
def reference_accesses (self, var_accesses)
 
def scope (self)
 
def replace_with (self, node, keep_name_in_context=True)
 
def pop_all_children (self)
 
def detach (self)
 
def copy (self)
 
def validate_global_constraints (self)
 
def debug_string (self)
 
def origin_string (self)
 
def update_signal (self)
 
def path_from (self, ancestor)
 
- Public Member Functions inherited from psyclone.psyir.nodes.commentable_mixin.CommentableMixin
def preceding_comment (self)
 
def preceding_comment (self, comment)
 
def inline_comment (self)
 
def inline_comment (self, comment)
 

Public Attributes

 name
 
 is_program
 
 return_symbol
 
- Public Attributes inherited from psyclone.psyir.nodes.scoping_node.ScopingNode
 symbol_table
 
- Public Attributes inherited from psyclone.psyir.nodes.node.Node
 position
 

Additional Inherited Members

- Static Public Attributes inherited from psyclone.psyir.nodes.node.Node
int START_DEPTH = 0
 
int START_POSITION = 0
 
 valid_annotations = tuple()
 

Detailed Description

A sub-class of a Schedule that represents a subroutine, function or
program unit.

:param str name: the name of this routine.
:param bool is_program: whether this Routine represents the entry point \
                        into a program (e.g. Fortran Program or C main()).
:param kwargs: additional keyword arguments provided to the super class.
:type kwargs: unwrapped dict.

:raises TypeError: if any of the supplied arguments are of the wrong type.

Definition at line 49 of file routine.py.

Member Function Documentation

◆ __eq__()

def psyclone.psyir.nodes.routine.Routine.__eq__ (   self,
  other 
)
Checks whether two nodes are equal. Two Routine nodes are equal
if they have the same name, same return symbol, same properties and
the inherited __eq__ is True.

:param object other: the object to check equality to.

:returns: whether other is equal to self.
:rtype: bool

Reimplemented from psyclone.psyir.nodes.scoping_node.ScopingNode.

Definition at line 80 of file routine.py.

80  def __eq__(self, other):
81  '''
82  Checks whether two nodes are equal. Two Routine nodes are equal
83  if they have the same name, same return symbol, same properties and
84  the inherited __eq__ is True.
85 
86  :param object other: the object to check equality to.
87 
88  :returns: whether other is equal to self.
89  :rtype: bool
90  '''
91  is_eq = super().__eq__(other)
92  is_eq = is_eq and self.name == other.name
93  is_eq = is_eq and self.is_program == other.is_program
94  is_eq = is_eq and self.return_symbol == other.return_symbol
95 
96  return is_eq
97 

References psyclone.psyir.nodes.routine.Routine.is_program, 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.nodes.routine.Routine.return_symbol.

Here is the call graph for this function:

◆ create()

def psyclone.psyir.nodes.routine.Routine.create (   cls,
  name,
  symbol_table,
  children,
  is_program = False,
  return_symbol_name = None 
)
Create an instance of the supplied class given a name, a symbol
table and a list of child nodes. This is implemented as a classmethod
so that it is able to act as a Factory for subclasses - e.g. it
will create a KernelSchedule if called from KernelSchedule.create().

:param str name: the name of the Routine (or subclass).
:param symbol_table: the symbol table associated with this Routine.
:type symbol_table: :py:class:`psyclone.psyGen.SymbolTable`
:param children: a list of PSyIR nodes contained in the Routine.
:type children: list of :py:class:`psyclone.psyir.nodes.Node`
:param bool is_program: whether this Routine represents the entry \
    point into a program (i.e. Fortran Program or C main()).
:param str return_symbol_name: name of the symbol that holds the \
    return value of this routine (if any). Must be present in the \
    supplied symbol table.

:returns: an instance of `cls`.
:rtype: :py:class:`psyclone.psyGen.Routine` or subclass

:raises TypeError: if the arguments to the create method \
    are not of the expected type.

Definition at line 99 of file routine.py.

100  return_symbol_name=None):
101  # pylint: disable=too-many-arguments
102  '''Create an instance of the supplied class given a name, a symbol
103  table and a list of child nodes. This is implemented as a classmethod
104  so that it is able to act as a Factory for subclasses - e.g. it
105  will create a KernelSchedule if called from KernelSchedule.create().
106 
107  :param str name: the name of the Routine (or subclass).
108  :param symbol_table: the symbol table associated with this Routine.
109  :type symbol_table: :py:class:`psyclone.psyGen.SymbolTable`
110  :param children: a list of PSyIR nodes contained in the Routine.
111  :type children: list of :py:class:`psyclone.psyir.nodes.Node`
112  :param bool is_program: whether this Routine represents the entry \
113  point into a program (i.e. Fortran Program or C main()).
114  :param str return_symbol_name: name of the symbol that holds the \
115  return value of this routine (if any). Must be present in the \
116  supplied symbol table.
117 
118  :returns: an instance of `cls`.
119  :rtype: :py:class:`psyclone.psyGen.Routine` or subclass
120 
121  :raises TypeError: if the arguments to the create method \
122  are not of the expected type.
123 
124  '''
125  if not isinstance(name, str):
126  raise TypeError(
127  f"name argument in create method of Routine class "
128  f"should be a string but found '{type(name).__name__}'.")
129  if not isinstance(symbol_table, SymbolTable):
130  raise TypeError(
131  f"symbol_table argument in create method of Routine class "
132  f"should be a SymbolTable but found "
133  f"'{type(symbol_table).__name__}'.")
134  if not isinstance(children, list):
135  raise TypeError(
136  f"children argument in create method of Routine class "
137  f"should be a list but found '{type(children).__name__}'.")
138  for child in children:
139  if not isinstance(child, Node):
140  raise TypeError(
141  f"child of children argument in create method of "
142  f"Routine class should be a PSyIR Node but "
143  f"found '{type(child).__name__}'.")
144 
145  routine = cls(name, is_program=is_program, symbol_table=symbol_table)
146  routine.children = children
147  if return_symbol_name:
148  routine.return_symbol = routine.symbol_table.lookup(
149  return_symbol_name, scope_limit=routine)
150  return routine
151 
Here is the caller graph for this function:

◆ dag_name()

def psyclone.psyir.nodes.routine.Routine.dag_name (   self)
:returns: the name of this node in the dag.
:rtype: str

Reimplemented from psyclone.psyir.nodes.node.Node.

Definition at line 164 of file routine.py.

164  def dag_name(self):
165  '''
166  :returns: the name of this node in the dag.
167  :rtype: str
168  '''
169  return "_".join(["routine", self.name, str(self.START_POSITION)])
170 

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(), psyclone.transformations.KernelImportsToArguments.name(), and psyclone.psyir.nodes.node.Node.START_POSITION.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_program()

def psyclone.psyir.nodes.routine.Routine.is_program (   self)
:returns: whether this Routine represents the entry point into a \
          program (e.g. is a Fortran Program or a C main()).
:rtype: bool

Definition at line 235 of file routine.py.

235  def is_program(self):
236  '''
237  :returns: whether this Routine represents the entry point into a \
238  program (e.g. is a Fortran Program or a C main()).
239  :rtype: bool
240  '''
241  return self._is_program
242 

References psyclone.psyir.nodes.routine.Routine._is_program.

Here is the caller graph for this function:

◆ name() [1/2]

◆ name() [2/2]

def psyclone.psyir.nodes.routine.Routine.name (   self,
  new_name 
)
Sets a new name for the Routine.

TODO #1200 this node should only hold a reference to the corresponding
RoutineSymbol and get its name from there.

:param str new_name: new name for the Routine.

:raises TypeError: if new_name is not a string.
:raises KeyError: if there already is a different named symbol with \
    the 'own_routine_tag' in the symbol_table.

Definition at line 180 of file routine.py.

180  def name(self, new_name):
181  '''
182  Sets a new name for the Routine.
183 
184  TODO #1200 this node should only hold a reference to the corresponding
185  RoutineSymbol and get its name from there.
186 
187  :param str new_name: new name for the Routine.
188 
189  :raises TypeError: if new_name is not a string.
190  :raises KeyError: if there already is a different named symbol with \
191  the 'own_routine_tag' in the symbol_table.
192 
193  '''
194  if not isinstance(new_name, str):
195  raise TypeError(f"Routine name must be a str but got "
196  f"'{type(new_name).__name__}'")
197  # TODO #1200 The name is duplicated in the _name attribute and the
198  # symbol.name that there is in the local symbol table. This setter
199  # updates both but note that a better solution is needed because
200  # renaming the symbol_table symbol alone would make it inconsistent.
201  if not self._name:
202  # If the 'own_routine_symbol' tag already exist check that is
203  # consistent with the given routine name.
204  if 'own_routine_symbol' in self.symbol_table.tags_dict:
205  existing_symbol = self.symbol_table.lookup_with_tag(
206  'own_routine_symbol', scope_limit=self)
207  if existing_symbol.name.lower() == new_name.lower():
208  self._name = new_name
209  return # The preexisting symbol already matches
210  # Otherwise raise an exception
211  raise KeyError(
212  f"Can't assign '{new_name}' as the routine name because "
213  f"its symbol table contains a symbol ({existing_symbol}) "
214  f"already tagged as 'own_routine_symbol'.")
215 
216  self._name = new_name
217  # Since the constructor can not mark methods as functions directly
218  # the symbol will always start being NoType and must be updated
219  # if a return_value type is provided.
220  self.symbol_table.add(RoutineSymbol(new_name, NoType()),
221  tag='own_routine_symbol')
222  elif self._name != new_name:
223  symbol = self.symbol_table.lookup(self._name)
224  self._name = new_name
225  self.symbol_table.rename_symbol(symbol, new_name)
226 

References psyclone.f2pygen.BaseGen._children, psyclone.psyir.nodes.node.Node._children, psyclone.psyir.nodes.omp_directives.OMPParallelDirective._children, 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, psyclone.psyir.symbols.symbol.Symbol._name, psyclone.psyir.nodes.node.Node.coloured_name(), psyclone.domain.common.algorithm.psyir.AlgorithmInvokeCall.node_str(), psyclone.domain.common.psylayer.psyloop.PSyLoop.node_str(), psyclone.domain.lfric.lfric_invoke_schedule.LFRicInvokeSchedule.node_str(), psyclone.domain.lfric.lfric_loop.LFRicLoop.node_str(), psyclone.dynamo0p3.LFRicHaloExchange.node_str(), psyclone.psyGen.InvokeSchedule.node_str(), psyclone.psyGen.GlobalSum.node_str(), psyclone.psyGen.HaloExchange.node_str(), psyclone.psyGen.Kern.node_str(), psyclone.psyGen.CodedKern.node_str(), psyclone.psyGen.InlinedKern.node_str(), psyclone.psyir.nodes.acc_directives.ACCLoopDirective.node_str(), psyclone.psyir.nodes.call.Call.node_str(), psyclone.psyir.nodes.codeblock.CodeBlock.node_str(), psyclone.psyir.nodes.container.Container.node_str(), psyclone.psyir.nodes.file_container.FileContainer.node_str(), psyclone.psyir.nodes.literal.Literal.node_str(), psyclone.psyir.nodes.loop.Loop.node_str(), psyclone.psyir.nodes.member.Member.node_str(), psyclone.psyir.nodes.node.Node.node_str(), psyclone.psyir.nodes.omp_clauses.OMPDefaultClause.node_str(), psyclone.psyir.nodes.omp_clauses.OMPScheduleClause.node_str(), psyclone.psyir.nodes.omp_clauses.OMPDependClause.node_str(), psyclone.psyir.nodes.omp_directives.OMPDoDirective.node_str(), psyclone.psyir.nodes.omp_directives.OMPLoopDirective.node_str(), psyclone.psyir.nodes.operation.Operation.node_str(), psyclone.psyir.nodes.reference.Reference.node_str(), psyclone.psyir.nodes.routine.Routine.node_str(), psyclone.psyGen.InvokeSchedule.symbol_table(), and psyclone.psyir.nodes.scoping_node.ScopingNode.symbol_table.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ node_str()

def psyclone.psyir.nodes.routine.Routine.node_str (   self,
  colour = True 
)
 Returns the name of this node with (optional) control codes
to generate coloured output in a terminal that supports it.

:param bool colour: whether or not to include colour control codes.

:returns: description of this node, possibly coloured.
:rtype: str

Reimplemented from psyclone.psyir.nodes.node.Node.

Definition at line 152 of file routine.py.

152  def node_str(self, colour=True):
153  ''' Returns the name of this node with (optional) control codes
154  to generate coloured output in a terminal that supports it.
155 
156  :param bool colour: whether or not to include colour control codes.
157 
158  :returns: description of this node, possibly coloured.
159  :rtype: str
160  '''
161  return self.coloured_name(colour) + "[name:'" + self.name + "']"
162 

References psyclone.psyir.nodes.node.Node.coloured_name(), 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ return_symbol() [1/2]

def psyclone.psyir.nodes.routine.Routine.return_symbol (   self)
:returns: the symbol which will hold the return value of this Routine \
          or None if the Routine is not a function.
:rtype: :py:class:`psyclone.psyir.symbols.DataSymbol` or NoneType

Definition at line 244 of file routine.py.

244  def return_symbol(self):
245  '''
246  :returns: the symbol which will hold the return value of this Routine \
247  or None if the Routine is not a function.
248  :rtype: :py:class:`psyclone.psyir.symbols.DataSymbol` or NoneType
249  '''
250  return self._return_symbol
251 

References psyclone.psyir.nodes.routine.Routine._return_symbol.

Here is the caller graph for this function:

◆ return_symbol() [2/2]

def psyclone.psyir.nodes.routine.Routine.return_symbol (   self,
  value 
)
Setter for the return-symbol of this Routine node.

:param value: the symbol holding the value that the routine returns.
:type value: :py:class:`psyclone.psyir.symbols.DataSymbol`

:raises TypeError: if the supplied value is not a DataSymbol.
:raises KeyError: if the supplied symbol is not a local entry in the \
                  symbol table of this Routine.

Definition at line 253 of file routine.py.

253  def return_symbol(self, value):
254  '''
255  Setter for the return-symbol of this Routine node.
256 
257  :param value: the symbol holding the value that the routine returns.
258  :type value: :py:class:`psyclone.psyir.symbols.DataSymbol`
259 
260  :raises TypeError: if the supplied value is not a DataSymbol.
261  :raises KeyError: if the supplied symbol is not a local entry in the \
262  symbol table of this Routine.
263  '''
264  if not isinstance(value, DataSymbol):
265  raise TypeError(f"Routine return-symbol should be a DataSymbol "
266  f"but found '{type(value).__name__}'.")
267  if value not in self.symbol_table.datasymbols:
268  raise KeyError(
269  f"For a symbol to be a return-symbol, it must be present in "
270  f"the symbol table of the Routine but '{value.name}' is not.")
271  self._return_symbol = value
272  # The routine symbol must be updated accordingly, this is because the
273  # function datatype is provided by the type of the return symbol which
274  # may be given after the Routine is created.
275  self.symbol_table.lookup(self._name).datatype = value.datatype
276 

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, psyclone.psyir.symbols.symbol.Symbol._name, psyclone.psyir.nodes.routine.Routine._return_symbol, psyclone.psyir.nodes.routine.Routine.return_symbol, psyclone.psyGen.InvokeSchedule.symbol_table(), and psyclone.psyir.nodes.scoping_node.ScopingNode.symbol_table.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: