@@ -15,7 +15,6 @@ So first, let's look at what the compiler does to your code. For now, we will
15
15
avoid mentioning how the compiler implements these steps except as needed;
16
16
we'll talk about that later.
17
17
18
- ** TODO: Would be great to have a diagram of this once we nail down the details...**
19
18
20
19
- The compile process begins when a user writes a Rust source program in text
21
20
and invokes the ` rustc ` compiler on it. The work that the compiler needs to
@@ -74,10 +73,9 @@ we'll talk about that later.
74
73
HAIR is used for pattern and exhaustiveness checking. It is also more
75
74
convenient to convert into MIR than HIR is.
76
75
- The MIR is used for [ borrow checking] .
77
- - ** TODO: const eval fits in somewhere here I think**
78
76
- We (want to) do [ many optimizations on the MIR] [ mir-opt ] because it is still
79
77
generic and that improves the code we generate later, improving compilation
80
- speed too. ( ** TODO: size optimizations too? ** )
78
+ speed too.
81
79
- MIR is a higher level (and generic) representation, so it is easier to do
82
80
some optimizations at MIR level than at LLVM-IR level. For example LLVM
83
81
doesn't seem to be able to optimize the pattern the [ ` simplify_try ` ] mir
@@ -96,9 +94,8 @@ we'll talk about that later.
96
94
- The LLVM IR is passed to LLVM, which does a lot more optimizations on it.
97
95
It then emits machine code. It is basically assembly code with additional
98
96
low-level types and annotations added. (e.g. an ELF object or wasm).
99
- ** TODO: reference for this section?**
100
97
- The different libraries/binaries are linked together to produce the final
101
- binary. ** TODO: reference for this section? **
98
+ binary.
102
99
103
100
[ `librustc_lexer` ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lexer/index.html
104
101
[ `librustc_driver` ] : https://rustc-dev-guide.rust-lang.org/rustc-driver.html
@@ -138,13 +135,13 @@ satisfy/optimize for. For example,
138
135
point.
139
136
- Compiler compilation speed: how long does it take to compile the compiler?
140
137
This impacts contributors and compiler maintenance.
141
- - Compiler implementation complexity: building a compiler is one of the hardest
138
+ - Implementation complexity: building a compiler is one of the hardest
142
139
things a person/group can do, and Rust is not a very simple language, so how
143
140
do we make the compiler's code base manageable?
144
141
- Compiler correctness: the binaries produced by the compiler should do what
145
142
the input programs says they do, and should continue to do so despite the
146
143
tremendous amount of change constantly going on.
147
- - Compiler integration : a number of other tools need to use the compiler in
144
+ - Integration : a number of other tools need to use the compiler in
148
145
various ways (e.g. cargo, clippy, miri, RLS) that must be supported.
149
146
- Compiler stability: the compiler should not crash or fail ungracefully on the
150
147
stable channel.
@@ -283,7 +280,7 @@ program) is [`rustc::ty::Ty`][ty]. This is so important that we have a whole cha
283
280
on [ ` ty::Ty ` ] [ ty ] , but for now, we just want to mention that it exists and is the way
284
281
` rustc ` represents types!
285
282
286
- Oh, and also the ` rustc::ty ` module defines the ` TyCtxt ` struct we mentioned before.
283
+ Also note that the ` rustc::ty ` module defines the ` TyCtxt ` struct we mentioned before.
287
284
288
285
[ ty ] : https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/type.Ty.html
289
286
@@ -332,7 +329,6 @@ bootstrapping compiler will support them.
332
329
333
330
# Unresolved Questions
334
331
335
- ** TODO: find answers to these**
336
332
337
333
- Does LLVM ever do optimizations in debug builds?
338
334
- How do I explore phases of the compile process in my own sources (lexer,
0 commit comments