Skip to content

Commit d2c3a78

Browse files
committed
[Gardening] De-RST DriverInternals
1 parent fa69229 commit d2c3a78

File tree

4 files changed

+22
-38
lines changed

4 files changed

+22
-38
lines changed

docs/CompilerPerformance.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ The set of jobs that are run, and the way they spend their time, is itself
8383
highly dependent on **compilation modes**. Information concerning those modes
8484
that's relevant to compilation performance is recounted in the following
8585
section; for more details on the driver, see [the driver docs](Driver.md), as
86-
well as docs on [driver internals](DriverInternals.rst)
86+
well as docs on [driver internals](DriverInternals.md)
8787
and [driver parseable output](DriverParseableOutput.rst).
8888

8989
After discussing compilation modes in the following section, we'll also touch on

docs/Driver.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The target audience for this document is people who want to integrate the Swift
1414
compiler into their build system, rather than using Xcode or the package
1515
manager (`swift build`). If you're looking to work on the driver itself...well,
1616
this is probably still useful to you, but you should also check out
17-
[DriverInternals.rst](DriverInternals.rst) and maybe
17+
[DriverInternals.md](DriverInternals.md) and maybe
1818
[DependencyAnalysis.md](DependencyAnalysis.md) as well. If you're just using
1919
Xcode or SwiftPM and want to find out what mysterious command-line options you
2020
could be passing, `swiftc --help` is a better choice.

docs/DriverInternals.rst renamed to docs/DriverInternals.md

+20-35
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
=========================
21
Driver Design & Internals
32
=========================
43

5-
.. contents::
6-
:local:
7-
84
Introduction
95
============
106

@@ -24,23 +20,22 @@ Driver Stages
2420
The compiler driver for Swift roughly follows the same design as Clang's
2521
compiler driver:
2622

27-
1. Parse: Command-line arguments are parsed into ``Arg``\ s. A ToolChain is
23+
1. Parse: Command-line arguments are parsed into `Arg`s. A ToolChain is
2824
selected based on the current platform.
29-
2. Pipeline: Based on the arguments and inputs, a tree of ``Action``\ s is
25+
2. Pipeline: Based on the arguments and inputs, a tree of `Action`s is
3026
generated. These are the high-level processing steps that need to occur,
3127
such as "compile this file" or "link the output of all compilation actions".
32-
3. Bind: The ToolChain converts the ``Action``\ s into a set of ``Job``\ s.
28+
3. Bind: The ToolChain converts the `Action`s into a set of `Job`s.
3329
These are individual commands that need to be run, such as
3430
"ld main.o -o main". Jobs have dependencies, but are not organized into a
3531
tree structure.
36-
4. Execute: The ``Job``\ s are run in a ``Compilation``, which spawns off
37-
sub-processes for each job that needs execution. The ``Compilation`` is
38-
responsible for deciding which ``Job``\ s actually need to run, based on
32+
4. Execute: The `Job`s are run in a `Compilation`, which spawns off
33+
sub-processes for each job that needs execution. The `Compilation` is
34+
responsible for deciding which `Job`s actually need to run, based on
3935
dependency information provided by the output of each sub-process. The
40-
low-level management of sub-processes is handled by a ``TaskQueue``.
36+
low-level management of sub-processes is handled by a `TaskQueue`.
4137

42-
Parse: Option parsing
43-
^^^^^^^^^^^^^^^^^^^^^
38+
## Parse: Option parsing
4439

4540
The command line arguments are parsed as options and inputs into Arg instances.
4641
Some miscellaneous validation and normalization is performed. Most of the
@@ -56,29 +51,22 @@ files. The output file map uses a simple JSON format mapping inputs to a map of
5651
output paths, keyed by file type. Entries under an input of "" refer to the
5752
top-level driver process.
5853

59-
.. admonition:: FIXME
60-
61-
Certain capabilities, like incremental builds or compilation without
62-
linking, currently require an output file map. This should not be necessary.
54+
> Certain capabilities, like incremental builds or compilation without
55+
> linking, currently require an output file map. This should not be necessary.
6356
6457

65-
Pipeline: Converting Args into Actions
66-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
58+
## Pipeline: Converting Args into Actions
6759

6860
At this stage, the driver will take the input Args and input files and
6961
establish a graph of Actions. This details the high-level tasks that need to be
7062
performed. The graph (a DAG) tracks dependencies between actions, but also
7163
manages ownership.
7264

73-
.. admonition:: FIXME
74-
75-
Actions currently map one-to-one to sub-process invocations. This means
76-
that there are actions for things that should be implementation details,
77-
like generating dSYM output.
78-
65+
> Actions currently map one-to-one to sub-process invocations. This means
66+
> that there are actions for things that should be implementation details,
67+
> like generating dSYM output.
7968
80-
Build: Translating Actions into Jobs using a ToolChain
81-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
69+
## Build: Translating Actions into Jobs using a ToolChain
8270

8371
Once we have a graph of high-level Actions, we need to translate that into
8472
actual tasks to execute. This starts by determining the output that each Action
@@ -94,8 +82,7 @@ in the current build. This is covered by checking if the input has been
9482
modified since the last build; if it hasn't, we only need to recompile if
9583
something it depends on has changed.
9684

97-
Schedule: Ordering and skipping jobs by dependency analysis
98-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
85+
## Schedule: Ordering and skipping jobs by dependency analysis
9986

10087
A Compilation's goal is to make sure every Job in its list of Jobs is handled.
10188
If a Job needs to be run, the Compilation attempts to *schedule* it. If the
@@ -107,11 +94,10 @@ be run, the Compilation keeps track of a DependencyGraph. (If file A depends on
10794
file B and file B has changed, file A needs to be recompiled.) When a Job
10895
completes successfully, the Compilation will both re-attempt to schedule Jobs
10996
that were directly blocked on it, and check to see if any other Jobs now need
110-
to run based on the DependencyGraph. See the section on :doc:`DependencyAnalysis`
111-
for more information.
97+
to run based on the DependencyGraph. See the section on
98+
[DependencyAnalysis](DependencyAnalysis.md) for more information.
11299

113-
Batch: Optionally combine similar jobs
114-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
100+
## Batch: Optionally combine similar jobs
115101

116102
The Driver has an experimental "batch mode" that examines the set of scheduled
117103
jobs just prior to execution, looking for jobs that are identical to one another
@@ -123,8 +109,7 @@ that run (and thus do potentially redundant work).
123109
Once any batching has taken place, the set of scheduled jobs (batched or
124110
otherwise) is transferred to the TaskQueue for execution.
125111

126-
Execute: Running the Jobs in a Compilation using a TaskQueue
127-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
112+
## Execute: Running the Jobs in a Compilation using a TaskQueue
128113

129114
The Compilation's TaskQueue controls the low-level aspects of managing
130115
subprocesses. Multiple Jobs may execute simultaneously, but communication with

docs/contents.rst

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Contents
88

99
IndexInvalidation
1010
AccessControl
11-
DriverInternals
1211
DriverParseableOutput
1312
ErrorHandling
1413
ErrorHandlingRationale

0 commit comments

Comments
 (0)