Skip to content

[flang] Use precompiled headers in Frontend, Lower, Parser, Semantics and Evaluate #131137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions flang/lib/Evaluate/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,17 @@ add_flang_library(FortranEvaluate
acc_gen
omp_gen
)

target_precompile_headers(FortranEvaluate PRIVATE
[["flang/Evaluate/common.h"]]
[["flang/Evaluate/call.h"]]
[["flang/Evaluate/traverse.h"]]
[["flang/Evaluate/shape.h"]]
[["flang/Evaluate/characteristics.h"]]
[["flang/Evaluate/variable.h"]]
[["flang/Evaluate/real.h"]]
[["flang/Evaluate/type.h"]]
[["flang/Evaluate/integer.h"]]
[["flang/Evaluate/expression.h"]]
[["flang/Evaluate/tools.h"]]
)
8 changes: 8 additions & 0 deletions flang/lib/Frontend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,11 @@ add_flang_library(flangFrontend
clangBasic
clangDriver
)

target_precompile_headers(flangFrontend PRIVATE
[["flang/Parser/parsing.h"]]
[["flang/Parser/parse-tree.h"]]
[["flang/Parser/dump-parse-tree.h"]]
[["flang/Lower/PFTBuilder.h"]]
[["flang/Lower/Bridge.h"]]
)
11 changes: 11 additions & 0 deletions flang/lib/Lower/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,14 @@ add_flang_library(FortranLower
MLIRLLVMDialect
MLIRSCFToControlFlow
)

target_precompile_headers(FortranLower PRIVATE
[["flang/Lower/ConvertExpr.h"]]
[["flang/Lower/SymbolMap.h"]]
[["flang/Lower/AbstractConverter.h"]]
[["flang/Lower/IterationSpace.h"]]
[["flang/Lower/CallInterface.h"]]
[["flang/Lower/BoxAnalyzer.h"]]
[["flang/Lower/PFTBuilder.h"]]
[["flang/Lower/DirectivesCommon.h"]]
)
8 changes: 8 additions & 0 deletions flang/lib/Parser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,11 @@ add_flang_library(FortranParser
omp_gen
acc_gen
)

target_precompile_headers(FortranParser PRIVATE
[["flang/Parser/parsing.h"]]
[["flang/Parser/parse-tree.h"]]
[["flang/Parser/provenance.h"]]
[["flang/Parser/message.h"]]
[["flang/Parser/parse-tree-visitor.h"]]
)
9 changes: 9 additions & 0 deletions flang/lib/Semantics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,12 @@ add_flang_library(FortranSemantics
FrontendOpenACC
TargetParser
)

target_precompile_headers(FortranSemantics PRIVATE
[["flang/Semantics/semantics.h"]]
[["flang/Semantics/type.h"]]
[["flang/Semantics/openmp-modifiers.h"]]
[["flang/Semantics/expression.h"]]
[["flang/Semantics/tools.h"]]
[["flang/Semantics/symbol.h"]]
)
7 changes: 7 additions & 0 deletions llvm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,13 @@ if(LLVM_CCACHE_BUILD)
endif()
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_PROGRAM})
else()
# Until a way to reliably configure ccache on Windows is found,
# disable precompiled headers for Windows + ccache builds
if(NOT CMAKE_DISABLE_PRECOMPILE_HEADERS)
message(WARNING "Using ccache with precompiled headers on Windows is currently not supported.
CMAKE_DISABLE_PRECOMPILE_HEADERS will be set to ON.")
set(CMAKE_DISABLE_PRECOMPILE_HEADERS "ON")
endif()
if(LLVM_CCACHE_MAXSIZE OR LLVM_CCACHE_DIR OR
NOT LLVM_CCACHE_PARAMS MATCHES "CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines,time_macros")
message(FATAL_ERROR "Ccache configuration through CMake is not supported on Windows. Please use environment variables.")
Expand Down