[flang][NFC] move constant lowering into its own unit
authorJean Perier <jperier@nvidia.com>
Mon, 31 Oct 2022 14:32:29 +0000 (15:32 +0100)
committerJean Perier <jperier@nvidia.com>
Mon, 31 Oct 2022 14:37:38 +0000 (15:37 +0100)
commitaf91b19338dde956ce7ebd6890d1a8e4295b091b
treecc474ab25dc76ece8604b3ca29d19639ca106185
parent9dd413a1be61f8fd84e67d255a245260755d8230
[flang][NFC] move constant lowering into its own unit

This patch moves intrinsic evaluate::Constant<T> lowering into its own
unit outside of ScalarExpr and genarr lowering so that it can
be used by the new lowering without any changes.

DerivedType lowering cannot be shared at that stage because it is too
correlated with the current lowering (requires structure constructor
and designator lowering).

The code had to be refactored quite a bit so that it could be carved
out, but the only "functional" change is that the length of character
arrays lowered by genarr is now `index` instead of `i64` (see test change).
One non-functional benefit of the change is that `toEvExpr` is not
needed anymore and some compile time copies of big constant arrays
that it was causing are removed (see old calls in previous genarr code),
although I am not sure any compile time speed-ups are visible here.

Differential Revision: https://reviews.llvm.org/D136955
flang/include/flang/Lower/ConvertConstant.h [new file with mode: 0644]
flang/include/flang/Lower/ConvertExpr.h
flang/lib/Lower/CMakeLists.txt
flang/lib/Lower/ConvertConstant.cpp [new file with mode: 0644]
flang/lib/Lower/ConvertExpr.cpp
flang/lib/Lower/ConvertVariable.cpp
flang/test/Lower/array-substring.f90