summaryrefslogtreecommitdiff
path: root/flang/module
diff options
context:
space:
mode:
authorpeter klausler <pklausler@nvidia.com>2021-07-19 11:53:20 -0700
committerpeter klausler <pklausler@nvidia.com>2021-07-20 15:24:16 -0700
commita48e41683ae1a9b9a5bde750d3b418a205c28cc8 (patch)
treef69cfc03cacc982926163fda300e8e8e67ca034a /flang/module
parent40a02fae87ca7de676f6b9d96532c760130ccc68 (diff)
downloadllvm-a48e41683ae1a9b9a5bde750d3b418a205c28cc8.tar.gz
[flang] Run-time derived type initialization and destruction
Use derived type information tables to drive default component initialization (when needed), component destruction, and calls to final subroutines. Perform these operations automatically for ALLOCATE()/DEALLOCATE() APIs for allocatables, automatics, and pointers. Add APIs for use in lowering to perform these operations for non-allocatable/automatic non-pointer variables. Data pointer component initialization supports arbitrary constant designators, a F'2008 feature, which may be a first for Fortran implementations. Differential Revision: https://reviews.llvm.org/D106297
Diffstat (limited to 'flang/module')
-rw-r--r--flang/module/__fortran_type_info.f909
1 files changed, 6 insertions, 3 deletions
diff --git a/flang/module/__fortran_type_info.f90 b/flang/module/__fortran_type_info.f90
index c2a9ed16e10b..dcdc5619a861 100644
--- a/flang/module/__fortran_type_info.f90
+++ b/flang/module/__fortran_type_info.f90
@@ -33,19 +33,22 @@ module __Fortran_type_info
type(Binding), pointer, contiguous :: binding(:)
character(len=:), pointer :: name
integer(kind=int64) :: sizeInBytes
- type(DerivedType), pointer :: parent
! Instances of parameterized derived types use the "uninstantiated"
! component to point to the pristine original definition.
type(DerivedType), pointer :: uninstantiated
integer(kind=int64) :: typeHash
integer(kind=int64), pointer, contiguous :: kindParameter(:) ! values of instance
integer(1), pointer, contiguous :: lenParameterKind(:) ! INTEGER kinds of LEN types
- ! Data components appear in alphabetic order.
- ! The parent component, if any, appears explicitly.
+ ! Data components appear in component order.
+ ! The parent component, if any, appears explicitly and first.
type(Component), pointer, contiguous :: component(:) ! data components
type(ProcPtrComponent), pointer, contiguous :: procptr(:) ! procedure pointers
! Special bindings of the ancestral types are not duplicated here.
type(SpecialBinding), pointer, contiguous :: special(:)
+ integer(1) :: hasParent
+ integer(1) :: noInitializationNeeded ! 1 if no component w/ init
+ integer(1) :: noDestructionNeeded ! 1 if no component w/ dealloc/final
+ integer(1) :: __padding0(5)
end type
type :: Binding