diff options
| author | Jean Perier <jperier@nvidia.com> | 2023-02-28 14:08:08 +0100 |
|---|---|---|
| committer | Jean Perier <jperier@nvidia.com> | 2023-02-28 14:08:16 +0100 |
| commit | 131c9174d9f176a0f6eeaea996ac20314e0c6b05 (patch) | |
| tree | eb5b2275d3b790bdf17f42134c15d34406a3391d /lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp | |
| parent | 91ee72d10e9f64c8c046115c5cdf35e08dd6f70d (diff) | |
[flang][hlfir] Add hlfir.parent_comp for leaf parent component references
In Fortran, it is possible to refer to the "parent part" of a derived
type as if it were a component:
```Fortran
type t1
integer :: i
end type
type t2
integer :: j
end type
type(t2) :: a
print *, a%t1%i ! "inner" parent component reference
print *, a%t1 ! "leaf" parent component reference
end
```
Inner parent component references can be dropped on the floor in
lowering: "a%t1%i" is equivalent to "a%i".
Leaf parent component references, however, must be taken care of. For
scalars, "a%t1" is a simple addressc ast to "t1", for arrays, however,
this creates an array section that must be represented with a descriptor
(fir.box).
hlfir.designate could have been extended to deal with this, but I think
it would make hlfir.designate too complex and hard to manipulate.
This patch adds an hlfir.parent_comp op that represents and implements
leaf parent component references.
Differential Revision: https://reviews.llvm.org/D144946
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp')
0 files changed, 0 insertions, 0 deletions
