[flang][hlfir] Array constructor lowering [part 1/4]
authorJean Perier <jperier@nvidia.com>
Thu, 16 Feb 2023 14:18:42 +0000 (15:18 +0100)
committerJean Perier <jperier@nvidia.com>
Thu, 16 Feb 2023 14:18:55 +0000 (15:18 +0100)
commitffde9f17300b52c9b53311455b8991cbfc6da377
treec94b6e2789d788b55e860e3ccc7e291af0a5f906
parent849c4402261a8c3066020ef8b49167b5b1475ab1
[flang][hlfir] Array constructor lowering [part 1/4]

This is the first and biggest chunk that introduces support for
array constructor to HLFIR.

This patch:
- adds a new ConvertArrayConstructor.cpp that centralizes the
  code dealing with array constructor lowering.
- introduces a framework to lower array constructor according to
  different strategies: A common analysis of the array constructor is
  done, and based on that, a lowering startegy is selected and driven
  through the ac-values of the array constructor. See
  ConvertArrayConstructor.cpp comments for more details.
- implements the first strategy that creates a temporary inlined and
  updates it with inlined code. This strategy can only be used if the
  temporary can be pre-allocated (i.e: the extents and length parameters
  can be pre-computed without evaluating any ac-values), and if all the
  ac-value expressions are scalars.

For the sake of simplicity, characters and derived type will be enabled
once all the strategies are added.

Reviewed By: clementval, PeteSteinfeld

Differential Revision: https://reviews.llvm.org/D144102
flang/include/flang/Lower/ConvertArrayConstructor.h [new file with mode: 0644]
flang/lib/Lower/CMakeLists.txt
flang/lib/Lower/ConvertArrayConstructor.cpp [new file with mode: 0644]
flang/lib/Lower/ConvertExprToHLFIR.cpp
flang/test/Lower/HLFIR/array-ctor-as-inlined-temp.f90 [new file with mode: 0644]