mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 03:56:42 +00:00

A submodule is a program unit that may contain the implementions of procedures declared in an ancestor module or submodule. Processing for the equivalence groups and variables declared in a submodule scope is similar to existing processing for the equivalence groups and variables in module and procedure scopes. However, module and procedure scopes are tied directly to code in the Pre-FIR Tree (PFT), whereas processing for a submodule must have access to an ancestor module scope that is guaranteed to be present in a .mod file, but is not guaranteed to be in the PFT. This difference is accommodated by tying processing directly to a front end scope. Function scopes that can be processed on the fly are done that way; the resulting variable information is never stored. Module and submodule scopes whose symbol information may be needed during lowering of any number of module procedures are instead cached on first use, and reused as needed. These changes are a direct extension of current code. All module and submodule variables in scope are processed, whether referenced or not. A possible alternative would be to instead process symbols only when first used. While this could ultimately be beneficial, such an approach must account for the presence of equivalence groups. That information is not currently available for on-the-fly variable processing. Some additional changes are needed to include submodules in places where modules must be considered, and to include separate module procedures in places where other subprogram variants are considered. There is also a fix for a bug involving the use of variables in an equivalence group in a namelist group, which also involves scope processing code.
12 lines
301 B
Fortran
12 lines
301 B
Fortran
! RUN: %flang_fc1 -fdebug-pre-fir-tree -fopenacc %s | FileCheck %s
|
|
|
|
! Test structure of the Pre-FIR tree with OpenACC declarative construct
|
|
|
|
! CHECK: Module m: module m
|
|
module m
|
|
real, dimension(10) :: x
|
|
! CHECK-NEXT: OpenACCDeclarativeConstruct
|
|
!$acc declare create(x)
|
|
end
|
|
! CHECK: End Module m
|