Skip to content

Commit cd7be4c

Browse files
committed
WIP Remove incremental builds from the Legacy driver
1 parent 8e53e7a commit cd7be4c

File tree

395 files changed

+40
-14014
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

395 files changed

+40
-14014
lines changed

include/swift/AST/DiagnosticsDriver.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ WARNING(warn_drv_darwin_sdk_invalid_settings, none,
188188
WARNING(warning_unsupported_driver_option,none,
189189
"option '%0' is only supported in swift-driver", (StringRef))
190190

191+
WARNING(new_driver_not_found,none,
192+
"using (deprecated) legacy driver, Swift installation does not contain swift-driver at: '%0'", (StringRef))
193+
191194
WARNING(old_driver_deprecated,none,
192195
"legacy driver is now deprecated; consider avoiding specifying '%0'", (StringRef))
193196
#define UNDEFINE_DIAGNOSTIC_MACROS

include/swift/Driver/Action.h

Lines changed: 8 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -127,78 +127,16 @@ class JobAction : public Action {
127127
}
128128
};
129129

130-
class IncrementalJobAction : public JobAction {
131-
public:
132-
struct InputInfo {
133-
/// The status of an input known to the driver. These are used to affect
134-
/// the scheduling decisions made during an incremental build.
135-
///
136-
/// \Note The order of cases matters. They are ordered from least to
137-
/// greatest impact on the incremental build schedule.
138-
enum class Status {
139-
/// The input to this job is up to date.
140-
UpToDate,
141-
/// The input to this job has changed in a way that requires this job to
142-
/// be rerun, but not in such a way that it requires a cascading rebuild.
143-
NeedsNonCascadingBuild,
144-
/// The input to this job has changed in a way that requires this job to
145-
/// be rerun, and in such a way that all jobs dependent upon this one
146-
/// must be scheduled as well.
147-
NeedsCascadingBuild,
148-
/// The input to this job was not known to the driver when it was last
149-
/// run.
150-
NewlyAdded
151-
};
152-
153-
public:
154-
Status status = Status::UpToDate;
155-
llvm::sys::TimePoint<> previousModTime;
156-
157-
InputInfo() = default;
158-
InputInfo(Status stat, llvm::sys::TimePoint<> time)
159-
: status(stat), previousModTime(time) {}
160-
161-
static InputInfo makeNewlyAdded() {
162-
return {Status::NewlyAdded, llvm::sys::TimePoint<>::max()};
163-
}
164-
165-
static InputInfo makeNeedsCascadingRebuild() {
166-
return {Status::NeedsCascadingBuild, llvm::sys::TimePoint<>::min()};
167-
}
168-
};
169-
170-
private:
171-
virtual void anchor() override;
172-
InputInfo inputInfo;
173-
174-
public:
175-
IncrementalJobAction(Kind Kind, ArrayRef<const Action *> Inputs,
176-
file_types::ID Type, InputInfo info)
177-
: JobAction(Kind, Inputs, Type), inputInfo(info) {}
178-
179-
public:
180-
InputInfo getInputInfo() const {
181-
return inputInfo;
182-
}
183-
184-
public:
185-
static bool classof(const Action *A) {
186-
return A->getKind() == Action::Kind::CompileJob ||
187-
A->getKind() == Action::Kind::MergeModuleJob;
188-
}
189-
};
190130

