psyclone.psyir.nodes.routine
This module contains the Routine node implementation.
Classes
Routine
: A sub-class of a Schedule that represents a subroutine, function or
- class psyclone.psyir.nodes.routine.Routine(name, is_program=False, **kwargs)
A sub-class of a Schedule that represents a subroutine, function or program unit.
- Parameters:
name (str) – the name of this routine.
is_program (bool) – whether this Routine represents the entry point into a program (e.g. Fortran Program or C main()).
kwargs (unwrapped dict.) – additional keyword arguments provided to the super class.
- Raises:
TypeError – if any of the supplied arguments are of the wrong type.
Inheritance
- classmethod create(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().
- Parameters:
name (str) – the name of the Routine (or subclass).
symbol_table (
psyclone.psyGen.SymbolTable
) – the symbol table associated with this Routine.children (list of
psyclone.psyir.nodes.Node
) – a list of PSyIR nodes contained in the Routine.is_program (bool) – whether this Routine represents the entry point into a program (i.e. Fortran Program or C main()).
return_symbol_name (str) – 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.
- Return type:
psyclone.psyGen.Routine
or subclass- Raises:
TypeError – if the arguments to the create method are not of the expected type.
- property dag_name
- Returns:
the name of this node in the dag.
- Return type:
str
- property is_program
- Returns:
whether this Routine represents the entry point into a program (e.g. is a Fortran Program or a C main()).
- Return type:
bool
- property name
- Returns:
the name of this Routine.
- Return type:
str
- node_str(colour=True)
Returns the name of this node with (optional) control codes to generate coloured output in a terminal that supports it.
- Parameters:
colour (bool) – whether or not to include colour control codes.
- Returns:
description of this node, possibly coloured.
- Return type:
str
- property return_symbol
- Returns:
the symbol which will hold the return value of this Routine or None if the Routine is not a function.
- Return type:
psyclone.psyir.symbols.DataSymbol
or NoneType