forked from OSchip/llvm-project
cd03e96f00
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(). |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
Fortran-parsers.cpp | ||
basic-parsers.h | ||
char-block.cpp | ||
char-buffer.cpp | ||
char-set.cpp | ||
characters.cpp | ||
debug-parser.cpp | ||
debug-parser.h | ||
executable-parsers.cpp | ||
expr-parsers.cpp | ||
expr-parsers.h | ||
instrumented-parser.cpp | ||
io-parsers.cpp | ||
message.cpp | ||
misc-parsers.h | ||
openacc-parsers.cpp | ||
openmp-parsers.cpp | ||
parse-tree.cpp | ||
parsing.cpp | ||
preprocessor.cpp | ||
preprocessor.h | ||
prescan.cpp | ||
prescan.h | ||
program-parsers.cpp | ||
provenance.cpp | ||
source.cpp | ||
stmt-parser.h | ||
token-parsers.h | ||
token-sequence.cpp | ||
token-sequence.h | ||
tools.cpp | ||
type-parser-implementation.h | ||
type-parsers.h | ||
unparse.cpp | ||
user-state.cpp |