psyclone.psyir.backend.visitor

Generic PSyIR visitor code that can be specialised by different back ends.

Classes

  • PSyIRVisitor: A generic PSyIR visitor. This is designed to be specialised by

class psyclone.psyir.backend.visitor.PSyIRVisitor(skip_nodes=False, indent_string='  ', initial_indent_depth=0, check_global_constraints=True)

A generic PSyIR visitor. This is designed to be specialised by a particular back end. By default, global constraints are enforced by calling the validate_global_constraints() method of each Node visited.

Parameters:
  • skip_nodes (bool) – If skip_nodes is False then an exception is raised if a visitor method for a PSyIR node has not been implemented, otherwise the visitor silently continues. This is an optional argument which defaults to False.

  • indent_string (str) – Specifies what to use for indentation. This is an optional argument that defaults to two spaces.

  • initial_indent_depth (int) – Specifies how much indentation to start with. This is an optional argument that defaults to 0.

  • check_global_constraints (bool) – whether or not to validate all global constraints when walking the tree. Defaults to True.

Raises:

TypeError – if any of the supplied parameters are of the wrong type.

Inheritance

Inheritance diagram of PSyIRVisitor
reference_node(node)

This method is called when a Reference instance is found in the PSyIR tree.

Parameters:

node (psyclone.psyir.nodes.Reference) – a Reference PSyIR node.

Returns:

the text representation of this reference.

Return type:

str

Raises:

VisitorError – if this node has children.

Exceptions

  • VisitorError: Provides a PSyclone-specific error class for errors related to a

exception psyclone.psyir.backend.visitor.VisitorError(value)

Provides a PSyclone-specific error class for errors related to a PSyIR visitor.

Parameters:

value (str) – Error message.

Inheritance

Inheritance diagram of VisitorError