191-
class CompileJobAction : public IncrementalJobAction {
131+
class CompileJobAction : public JobAction {
192132
private:
193133
virtual void anchor() override;
194134

195135
public:
196136
CompileJobAction(file_types::ID OutputType)
197-
: IncrementalJobAction(Action::Kind::CompileJob, llvm::None, OutputType,
198-
{}) {}
199-
CompileJobAction(Action *Input, file_types::ID OutputType, InputInfo info)
200-
: IncrementalJobAction(Action::Kind::CompileJob, Input, OutputType,
201-
info) {}
137+
: JobAction(Action::Kind::CompileJob, llvm::None, OutputType) {}
138+
CompileJobAction(Action *Input, file_types::ID OutputType)
139+
: JobAction(Action::Kind::CompileJob, Input, OutputType) {}
202140

203141
static bool classof(const Action *A) {
204142
return A->getKind() == Action::Kind::CompileJob;
@@ -282,12 +220,12 @@ class REPLJobAction : public JobAction {
282220
}
283221
};
284222

285-
class MergeModuleJobAction : public IncrementalJobAction {
223+
class MergeModuleJobAction : public JobAction {
286224
virtual void anchor() override;
287225
public:
288-
MergeModuleJobAction(ArrayRef<const Action *> Inputs, InputInfo input)
289-
: IncrementalJobAction(Action::Kind::MergeModuleJob, Inputs,
290-
file_types::TY_SwiftModuleFile, input) {}
226+
MergeModuleJobAction(ArrayRef<const Action *> Inputs)
227+
: JobAction(Action::Kind::MergeModuleJob, Inputs,
228+
file_types::TY_SwiftModuleFile) {}
291229

292230
static bool classof(const Action *A) {
293231
return A->getKind() == Action::Kind::MergeModuleJob;

include/swift/Driver/Compilation.h

Lines changed: 7 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "swift/Basic/OutputFileMap.h"
2525
#include "swift/Basic/Statistic.h"
2626
#include "swift/Driver/Driver.h"
27-
#include "swift/Driver/FineGrainedDependencyDriverGraph.h"
2827
#include "swift/Driver/Job.h"
2928
#include "swift/Driver/Util.h"
3029
#include "llvm/ADT/StringRef.h"
@@ -84,15 +83,9 @@ class Compilation {
8483
bool hadAbnormalExit;
8584
/// The exit code of this driver process.
8685
int exitCode;
87-
/// The dependency graph built up during the compilation of this module.
88-
///
89-
/// This data is used for cross-module module dependencies.
90-
fine_grained_dependencies::ModuleDepGraph depGraph;
9186

92-
Result(bool hadAbnormalExit, int exitCode,
93-
fine_grained_dependencies::ModuleDepGraph depGraph)
94-
: hadAbnormalExit(hadAbnormalExit), exitCode(exitCode),
95-
depGraph(depGraph) {}
87+
Result(bool hadAbnormalExit, int exitCode)
88+
: hadAbnormalExit(hadAbnormalExit), exitCode(exitCode) {}
9689

9790
Result(const Result &) = delete;
9891
Result &operator=(const Result &) = delete;
@@ -102,8 +95,7 @@ class Compilation {
10295

10396
/// Construct a \c Compilation::Result from just an exit code.
10497
static Result code(int code) {
105-
return Compilation::Result{false, code,
106-
fine_grained_dependencies::ModuleDepGraph()};
98+
return Compilation::Result{false, code};
10799
}
108100
};
109101

@@ -171,33 +163,10 @@ class Compilation {
171163
/// These apply whether the compilation succeeds or fails. If the
172164
llvm::StringMap<PreserveOnSignal> TempFilePaths;
173165

174-
/// Write information about this compilation to this file.
175-
///
176-
/// This is used for incremental builds.
177-
std::string CompilationRecordPath;
178-
179-
/// A hash representing all the arguments that could trigger a full rebuild.
180-
std::string ArgsHash;
181-
182-
/// When the build was started.
183-
///
184-
/// This should be as close as possible to when the driver was invoked, since
185-
/// it's used as a lower bound.
186-
llvm::sys::TimePoint<> BuildStartTime;
187-
188-
/// The time of the last build.
189-
///
190-
/// If unknown, this will be some time in the past.
191-
llvm::sys::TimePoint<> LastBuildTime = llvm::sys::TimePoint<>::min();
192-
193166
/// Indicates whether this Compilation should continue execution of subtasks
194167
/// even if they returned an error status.
195168
bool ContinueBuildingAfterErrors = false;
196169

197-
/// Indicates whether tasks should only be executed if their output is out
198-
/// of date.
199-
bool EnableIncrementalBuild;
200-
201170
/// Indicates whether groups of parallel frontend jobs should be merged
202171
/// together and run in composite "batch jobs" when possible, to reduce
203172
/// redundant work.
@@ -256,17 +225,6 @@ class Compilation {
256225
/// -disable-only-one-dependency-file on the command line.
257226
const bool OnlyOneDependencyFile;
258227

259-
private:
260-
/// Helpful for debugging, but slows down the driver. So, only turn on when
261-
/// needed.
262-
const bool VerifyFineGrainedDependencyGraphAfterEveryImport;
263-
/// Helpful for debugging, but slows down the driver. So, only turn on when
264-
/// needed.
265-
const bool EmitFineGrainedDependencyDotFileAfterEveryImport;
266-
267-
/// (experimental) Enable cross-module incremental build scheduling.
268-
const bool EnableCrossModuleIncrementalBuild;
269-
270228
private:
271229
template <typename T>
272230
static T *unwrap(const std::unique_ptr<T> &p) {
@@ -285,22 +243,15 @@ class Compilation {
285243
std::unique_ptr<llvm::opt::InputArgList> InputArgs,
286244
std::unique_ptr<llvm::opt::DerivedArgList> TranslatedArgs,
287245
InputFileList InputsWithTypes,
288-
std::string CompilationRecordPath,
289-
StringRef ArgsHash, llvm::sys::TimePoint<> StartTime,
290-
llvm::sys::TimePoint<> LastBuildTime,
291246
size_t FilelistThreshold,
292-
bool EnableIncrementalBuild = false,
293247
bool EnableBatchMode = false,
294248
unsigned BatchSeed = 0,
295249
llvm::Optional<unsigned> BatchCount = llvm::None,
296250
llvm::Optional<unsigned> BatchSizeLimit = llvm::None,
297251
bool SaveTemps = false,
298252
bool ShowDriverTimeCompilation = false,
299253
std::unique_ptr<UnifiedStatsReporter> Stats = nullptr,
300-
bool OnlyOneDependencyFile = false,
301-
bool VerifyFineGrainedDependencyGraphAfterEveryImport = false,
302-
bool EmitFineGrainedDependencyDotFileAfterEveryImport = false,
303-
bool EnableCrossModuleIncrementalBuild = false);
254+
bool OnlyOneDependencyFile = false);
304255
// clang-format on
305256
~Compilation();
306257

@@ -353,19 +304,6 @@ class Compilation {
353304
return DerivedOutputFileMap;
354305
}
355306

356-
bool getIncrementalBuildEnabled() const {
357-
return EnableIncrementalBuild;
358-
}
359-
void disableIncrementalBuild(Twine why);
360-
361-
bool getVerifyFineGrainedDependencyGraphAfterEveryImport() const {
362-
return VerifyFineGrainedDependencyGraphAfterEveryImport;
363-
}
364-
365-
bool getEmitFineGrainedDependencyDotFileAfterEveryImport() const {
366-
return EmitFineGrainedDependencyDotFileAfterEveryImport;
367-
}
368-
369307
bool getBatchModeEnabled() const {
370308
return EnableBatchMode;
371309
}
@@ -377,13 +315,6 @@ class Compilation {
377315
ContinueBuildingAfterErrors = Value;
378316
}
379317

380-
bool getShowIncrementalBuildDecisions() const {
381-
return ShowIncrementalBuildDecisions;
382-
}
383-
void setShowIncrementalBuildDecisions(bool value = true) {
384-
ShowIncrementalBuildDecisions = value;
385-
}
386-
387318
bool getShowJobLifecycle() const {
388319
return ShowJobLifecycle;
389320
}
@@ -395,10 +326,6 @@ class Compilation {
395326
return ShowDriverTimeCompilation;
396327
}
397328

398-
bool getEnableCrossModuleIncrementalBuild() const {
399-
return EnableCrossModuleIncrementalBuild;
400-
}
401-
402329
size_t getFilelistThreshold() const {
403330
return FilelistThreshold;
404331
}
@@ -420,7 +347,7 @@ class Compilation {
420347
/// True if extra work has to be done when tracing through the dependency
421348
/// graph, either in order to print dependencies or to collect statistics.
422349
bool getTraceDependencies() const {
423-
return getShowIncrementalBuildDecisions() || getStatsReporter();
350+
return getStatsReporter();
424351
}
425352

426353
OutputLevel getOutputLevel() const {
@@ -431,12 +358,10 @@ class Compilation {
431358
return BatchSeed;
432359
}
433360

434-
llvm::sys::TimePoint<> getLastBuildTime() const {
435-
return LastBuildTime;
361+
llvm::Optional<unsigned> getBatchCount() const {
362+
return BatchCount;
436363
}
437364

438-
llvm::Optional<unsigned> getBatchCount() const { return BatchCount; }
439-
440365
llvm::Optional<unsigned> getBatchSizeLimit() const { return BatchSizeLimit; }
441366

442367
/// Requests the path to a file containing all input source files. This can
@@ -448,17 +373,6 @@ class Compilation {
448373
/// \sa types::isPartOfSwiftCompilation
449374
const char *getAllSourcesPath() const;
450375

451-
/// Retrieve the path to the external swift deps file.
452-
///
453-
/// For cross-module incremental builds, this file contains the dependencies
454-
/// from all the modules integrated over the prior build.
455-
///
456-
/// Currently this patch is relative to the build record, but we may want
457-
/// to allow the output file map to customize this at some point.
458-
std::string getExternalSwiftDepsFilePath() const {
459-
return CompilationRecordPath + ".external";
460-
}
461-
462376
/// Asks the Compilation to perform the Jobs which it knows about.
463377
///
464378
/// \param TQ The TaskQueue used to schedule jobs for execution.

include/swift/Driver/Driver.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,9 @@ class Driver {
323323
/// \param[out] TopLevelActions The main Actions to build Jobs for.
324324
/// \param TC the default host tool chain.
325325
/// \param OI The OutputInfo for which Actions should be generated.
326-
/// \param OutOfDateMap If present, information used to decide which files
327-
/// need to be rebuilt.
328326
/// \param C The Compilation to which Actions should be added.
329327
void buildActions(SmallVectorImpl<const Action *> &TopLevelActions,
330328
const ToolChain &TC, const OutputInfo &OI,
331-
const InputInfoMap *OutOfDateMap,
332329
Compilation &C) const;
333330

334331
/// Construct the OutputFileMap for the driver from the given arguments.

0 commit comments

Comments
 (0)