llvm-project/flang/lib/Parser
Peter Klausler cd03e96f00 [flang] Add & use a better visit() (take 2)
Adds flang/include/flang/Common/log2-visit.h, which defines
a Fortran::common::visit() template function that is a drop-in
replacement for std::visit().  Modifies most use sites in
the front-end and runtime to use common::visit().

The C++ standard mandates that std::visit() have O(1) execution
time, which forces implementations to build dispatch tables.
This new common::visit() is O(log2 N) in the number of alternatives
in a variant<>, but that N tends to be small and so this change
produces a fairly significant improvement in compiler build
memory requirements, a 5-10% improvement in compiler build time,
and a small improvement in compiler execution time.

Building with -DFLANG_USE_STD_VISIT causes common::visit()
to be an alias for std::visit().

Calls to common::visit() with multiple variant arguments
are referred to std::visit(), pending further work.

This change is enabled only for GCC builds with GCC >= 9;
an earlier attempt (D122441) ran into bugs in some versions of
clang and was reverted rather than simply disabled; and it is
not well tested with MSVC. In non-GCC and older GCC builds,
common::visit() is simply an alias for std::visit().
2022-04-16 16:00:48 -07:00
..
CMakeLists.txt [flang][driver] Add options for unparsing 2021-02-16 09:32:51 +00:00
Fortran-parsers.cpp [flang] Accept TYPE(intrinsic type) in declarations only for non-extension type 2022-04-14 18:19:37 -07:00
basic-parsers.h [flang] Add explanatory messages to grammar for language extensions 2022-03-18 16:14:27 -07:00
char-block.cpp
char-buffer.cpp [flang][MSVC] Use list<Message> rather than forward_list<> in Messages 2020-11-11 16:38:38 -08:00
char-set.cpp
characters.cpp
debug-parser.cpp [flang] Support multiple CookedSource instances 2020-09-02 10:34:23 -07:00
debug-parser.h
executable-parsers.cpp [flang] Add explanatory messages to grammar for language extensions 2022-03-18 16:14:27 -07:00
expr-parsers.cpp [flang] Add explanatory messages to grammar for language extensions 2022-03-18 16:14:27 -07:00
expr-parsers.h
instrumented-parser.cpp [flang] Support multiple CookedSource instances 2020-09-02 10:34:23 -07:00
io-parsers.cpp [flang] Add explanatory messages to grammar for language extensions 2022-03-18 16:14:27 -07:00
message.cpp [flang] Add & use a better visit() (take 2) 2022-04-16 16:00:48 -07:00
misc-parsers.h
openacc-parsers.cpp [openacc] Use TableGen enum for default clause value 2020-12-21 15:07:27 -05:00
openmp-parsers.cpp [flang][Parser] Add a node for individual sections in sections construct 2022-03-18 21:55:35 +05:30
parse-tree.cpp [flang] Add & use a better visit() (take 2) 2022-04-16 16:00:48 -07:00
parsing.cpp [flang] Distinguish intrinsic from non-intrinsic modules 2022-01-31 13:31:27 -08:00
preprocessor.cpp [flang] Distinguish usage and portability warning messages 2022-03-08 17:24:52 -08:00
preprocessor.h [flang] NFC: change non-nullable pointer arguments to references 2021-09-02 14:15:27 -07:00
prescan.cpp [flang] Skip `D` when including D debug line 2022-03-31 10:56:25 +02:00
prescan.h [flang] Enforce fixed form rules about END continuation 2021-09-17 10:59:17 -07:00
program-parsers.cpp [flang] Add explanatory messages to grammar for language extensions 2022-03-18 16:14:27 -07:00
provenance.cpp [flang] Add & use a better visit() (take 2) 2022-04-16 16:00:48 -07:00
source.cpp [flang] Search for #include "file" in right directory (take 2) 2021-01-27 15:41:29 -08:00
stmt-parser.h [flang][openacc] OpenACC 3.0 parser 2020-07-14 14:29:40 -04:00
token-parsers.h [flang] Add explanatory messages to grammar for language extensions 2022-03-18 16:14:27 -07:00
token-sequence.cpp [flang] Catch mismatched parentheses in prescanner 2021-10-06 14:00:15 -07:00
token-sequence.h [flang] Catch mismatched parentheses in prescanner 2021-10-06 14:00:15 -07:00
tools.cpp [flang] Add & use a better visit() (take 2) 2022-04-16 16:00:48 -07:00
type-parser-implementation.h
type-parsers.h [flang]Add Parser Support for Allocate Directive 2020-12-10 16:21:19 +00:00
unparse.cpp [flang] Add & use a better visit() (take 2) 2022-04-16 16:00:48 -07:00
user-state.cpp [flang] Implement semantics for DEC STRUCTURE/RECORD 2022-01-13 13:17:13 -08:00