Skip to content

Commit ff2f02e

Browse files
committed
[flang] Use precompiled parsing headers
Most of the high memory usage and compilation time in the frontend units is due to including large parsing headers. This commit moves out several of the largest parsing headers into a new precompiled header linked to flangFrontend. The new compilation metrics for FrontendActions.cpp are as follows: User time (seconds): 38.40 System time (seconds): 2.00 Maximum resident set size (kbytes): 2710964 (2.58 GB) (vs 3.78 GB) ParserActions.cpp: User time (seconds): 69.37 System time (seconds): 1.81 Maximum resident set size (kbytes): 2599456 (2.47 GB) (vs 4 GB) Alongside the new precompiled header compilation unit User time (seconds): 41.61 System time (seconds): 2.72 Maximum resident set size (kbytes): 3107644 (2.96 GB) Signed-off-by: Kajetan Puchalski <[email protected]>
1 parent 4508d6a commit ff2f02e

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

flang/lib/Frontend/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,11 @@ add_flang_library(flangFrontend
7272
clangBasic
7373
clangDriver
7474
)
75+
76+
target_precompile_headers(flangFrontend PRIVATE
77+
[["flang/Parser/parsing.h"]]
78+
[["flang/Parser/parse-tree.h"]]
79+
[["flang/Parser/dump-parse-tree.h"]]
80+
[["flang/Lower/PFTBuilder.h"]]
81+
[["flang/Lower/Bridge.h"]]
82+
)

flang/lib/Frontend/CompilerInstance.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "flang/Frontend/CompilerInstance.h"
1414
#include "flang/Frontend/CompilerInvocation.h"
1515
#include "flang/Frontend/TextDiagnosticPrinter.h"
16-
#include "flang/Parser/parsing.h"
1716
#include "flang/Parser/provenance.h"
1817
#include "flang/Semantics/semantics.h"
1918
#include "flang/Support/Fortran-features.h"

flang/lib/Frontend/FrontendActions.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "flang/Frontend/CompilerInvocation.h"
1616
#include "flang/Frontend/FrontendOptions.h"
1717
#include "flang/Frontend/ParserActions.h"
18-
#include "flang/Lower/Bridge.h"
1918
#include "flang/Lower/Support/Verifier.h"
2019
#include "flang/Optimizer/Dialect/Support/FIRContext.h"
2120
#include "flang/Optimizer/Dialect/Support/KindMapping.h"

flang/lib/Frontend/ParserActions.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212

1313
#include "flang/Frontend/ParserActions.h"
1414
#include "flang/Frontend/CompilerInstance.h"
15-
#include "flang/Lower/Bridge.h"
16-
#include "flang/Lower/PFTBuilder.h"
17-
#include "flang/Parser/dump-parse-tree.h"
18-
#include "flang/Parser/parsing.h"
1915
#include "flang/Parser/provenance.h"
2016
#include "flang/Parser/source.h"
2117
#include "flang/Parser/unparse.h"

0 commit comments

Comments
 (0)