Reference Guide
2.5.0
|
Public Member Functions | |
def | get_node_list (self, nodes) |
def | validate (self, nodes, options=None) |
Public Member Functions inherited from psyclone.psyGen.Transformation | |
def | name (self) |
def | apply (self, node, options=None) |
Static Public Attributes | |
tuple | excluded_node_types = () |
This abstract class is a base class for all transformations that act on a list of nodes. It gives access to a validate function that makes sure that the nodes in the list are in the same order as in the original AST, no node is duplicated, and that all nodes have the same parent. 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.
Definition at line 50 of file region_trans.py.
def psyclone.psyir.transformations.region_trans.RegionTrans.get_node_list | ( | self, | |
nodes | |||
) |
This is a helper function for region based transformations. The parameter for any of those transformations is either a single node, a schedule, or a list of nodes. This function converts this into a list of nodes according to the parameter type. This function will always return a copy, to avoid issues e.g. if a child list of a node should be provided, and a transformation changes the order in this list (which would then also change the order of the nodes in the tree). :param nodes: can be a single node, a schedule or a list of nodes. :type nodes: Union[:py:obj:`psyclone.psyir.nodes.Node`, :py:obj:`psyclone.psyir.nodes.Schedule`, List[:py:obj:`psyclone.psyir.nodes.Node`] :param options: a dictionary with options for transformations. :type options: Optional[Dict[str,Any]] :returns: a list of nodes. :rtype: List[:py:class:`psyclone.psyir.nodes.Node`] :raises TransformationError: if the supplied parameter is neither a \ single Node, nor a Schedule, nor a list of Nodes.
Definition at line 68 of file region_trans.py.
def psyclone.psyir.transformations.region_trans.RegionTrans.validate | ( | self, | |
nodes, | |||
options = None |
|||
) |
Checks that the nodes in node_list are valid for a region transformation. :param nodes: can be a single node, a schedule or a list of nodes. :type nodes: Union[:py:obj:`psyclone.psyir.nodes.Node`, :py:obj:`psyclone.psyir.nodes.Schedule`, List[:py:obj:`psyclone.psyir.nodes.Node`] :param options: a dictionary with options for transformations. :type options: Optional[Dict[str,Any]] :param bool options["node-type-check"]: this flag controls if the \ type of the nodes enclosed in the region should be tested \ to avoid using unsupported nodes inside a region. :raises TransformationError: if the nodes in the list are not \ in the original order in which they are in the AST, \ a node is duplicated or the nodes have different parents. :raises TransformationError: if any of the nodes to be enclosed in \ the region are of an unsupported type. :raises TransformationError: if the parent of the supplied Nodes is \ not a Schedule or a Directive. :raises TransformationError: if the nodes are in a NEMO \ Schedule and the transformation acts on the child of a \ single-line If or Where statment. :raises TransformationError: if the supplied options are not a \ dictionary.
Reimplemented from psyclone.psyGen.Transformation.
Reimplemented in psyclone.psyir.transformations.psy_data_trans.PSyDataTrans, psyclone.transformations.ACCDataTrans, psyclone.transformations.ACCKernelsTrans, psyclone.transformations.ACCParallelTrans, psyclone.transformations.OMPParallelTrans, psyclone.transformations.ParallelRegionTrans, psyclone.psyir.transformations.read_only_verify_trans.ReadOnlyVerifyTrans, and psyclone.psyir.transformations.extract_trans.ExtractTrans.
Definition at line 112 of file region_trans.py.
References psyclone.psyir.transformations.extract_trans.ExtractTrans.excluded_node_types, psyclone.psyir.transformations.loop_swap_trans.LoopSwapTrans.excluded_node_types, psyclone.psyir.transformations.loop_trans.LoopTrans.excluded_node_types, psyclone.psyir.transformations.omp_target_trans.OMPTargetTrans.excluded_node_types, psyclone.psyir.transformations.parallel_loop_trans.ParallelLoopTrans.excluded_node_types, psyclone.psyir.transformations.profile_trans.ProfileTrans.excluded_node_types, psyclone.psyir.transformations.psy_data_trans.PSyDataTrans.excluded_node_types, psyclone.psyir.transformations.region_trans.RegionTrans.excluded_node_types, psyclone.transformations.ACCLoopTrans.excluded_node_types, psyclone.transformations.ParallelRegionTrans.excluded_node_types, psyclone.transformations.OMPSingleTrans.excluded_node_types, psyclone.transformations.OMPMasterTrans.excluded_node_types, psyclone.transformations.OMPParallelTrans.excluded_node_types, psyclone.transformations.ACCParallelTrans.excluded_node_types, psyclone.transformations.ACCKernelsTrans.excluded_node_types, psyclone.transformations.ACCDataTrans.excluded_node_types, and psyclone.psyir.transformations.region_trans.RegionTrans.get_node_list().