diff options
author | Valentin Clement <clementval@gmail.com> | 2022-02-03 11:41:04 +0100 |
---|---|---|
committer | Valentin Clement <clementval@gmail.com> | 2022-02-03 11:45:27 +0100 |
commit | f254a8eff6d75f2f07f950b26caed35c76e90dae (patch) | |
tree | 799a6a4c6be33995737f593ff74b65c22861a784 /lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h | |
parent | ca53e049e0130be8d922a6ae80a1dcbddea2b25b (diff) | |
download | llvm-f254a8eff6d75f2f07f950b26caed35c76e90dae.zip llvm-f254a8eff6d75f2f07f950b26caed35c76e90dae.tar.gz llvm-f254a8eff6d75f2f07f950b26caed35c76e90dae.tar.bz2 |
[fir] Add fir.array_access op
The `array_access` provides a reference to a single element from an array
value. This is *not* a view in the immutable array, otherwise it couldn't
be stored to. It can be see as a logical copy of the element and its
position in the array. This reference can be written to and modified without
changing the original array.
The `array_access` operation is used to fetch the memory reference of an
element in an array value.
```fortran
real :: a(n,m)
...
... a ...
... a(r,s+1) ...
```
One can use `fir.array_access` to recover the implied memory reference to
the element `a(i,j)` in an array expression `a` as shown above. It can also
be used to recover the reference element `a(r,s+1)` in the second
expression.
```mlir
%s = fir.shape %n, %m : (index, index) -> !fir.shape<2>
// load the entire array 'a'
%v = fir.array_load %a(%s) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shape<2>) -> !fir.array<?x?xf32>
// fetch the value of one of the array value's elements
%1 = fir.array_access %v, %i, %j : (!fir.array<?x?xf32>, index, index) -> !fir.ref<f32>
```
More information about `array_access` and other array operations can be
found in flang/docs/FIRArrayOperations.md.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: kiranchandramohan, schweitz
Differential Revision: https://reviews.llvm.org/D112445
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h')
0 files changed, 0 insertions, 0 deletions