psyclone.psyir.transformations.read_only_verify_trans

This module contains the base class for verifying read-only access in a region of code.”

Classes

class psyclone.psyir.transformations.read_only_verify_trans.ReadOnlyVerifyTrans(node_class=<class 'psyclone.psyir.nodes.read_only_verify_node.ReadOnlyVerifyNode'>)

This transformation inserts a ReadOnlyVerifyNode or a node derived from ReadOnlyVerifyNode into the PSyIR of a schedule. At code creation time this node will use the PSyData API to create code that will verify that read-only quantities are not modified.

After applying the transformation the Nodes marked for verification are children of the ReadOnlyVerifyNode. Nodes to verify can be individual constructs within an Invoke (e.g. Loops containing a Kernel or BuiltIn call) or entire Invokes.

Parameters:

node_class (psyclone.psyir.nodes.ReadOnlyVerifyNode or derived class) – The class of Node which will be inserted into the tree (defaults to ReadOnlyVerifyNode), but can be any derived class.

Inheritance

Inheritance diagram of ReadOnlyVerifyTrans
get_default_options()

Returns a new dictionary with additional options, specific to the transformation, that will be added to the user option. Any values specified by the user will take precedence. For the read-only verify transformation, by default we want VariablesAccessInformation to report array arguments to lbound, ubound and size as read accesses, since these arguments should also not be overwritten.

Returns:

a dictionary with additional options.

Return type:

Dict[str, Any]

validate(node_list, options=None)

Performs validation checks specific to read-only-based transformations.

Parameters:
  • node_list (list of psyclone.psyir.nodes.Node) – the list of Node(s) we are checking.

  • options (Optional[Dict[str, Any]]) – a dictionary with options for transformations.

Raises:
  • TransformationError – if transformation is applied to a Kernel or a BuiltIn call without its parent Loop.

  • TransformationError – if transformation is applied to a Loop without its parent Directive when optimisations are applied.

  • TransformationError – if transformation is applied to an orphaned Directive without its parent Directive.