diff options
author | Jean Perier <jperier@nvidia.com> | 2023-01-13 09:15:52 +0100 |
---|---|---|
committer | Jean Perier <jperier@nvidia.com> | 2023-01-13 09:16:12 +0100 |
commit | 199e49746db83f1e56d5899f1905784bbfa142e3 (patch) | |
tree | c0436e0cbec45d6022b0daa4cb52b225cc435915 /llvm/lib/CodeGen/MachineScheduler.cpp | |
parent | c68b9cc0aaaa42085732a0c72c404e5d9b3e00c6 (diff) | |
download | llvm-199e49746db83f1e56d5899f1905784bbfa142e3.zip llvm-199e49746db83f1e56d5899f1905784bbfa142e3.tar.gz llvm-199e49746db83f1e56d5899f1905784bbfa142e3.tar.bz2 |
[flang] Lower elemental intrinsics to hlfir.elemental
- Move the core code generating hlfir.elemental for user calls from
genUserElementalCall into a new ElementalCallBuilder class and use
C++ CRTP (curiously recursive template pattern) to implement the
parts specific to user and intrinsic call into ElementalUserCallBuilder
and ElementalIntrinsicCallBuilder. This allows sharing the core logic
to lower elemental procedures for both user defined and intrinsics
procedures.
- To allow using ElementalCallBuilder, split the intrinsic lowering code
into two parts: first lower the arguments to hlfir::Entity regardless
of the interface of the intrinsics, and then, in a different function
(genIntrinsicProcRefCore), prepare the hlfir::Entity according to the
interface. This allows using the same core logic to prepare "normal"
arguments for non-elemental intrinsics, and to prepare the elements of
array arguments inside elemental call (ElementalIntrinsicCallBuilder
calls genIntrinsicProcRefCore once it has computed the scalar actual
arguments).
To allow this split, genExprBox/genExprAddr/genExprValue logic had to
be split in ConvertExprToHlfir.[cpp/h].
- Add missing statement context pushScope/finalizeAndPop around the
code generation inside the hlfir.elemental so that any temps created
while lowering the call at the element level is correctly cleaned-up.
- One piece of code in hlfir::Entity::hasNonDefaultLowerBounds() was wrong for assumed shape arrays (returned true when an assumed shaped array had no explicit lower bounds). This caused the added test to hit a bogus TODO, so fix it.
Elemental intrinsics returning are still TODO (e.g., adjustl). I will implement this in a next patch, this one is big enough.
Differential Revision: https://reviews.llvm.org/D141612
Diffstat (limited to 'llvm/lib/CodeGen/MachineScheduler.cpp')
0 files changed, 0 insertions, 0 deletions