Skip to content

Commit bfb57ed

Browse files
committed
Deprecate '-emit-bitcode' functionality
1 parent 99bb1d1 commit bfb57ed

10 files changed

+78
-623
lines changed

Sources/SwiftDriver/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ add_library(SwiftDriver
7272

7373
Jobs/APIDigesterJobs.swift
7474
Jobs/AutolinkExtractJob.swift
75-
Jobs/BackendJob.swift
7675
Jobs/CommandLineArguments.swift
7776
Jobs/CompileJob.swift
7877
Jobs/DarwinToolchain+LinkerSupport.swift

Sources/SwiftDriver/Driver/Driver.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2424,8 +2424,8 @@ extension Driver {
24242424
linkerOutputType = .executable
24252425
}
24262426

2427-
// warn if -embed-bitcode is set and the output type is not an object
2428-
if parsedOptions.hasArgument(.embedBitcode) && compilerOutputType != .object {
2427+
// warn if -embed-bitcode is set
2428+
if parsedOptions.hasArgument(.embedBitcode) {
24292429
diagnosticsEngine.emit(.warn_ignore_embed_bitcode)
24302430
parsedOptions.eraseArgument(.embedBitcode)
24312431
}
@@ -2449,7 +2449,7 @@ extension Diagnostic.Message {
24492449
}
24502450

24512451
static var warn_ignore_embed_bitcode: Diagnostic.Message {
2452-
.warning("ignoring -embed-bitcode since no object file is being generated")
2452+
.warning("'-embed-bitcode' has been deprecated")
24532453
}
24542454

24552455
static var warn_ignore_embed_bitcode_marker: Diagnostic.Message {

Sources/SwiftDriver/IncrementalCompilation/FirstWaveComputer.swift

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ extension IncrementalCompilationState {
5454

5555
public func compute(batchJobFormer: inout Driver) throws -> FirstWave {
5656
return try blockingConcurrentAccessOrMutation {
57-
let (initiallySkippedCompileGroups, mandatoryJobsInOrder) =
57+
let (initiallySkippedCompileJobs, mandatoryJobsInOrder) =
5858
try computeInputsAndGroups(batchJobFormer: &batchJobFormer)
5959
return FirstWave(
60-
initiallySkippedCompileGroups: initiallySkippedCompileGroups,
60+
initiallySkippedCompileJobs: initiallySkippedCompileJobs,
6161
mandatoryJobsInOrder: mandatoryJobsInOrder)
6262
}
6363
}
@@ -76,33 +76,33 @@ extension IncrementalCompilationState.FirstWaveComputer {
7676
/// At this stage the graph will have all external dependencies found in the swiftDeps or in the priors
7777
/// listed in fingerprintExternalDependencies.
7878
private func computeInputsAndGroups(batchJobFormer: inout Driver)
79-
throws -> (initiallySkippedCompileGroups: [TypedVirtualPath: CompileJobGroup],
79+
throws -> (initiallySkippedCompileJobs: [TypedVirtualPath: Job],
8080
mandatoryJobsInOrder: [Job])
8181
{
82-
let compileGroups =
82+
let compileJobs =
8383
Dictionary(uniqueKeysWithValues:
84-
jobsInPhases.compileGroups.map { ($0.primaryInput, $0) })
84+
jobsInPhases.compileJobs.map { ($0.primaryInputs[0], $0) })
8585
let buildRecord = self.moduleDependencyGraph.buildRecord
8686
let jobCreatingPch = jobsInPhases.beforeCompiles.first(where: {$0.kind == .generatePCH})
8787
guard !buildRecord.inputInfos.isEmpty else {
8888
func everythingIsMandatory()
89-
throws -> (initiallySkippedCompileGroups: [TypedVirtualPath: CompileJobGroup],
89+
throws -> (initiallySkippedCompileJobs: [TypedVirtualPath: Job],
9090
mandatoryJobsInOrder: [Job])
9191
{
92-
let mandatoryCompileGroupsInOrder = self.inputFiles.swiftSourceFiles.compactMap {
93-
input -> CompileJobGroup? in
94-
compileGroups[input.typedFile]
92+
let mandatoryCompileJobsInOrder = self.inputFiles.swiftSourceFiles.compactMap {
93+
input -> Job? in
94+
compileJobs[input.typedFile]
9595
}
9696

9797
let mandatoryJobsInOrder = try
9898
jobsInPhases.beforeCompiles +
9999
batchJobFormer.formBatchedJobs(
100-
mandatoryCompileGroupsInOrder.flatMap {$0.allJobs()},
100+
mandatoryCompileJobsInOrder,
101101
showJobLifecycle: showJobLifecycle,
102102
jobCreatingPch: jobCreatingPch)
103103

104104
moduleDependencyGraph.setPhase(to: .buildingAfterEachCompilation)
105-
return (initiallySkippedCompileGroups: [:],
105+
return (initiallySkippedCompileJobs: [:],
106106
mandatoryJobsInOrder: mandatoryJobsInOrder)
107107
}
108108
return try everythingIsMandatory()
@@ -114,17 +114,17 @@ extension IncrementalCompilationState.FirstWaveComputer {
114114
moduleDependencyGraph,
115115
buildRecord)
116116

117-
let initiallySkippedCompileGroups = compileGroups.filter { initiallySkippedInputs.contains($0.key) }
117+
let initiallySkippedCompileJobs = compileJobs.filter { initiallySkippedInputs.contains($0.key) }
118118

119-
let mandatoryCompileGroupsInOrder = inputFiles.compactMap {
120-
input -> CompileJobGroup? in
119+
let mandatoryCompileJobsInOrder = inputFiles.compactMap {
120+
input -> Job? in
121121
initiallySkippedInputs.contains(input)
122122
? nil
123-
: compileGroups[input]
123+
: compileJobs[input]
124124
}
125125

126126
let batchedCompilationJobs = try batchJobFormer.formBatchedJobs(
127-
mandatoryCompileGroupsInOrder.flatMap {$0.allJobs()},
127+
mandatoryCompileJobsInOrder,
128128
showJobLifecycle: showJobLifecycle,
129129
jobCreatingPch: jobCreatingPch)
130130

@@ -133,7 +133,7 @@ extension IncrementalCompilationState.FirstWaveComputer {
133133
// have any dependencies on them.
134134
let skipAllJobs = batchedCompilationJobs.isEmpty ? !nonVerifyAfterCompileJobsDependOnBeforeCompileJobs() : false
135135
let mandatoryJobsInOrder = skipAllJobs ? [] : jobsInPhases.beforeCompiles + batchedCompilationJobs
136-
return (initiallySkippedCompileGroups: initiallySkippedCompileGroups,
136+
return (initiallySkippedCompileJobs: initiallySkippedCompileJobs,
137137
mandatoryJobsInOrder: mandatoryJobsInOrder)
138138
}
139139

@@ -156,7 +156,7 @@ extension IncrementalCompilationState.FirstWaveComputer {
156156
_ moduleDependencyGraph: ModuleDependencyGraph,
157157
_ buildRecord: BuildRecord
158158
) -> Set<TypedVirtualPath> {
159-
let allGroups = jobsInPhases.compileGroups
159+
let allCompileJobs = jobsInPhases.compileJobs
160160
// Input == source file
161161
let changedInputs = computeChangedInputs(moduleDependencyGraph, buildRecord)
162162

@@ -176,9 +176,9 @@ extension IncrementalCompilationState.FirstWaveComputer {
176176
reporter.report("Has malformed dependency source; will queue", input)
177177
}
178178
}
179-
let inputsMissingOutputs = allGroups.compactMap {
179+
let inputsMissingOutputs = allCompileJobs.compactMap {
180180
$0.outputs.contains { (try? !fileSystem.exists($0.file)) ?? true }
181-
? $0.primaryInput
181+
? $0.primaryInputs[0]
182182
: nil
183183
}
184184
if let reporter = reporter {
@@ -257,8 +257,8 @@ extension IncrementalCompilationState.FirstWaveComputer {
257257
_ moduleDependencyGraph: ModuleDependencyGraph,
258258
_ outOfDateBuildRecord: BuildRecord
259259
) -> [ChangedInput] {
260-
jobsInPhases.compileGroups.compactMap { group in
261-
let input = group.primaryInput
260+
jobsInPhases.compileJobs.compactMap { job in
261+
let input = job.primaryInputs[0]
262262
let modDate = buildRecordInfo.compilationInputModificationDates[input] ?? .distantFuture
263263
let inputInfo = outOfDateBuildRecord.inputInfos[input.file]
264264
let previousCompilationStatus = inputInfo?.status ?? .newlyAdded

Sources/SwiftDriver/IncrementalCompilation/IncrementalCompilationProtectedState.swift

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ extension IncrementalCompilationState {
2222
///
2323
/// This state is modified during the incremental build. All accesses must
2424
/// be protected by the confinement queue.
25-
fileprivate var skippedCompileGroups: [TypedVirtualPath: CompileJobGroup]
25+
fileprivate var skippedCompileJobs: [TypedVirtualPath: Job]
2626

2727
/// Sadly, has to be `var` for formBatchedJobs
2828
///
@@ -37,11 +37,11 @@ extension IncrementalCompilationState {
3737
fileprivate let jobCreatingPch: Job?
3838
fileprivate let reporter: Reporter?
3939

40-
init(skippedCompileGroups: [TypedVirtualPath: CompileJobGroup],
40+
init(skippedCompileJobs: [TypedVirtualPath: Job],
4141
_ moduleDependencyGraph: ModuleDependencyGraph,
4242
_ jobCreatingPch: Job?,
4343
_ driver: inout Driver) {
44-
self.skippedCompileGroups = skippedCompileGroups
44+
self.skippedCompileJobs = skippedCompileJobs
4545
self.moduleDependencyGraph = moduleDependencyGraph
4646
self.reporter = moduleDependencyGraph.info.reporter
4747
self.jobCreatingPch = jobCreatingPch
@@ -112,25 +112,25 @@ extension IncrementalCompilationState.ProtectedState {
112112
}
113113
self.reporter?.report(
114114
"Failed to read some dependencies source; compiling everything", input)
115-
return TransitivelyInvalidatedSwiftSourceFileSet(skippedCompileGroups.keys.swiftSourceFiles)
115+
return TransitivelyInvalidatedSwiftSourceFileSet(skippedCompileJobs.keys.swiftSourceFiles)
116116
}
117117

118118
/// Find the jobs that now must be run that were not originally known to be needed.
119119
fileprivate mutating func getUnbatchedJobs(
120120
for invalidatedInputs: Set<SwiftSourceFile>
121121
) throws -> [Job] {
122122
mutationSafetyPrecondition()
123-
return invalidatedInputs.flatMap { input -> [Job] in
124-
if let group = skippedCompileGroups.removeValue(forKey: input.typedFile) {
125-
let primaryInputs = group.compileJob.primarySwiftSourceFiles
123+
return invalidatedInputs.compactMap { input -> Job? in
124+
if let job = skippedCompileJobs.removeValue(forKey: input.typedFile) {
125+
let primaryInputs = job.primarySwiftSourceFiles
126126
assert(primaryInputs.count == 1)
127127
assert(primaryInputs[0] == input)
128128
self.reporter?.report("Scheduling invalidated", input)
129-
return group.allJobs()
129+
return job
130130
}
131131
else {
132132
self.reporter?.report("Tried to schedule invalidated input again", input)
133-
return []
133+
return nil
134134
}
135135
}
136136
}
@@ -141,13 +141,12 @@ extension IncrementalCompilationState.ProtectedState {
141141
extension IncrementalCompilationState.ProtectedState {
142142
var skippedCompilationInputs: Set<TypedVirtualPath> {
143143
accessSafetyPrecondition()
144-
return Set(skippedCompileGroups.keys)
144+
return Set(skippedCompileJobs.keys)
145145
}
146146
public var skippedJobs: [Job] {
147147
accessSafetyPrecondition()
148-
return skippedCompileGroups.values
149-
.sorted {$0.primaryInput.file.name < $1.primaryInput.file.name}
150-
.flatMap {$0.allJobs()}
148+
return skippedCompileJobs.values
149+
.sorted {$0.primaryInputs[0].file.name < $1.primaryInputs[0].file.name}
151150
}
152151

153152
func writeGraph(to path: VirtualPath,

Sources/SwiftDriver/IncrementalCompilation/IncrementalCompilationState+Extensions.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ extension IncrementalCompilationState {
6666
/// The set of compile jobs we can definitely skip given the state of the
6767
/// incremental dependency graph and the status of the input files for this
6868
/// incremental build.
69-
let initiallySkippedCompileGroups: [TypedVirtualPath: CompileJobGroup]
69+
let initiallySkippedCompileJobs: [TypedVirtualPath: Job]
7070
/// All of the pre-compile or compilation job (groups) known to be required
7171
/// for the first wave to execute.
7272
/// The primaries could be other than .swift files, i.e. .sib
@@ -90,12 +90,6 @@ extension Driver {
9090
because: "it is not compatible with \(compilerMode)"))
9191
return false
9292
}
93-
guard !parsedOptions.hasArgument(.embedBitcode) else {
94-
diagnosticEngine.emit(
95-
.remark_incremental_compilation_has_been_disabled(
96-
because: "is not currently compatible with embedding LLVM IR bitcode"))
97-
return false
98-
}
9993
return true
10094
}
10195
}

Sources/SwiftDriver/IncrementalCompilation/IncrementalCompilationState.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public final class IncrementalCompilationState {
7171
self.info = initialState.graph.info
7272
self.upToDateInterModuleDependencyGraph = driver.interModuleDependencyGraph
7373
self.protectedState = ProtectedState(
74-
skippedCompileGroups: firstWave.initiallySkippedCompileGroups,
74+
skippedCompileJobs: firstWave.initiallySkippedCompileJobs,
7575
initialState.graph,
7676
jobsInPhases.allJobs.first(where: {$0.kind == .generatePCH}),
7777
&driver)

Sources/SwiftDriver/Jobs/BackendJob.swift

Lines changed: 0 additions & 81 deletions
This file was deleted.

Sources/SwiftDriver/Jobs/DarwinToolchain+LinkerSupport.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,7 @@ extension DarwinToolchain {
214214
}
215215
}
216216

217-
if parsedOptions.contains(.embedBitcode) {
218-
commandLine.appendFlag("-fembed-bitcode")
219-
} else if parsedOptions.contains(.embedBitcodeMarker) {
217+
if parsedOptions.contains(.embedBitcodeMarker) {
220218
commandLine.appendFlag("-fembed-bitcode=marker")
221219
}
222220

0 commit comments

Comments
 (0)