psyclone.psyir.transformations.loop_trans#
This module contains the base class LoopTrans. All transformations which act on a loop sub-class this one.
Classes#
LoopTrans: This abstract class is a base class for all transformations that act
- class psyclone.psyir.transformations.loop_trans.LoopTrans[source]#
This abstract class is a base class for all transformations that act on a Loop node. It gives access to a validate function that makes sure that the supplied node is a Loop. We also check that all nodes to be enclosed are valid for this transformation - this requires that the sub-class populate the excluded_node_types tuple.
Inheritance

- apply(node, options=None, node_type_check=True, verbose=False, **kwargs)[source]#
Applies the transformation to the provided node.
This function only calls the superclass method, but is required for option specification.
- Parameters:
node (subclass of
psyclone.psyir.nodes.Node) – target PSyIR node.options (Optional[Dict[str, Any]]) – a dictionary with options for transformations.
node_type_check (
bool) – If the type of nodes enclosed in the loop should be tested to avoid including unsupported nodes in the transformation.verbose (
bool) – whether to log the reason the validation failed, at the moment with a comment in the provided PSyIR node.
- property name#
- Returns:
the name of this class.
- Return type:
str
- validate(node, options=None, **kwargs)[source]#
Checks that the supplied node is a valid target for a loop transformation.
- Parameters:
node (subclass of
psyclone.psyir.nodes.Node) – target PSyIR node.- Raises:
TransformationError – if the supplied node is not a (fully- formed) Loop.
TransformationError – if any of the nodes within the loop are of an unsupported type.
TransformationError – if the loop is of ‘null’ type.
TransformationError – if the supplied options are not a dictionary.