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=None, initial_indent_depth=0, check_global_constraints=True, disable_copy=False)[source]#
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.
Note
if all indentation has been disabled in the Config object then this argument is ignored.
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.
disable_copy (bool) – whether or not to disable the lowering copy operation. Note that disabling it will make the visitor alter the original tree.
- Raises:
TypeError – if any of the supplied parameters are of the wrong type.
Inheritance

- reference_node(node)[source]#
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
