Skip to content

Commit 3d9ce0a

Browse files
committed
[BatchMode] Store -{enable,disable}-batch-mode as a flag in Compilation.
1 parent 2bf7a79 commit 3d9ce0a

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

include/swift/Driver/Compilation.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ class Compilation {
156156
/// of date.
157157
bool EnableIncrementalBuild;
158158

159+
/// Indicates whether groups of parallel frontend jobs should be merged
160+
/// together and run in composite "batch jobs" when possible, to reduce
161+
/// redundant work.
162+
bool EnableBatchMode;
163+
159164
/// True if temporary files should not be deleted.
160165
bool SaveTemps;
161166

@@ -197,6 +202,7 @@ class Compilation {
197202
StringRef ArgsHash, llvm::sys::TimePoint<> StartTime,
198203
unsigned NumberOfParallelCommands = 1,
199204
bool EnableIncrementalBuild = false,
205+
bool EnableBatchMode = false,
200206
bool SkipTaskExecution = false,
201207
bool SaveTemps = false,
202208
bool ShowDriverTimeCompilation = false,
@@ -254,7 +260,11 @@ class Compilation {
254260
void disableIncrementalBuild() {
255261
EnableIncrementalBuild = false;
256262
}
257-
263+
264+
bool getBatchModeEnabled() const {
265+
return EnableBatchMode;
266+
}
267+
258268
bool getContinueBuildingAfterErrors() const {
259269
return ContinueBuildingAfterErrors;
260270
}

lib/Driver/Compilation.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "swift/Driver/Driver.h"
2525
#include "swift/Driver/Job.h"
2626
#include "swift/Driver/ParseableOutput.h"
27+
#include "swift/Driver/ToolChain.h"
2728
#include "llvm/ADT/DenseSet.h"
2829
#include "llvm/ADT/MapVector.h"
2930
#include "llvm/ADT/StringExtras.h"
@@ -94,6 +95,7 @@ Compilation::Compilation(DiagnosticEngine &Diags,
9495
StringRef ArgsHash, llvm::sys::TimePoint<> StartTime,
9596
unsigned NumberOfParallelCommands,
9697
bool EnableIncrementalBuild,
98+
bool EnableBatchMode,
9799
bool SkipTaskExecution,
98100
bool SaveTemps,
99101
bool ShowDriverTimeCompilation,
@@ -108,6 +110,7 @@ Compilation::Compilation(DiagnosticEngine &Diags,
108110
NumberOfParallelCommands(NumberOfParallelCommands),
109111
SkipTaskExecution(SkipTaskExecution),
110112
EnableIncrementalBuild(EnableIncrementalBuild),
113+
EnableBatchMode(EnableBatchMode),
111114
SaveTemps(SaveTemps),
112115
ShowDriverTimeCompilation(ShowDriverTimeCompilation),
113116
Stats(std::move(StatsReporter)) {

lib/Driver/Driver.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,10 @@ Driver::buildCompilation(const ToolChain &TC,
540540
Incremental = false;
541541
}
542542

543+
bool BatchMode = ArgList->hasFlag(options::OPT_enable_batch_mode,
544+
options::OPT_disable_batch_mode,
545+
false);
546+
543547
bool SaveTemps = ArgList->hasArg(options::OPT_save_temps);
544548
bool ContinueBuildingAfterErrors =
545549
ArgList->hasArg(options::OPT_continue_building_after_errors);
@@ -679,6 +683,7 @@ Driver::buildCompilation(const ToolChain &TC,
679683
ArgsHash, StartTime,
680684
NumberOfParallelCommands,
681685
Incremental,
686+
BatchMode,
682687
DriverSkipExecution,
683688
SaveTemps,
684689
ShowDriverTimeCompilation,

0 commit comments

Comments
 (0)