You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lower elemental subroutine calls (outside of user assignment case)
Use the array lowering framework to lower elemental subroutine.
This required:
- Splitting the part of genIterSpace that creates the
implicit loops into a new genImplicitLoops function. genIterspace
deals with the destination and other explicit contexts set-ups that
do not matter in the subroutine case (there is no destination).
Other than having no destination, a big difference is that there is
no threaded innerArg. genImplicitLoops handles this variation.
- Fixing a bug in the iteration shape determination. The code was
assuming there would always be at least one array_load, which is
not true if there are only RefTransparent operands. This is always
true in the subroutine case, but was actually also an issue for things
like `print *, elem_func(array)` with the previous code (compile crash).
Add a new ArrayOperands structure to keep track of what matters to
later deduce the shape of the array expression instead of keeping
track of array_loads for that purpose.
- Elemental subroutine with intent(out)/intent(inout) arguments must be
applied "in array element order" (15.8.3). It turns out this is also
the case for impure elemental functions (10.1.4 p5). Instead of always
creating loops as "unordered=true" add an unordered field to the ArrayExprLowering
class. It is set to true by default, but will be set to false if any
impure elemental function is lowered, or in case of
intent(out)/intent(inout) arguments in elemental subroutines.
- Last, instead of using createFirExpr to lowering subroutine calls, use
a new createSubroutineCall that deals with the array/scalar
dispatching.
A TODO is added for the user defined elemental assignment, because
overlap analysis between RHS/LHS must be done, and this require somehow
plugging this special and very restricted case of elemental calls into
the array_load/array_update/array_merge framework or some ad-hoc
lowering.
0 commit comments