Skip to content

Commit c1411c7

Browse files
committed
Add some codegen related terminology to glossary
1 parent 6e1eccd commit c1411c7

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/glossary.md

+12-5
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,19 @@ completeness | completeness is a technical term in type theory. Comp
1111
cx | we tend to use "cx" as an abbrevation for context. See also `tcx`, `infcx`, etc.
1212
DAG | a directed acyclic graph is used during compilation to keep track of dependencies between queries. ([see more](incremental-compilation.html))
1313
DefId | an index identifying a definition (see `librustc/hir/def_id.rs`). Uniquely identifies a `DefPath`.
14-
HIR | the High-level IR, created by lowering and desugaring the AST ([see more](hir.html))
15-
HirId | identifies a particular node in the HIR by combining a def-id with an "intra-definition offset".
1614
'gcx | the lifetime of the global arena ([see more](ty.html))
1715
generics | the set of generic type parameters defined on a type or item
16+
HIR | the High-level IR, created by lowering and desugaring the AST ([see more](hir.html))
17+
HirId | identifies a particular node in the HIR by combining a def-id with an "intra-definition offset".
1818
ICE | internal compiler error. When the compiler crashes.
1919
ICH | incremental compilation hash. ICHs are used as fingerprints for things such as HIR and crate metadata, to check if changes have been made. This is useful in incremental compilation to see if part of a crate has changed and should be recompiled.
2020
infcx | the inference context (see `librustc/infer`)
21-
MIR | the Mid-level IR that is created after type-checking for use by borrowck and trans ([see more](./mir.html))
22-
miri | an interpreter for MIR used for constant evaluation ([see more](./miri.html))
23-
obligation | something that must be proven by the trait system ([see more](trait-resolution.html))
21+
IR | Intermediate Representation. A general term in compilers. During compilation, the code is transformed from raw source (ASCII text) to various IRs. In Rust, these are primarily HIR, MIR, and LLVM IR. Each IR is well-suited for some set of computations. For example, MIR is well-suited for the borrow checker, and LLVM IR is well-suited for codegen because LLVM accepts it.
2422
local crate | the crate currently being compiled.
23+
LTO | Link-Time Optimizations. A set of optimizations offered by LLVM that occur just before the final binary is linked. These include optmizations like removing functions that are never used in the final program, for example. _ThinLTO_ is a variant of LTO that aims to be a bit more scalable and efficient, but possibly sacrifices some optimizations. You may also read issues in the Rust repo about "FatLTO", which is the loving nickname given to non-Thin LTO. LLVM documentation: [here][lto] and [here][thinlto]
24+
[LLVM] | (actually not an acronym :P) an open-source compiler backend. It accepts LLVM IR and outputs native binaries. Various languages (e.g. Rust) can then implement a compiler front-end that output LLVM IR and use LLVM to compile to all the platforms LLVM supports.
2525
MIR | the Mid-level IR that is created after type-checking for use by borrowck and trans ([see more](./mir.html))
26+
miri | an interpreter for MIR used for constant evaluation ([see more](./miri.html))
2627
node-id or NodeId | an index identifying a particular node in the AST or HIR; gradually being phased out and replaced with `HirId`.
2728
obligation | something that must be proven by the trait system ([see more](trait-resolution.html))
2829
provider | the function that executes a query ([see more](query.html))
@@ -34,6 +35,12 @@ span | a location in the user's source code, used for error
3435
substs | the substitutions for a given generic type or item (e.g. the `i32`, `u32` in `HashMap<i32, u32>`)
3536
tcx | the "typing context", main data structure of the compiler ([see more](ty.html))
3637
'tcx | the lifetime of the currently active inference context ([see more](ty.html))
38+
[TLS] | Thread-Local Storage. Variables may be defined so that each thread has its own copy (rather than all threads sharing the variable). This has some interactions with LLVM. Not all platforms support TLS.
3739
trans | the code to translate MIR into LLVM IR.
3840
trait reference | a trait and values for its type parameters ([see more](ty.html)).
3941
ty | the internal representation of a type ([see more](ty.html)).
42+
43+
[LLVM]: https://llvm.org/
44+
[lto]: https://llvm.org/docs/LinkTimeOptimization.html
45+
[thinlto]: https://clang.llvm.org/docs/ThinLTO.html
46+
[TLS]: https://llvm.org/docs/LangRef.html#thread-local-storage-models

0 commit comments

Comments
 (0)