Skip to content

Commit 0930d89

Browse files
committed
WIP Remove incremental builds from the Legacy driver
1 parent 7b78d39 commit 0930d89

File tree

124 files changed

+35
-6484
lines changed

Some content is hidden

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

124 files changed

+35
-6484
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 & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -127,77 +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, None, OutputType, {}) {}
198-
CompileJobAction(Action *Input, file_types::ID OutputType, InputInfo info)
199-
: IncrementalJobAction(Action::Kind::CompileJob, Input, OutputType,
200-
info) {}
137+
: JobAction(Action::Kind::CompileJob, None, OutputType) {}
138+
CompileJobAction(Action *Input, file_types::ID OutputType)
139+
: JobAction(Action::Kind::CompileJob, Input, OutputType) {}
201140

202141
static bool classof(const Action *A) {
203142
return A->getKind() == Action::Kind::CompileJob;
@@ -281,12 +220,12 @@ class REPLJobAction : public JobAction {
281220
}
282221
};
283222

284-
class MergeModuleJobAction : public IncrementalJobAction {
223+
class MergeModuleJobAction : public JobAction {
285224
virtual void anchor() override;
286225
public:
287-
MergeModuleJobAction(ArrayRef<const Action *> Inputs, InputInfo input)
288-
: IncrementalJobAction(Action::Kind::MergeModuleJob, Inputs,
289-
file_types::TY_SwiftModuleFile, input) {}
226+
MergeModuleJobAction(ArrayRef<const Action *> Inputs)
227+
: JobAction(Action::Kind::MergeModuleJob, Inputs,
228+
file_types::TY_SwiftModuleFile) {}
290229

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

include/swift/Driver/Compilation.h

Lines changed: 3 additions & 89 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,10 +83,6 @@ 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

9287
Result(const Result &) = delete;
9388
Result &operator=(const Result &) = delete;
@@ -97,8 +92,7 @@ class Compilation {
9792

9893
/// Construct a \c Compilation::Result from just an exit code.
9994
static Result code(int code) {
100-
return Compilation::Result{false, code,
101-
fine_grained_dependencies::ModuleDepGraph()};
95+
return Compilation::Result{false, code};
10296
}
10397
};
10498

@@ -166,33 +160,10 @@ class Compilation {
166160
/// These apply whether the compilation succeeds or fails. If the
167161
llvm::StringMap<PreserveOnSignal> TempFilePaths;
168162

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

192-
/// Indicates whether tasks should only be executed if their output is out
193-
/// of date.
194-
bool EnableIncrementalBuild;
195-
196167
/// Indicates whether groups of parallel frontend jobs should be merged
197168
/// together and run in composite "batch jobs" when possible, to reduce
198169
/// redundant work.
@@ -251,17 +222,6 @@ class Compilation {
251222
/// -disable-only-one-dependency-file on the command line.
252223
const bool OnlyOneDependencyFile;
253224

254-
private:
255-
/// Helpful for debugging, but slows down the driver. So, only turn on when
256-
/// needed.
257-
const bool VerifyFineGrainedDependencyGraphAfterEveryImport;
258-
/// Helpful for debugging, but slows down the driver. So, only turn on when
259-
/// needed.
260-
const bool EmitFineGrainedDependencyDotFileAfterEveryImport;
261-
262-
/// (experimental) Enable cross-module incremental build scheduling.
263-
const bool EnableCrossModuleIncrementalBuild;
264-
265225
private:
266226
template <typename T>
267227
static T *unwrap(const std::unique_ptr<T> &p) {
@@ -280,22 +240,15 @@ class Compilation {
280240
std::unique_ptr<llvm::opt::InputArgList> InputArgs,
281241
std::unique_ptr<llvm::opt::DerivedArgList> TranslatedArgs,
282242
InputFileList InputsWithTypes,
283-
std::string CompilationRecordPath,
284-
StringRef ArgsHash, llvm::sys::TimePoint<> StartTime,
285-
llvm::sys::TimePoint<> LastBuildTime,
286243
size_t FilelistThreshold,
287-
bool EnableIncrementalBuild = false,
288244
bool EnableBatchMode = false,
289245
unsigned BatchSeed = 0,
290246
Optional<unsigned> BatchCount = None,
291247
Optional<unsigned> BatchSizeLimit = None,
292248
bool SaveTemps = false,
293249
bool ShowDriverTimeCompilation = false,
294250
std::unique_ptr<UnifiedStatsReporter> Stats = nullptr,
295-
bool OnlyOneDependencyFile = false,
296-
bool VerifyFineGrainedDependencyGraphAfterEveryImport = false,
297-
bool EmitFineGrainedDependencyDotFileAfterEveryImport = false,
298-
bool EnableCrossModuleIncrementalBuild = false);
251+
bool OnlyOneDependencyFile = false);
299252
// clang-format on
300253
~Compilation();
301254

@@ -348,19 +301,6 @@ class Compilation {
348301
return DerivedOutputFileMap;
349302
}
350303

351-
bool getIncrementalBuildEnabled() const {
352-
return EnableIncrementalBuild;
353-
}
354-
void disableIncrementalBuild(Twine why);
355-
356-
bool getVerifyFineGrainedDependencyGraphAfterEveryImport() const {
357-
return VerifyFineGrainedDependencyGraphAfterEveryImport;
358-
}
359-
360-
bool getEmitFineGrainedDependencyDotFileAfterEveryImport() const {
361-
return EmitFineGrainedDependencyDotFileAfterEveryImport;
362-
}
363-
364304
bool getBatchModeEnabled() const {
365305
return EnableBatchMode;
366306
}
@@ -372,13 +312,6 @@ class Compilation {
372312
ContinueBuildingAfterErrors = Value;
373313
}
374314

375-
bool getShowIncrementalBuildDecisions() const {
376-
return ShowIncrementalBuildDecisions;
377-
}
378-
void setShowIncrementalBuildDecisions(bool value = true) {
379-
ShowIncrementalBuildDecisions = value;
380-
}
381-
382315
bool getShowJobLifecycle() const {
383316
return ShowJobLifecycle;
384317
}
@@ -390,10 +323,6 @@ class Compilation {
390323
return ShowDriverTimeCompilation;
391324
}
392325

393-
bool getEnableCrossModuleIncrementalBuild() const {
394-
return EnableCrossModuleIncrementalBuild;
395-
}
396-
397326
size_t getFilelistThreshold() const {
398327
return FilelistThreshold;
399328
}
@@ -415,7 +344,7 @@ class Compilation {
415344
/// True if extra work has to be done when tracing through the dependency
416345
/// graph, either in order to print dependencies or to collect statistics.
417346
bool getTraceDependencies() const {
418-
return getShowIncrementalBuildDecisions() || getStatsReporter();
347+
return getStatsReporter();
419348
}
420349

421350
OutputLevel getOutputLevel() const {
@@ -426,10 +355,6 @@ class Compilation {
426355
return BatchSeed;
427356
}
428357

429-
llvm::sys::TimePoint<> getLastBuildTime() const {
430-
return LastBuildTime;
431-
}
432-
433358
Optional<unsigned> getBatchCount() const {
434359
return BatchCount;
435360
}
@@ -447,17 +372,6 @@ class Compilation {
447372
/// \sa types::isPartOfSwiftCompilation
448373
const char *getAllSourcesPath() const;
449374

450-
/// Retrieve the path to the external swift deps file.
451-
///
452-
/// For cross-module incremental builds, this file contains the dependencies
453-
/// from all the modules integrated over the prior build.
454-
///
455-
/// Currently this patch is relative to the build record, but we may want
456-
/// to allow the output file map to customize this at some point.
457-
std::string getExternalSwiftDepsFilePath() const {
458-
return CompilationRecordPath + ".external";
459-
}
460-
461375
/// Asks the Compilation to perform the Jobs which it knows about.
462376
///
463377
/// \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
@@ -315,12 +315,9 @@ class Driver {
315315
/// \param[out] TopLevelActions The main Actions to build Jobs for.
316316
/// \param TC the default host tool chain.
317317
/// \param OI The OutputInfo for which Actions should be generated.
318-
/// \param OutOfDateMap If present, information used to decide which files
319-
/// need to be rebuilt.
320318
/// \param C The Compilation to which Actions should be added.
321319
void buildActions(SmallVectorImpl<const Action *> &TopLevelActions,
322320
const ToolChain &TC, const OutputInfo &OI,
323-
const InputInfoMap *OutOfDateMap,
324321
Compilation &C) const;
325322

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

0 commit comments

Comments
 (0)