psyclone.psyir.nodes.array_member#

This module contains the implementation of the ArrayMember node.

Classes#

  • ArrayMember: Node representing an access to the element(s) of an array that is a

class psyclone.psyir.nodes.array_member.ArrayMember(member_name, parent=None)[source]#

Node representing an access to the element(s) of an array that is a member of a structure. Must have one or more children which give the array-index expressions for the array access.

Inheritance

Inheritance diagram of ArrayMember
static create(member_name, indices)[source]#

Construct an ArrayMember instance describing an array access to a member of a structure.

e.g. for the Fortran grid%subdomains(1,2), subdomains must be an array and we are accessing element (1,2) of it. We would therefore create the ArrayMember for this access by calling:

>>> from psyclone.psyir.nodes import ArrayMember, Literal
>>> from psyclone.psyir.symbols import ScalarType
>>> amem = ArrayMember.create(
...     "subdomains",
...     [Literal("1", ScalarType.integer_type()),
...     Literal("2", ScalarType.integer_type())])
Parameters:
Raises:

GenerationError – if the supplied indices argument is not a list.