[flang] add ExtendedValue type helpers and factory::genZeroValue
authorJean Perier <jperier@nvidia.com>
Thu, 3 Feb 2022 09:13:39 +0000 (10:13 +0100)
committerJean Perier <jperier@nvidia.com>
Thu, 3 Feb 2022 09:13:54 +0000 (10:13 +0100)
commit575a6f819bc60fc2423e492f6c133404740445db
tree565deccd10e090dec02961de0b0b2bba7420b5f0
parent7cc3e0204210a8c9c12f29fddbfec9dfe786e931
[flang] add ExtendedValue type helpers and factory::genZeroValue

Add some helpers to get the base type and element type of
fir::ExtendedValue and to test if a fir::ExtendedValue is
a derived type with length parameters.

Add a new helper factory::genZeroValue to generate zero scalar value for
all the numerical types and false for logicals.

These helpers are used only in lowering for now, so add unit tests.

Differential Revision: https://reviews.llvm.org/D118795
flang/include/flang/Optimizer/Builder/BoxValue.h
flang/include/flang/Optimizer/Builder/FIRBuilder.h
flang/lib/Optimizer/Builder/FIRBuilder.cpp
flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp