summaryrefslogtreecommitdiffstats
path: root/src/doc/rustc-dev-guide/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc/rustc-dev-guide/src/backend')
-rw-r--r--src/doc/rustc-dev-guide/src/backend/backend-agnostic.md23
-rw-r--r--src/doc/rustc-dev-guide/src/backend/monomorph.md2
-rw-r--r--src/doc/rustc-dev-guide/src/backend/updating-llvm.md17
3 files changed, 25 insertions, 17 deletions
diff --git a/src/doc/rustc-dev-guide/src/backend/backend-agnostic.md b/src/doc/rustc-dev-guide/src/backend/backend-agnostic.md
index ea50cd754..c5eb57e64 100644
--- a/src/doc/rustc-dev-guide/src/backend/backend-agnostic.md
+++ b/src/doc/rustc-dev-guide/src/backend/backend-agnostic.md
@@ -2,16 +2,21 @@
<!-- toc -->
-As of <!-- date-check --> Aug 2022, `rustc_codegen_ssa` provides an
-abstract interface for all backends to implement, to allow other codegen
-backends (e.g. [Cranelift]).
+[`rustc_codegen_ssa`]
+provides an abstract interface for all backends to implement,
+namely LLVM, [Cranelift], and [GCC].
-[Cranelift]: https://github.com/bytecodealliance/wasmtime/tree/HEAD/cranelift
+[Cranelift]: https://github.com/bjorn3/rustc_codegen_cranelift
+[GCC]: https://github.com/rust-lang/rustc_codegen_gcc
+[`rustc_codegen_ssa`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/index.html
-# Refactoring of `rustc_codegen_llvm`
+Below is some background information on the refactoring that created this
+abstract interface.
+
+## Refactoring of `rustc_codegen_llvm`
by Denis Merigoux, October 23rd 2018
-## State of the code before the refactoring
+### State of the code before the refactoring
All the code related to the compilation of MIR into LLVM IR was contained
inside the `rustc_codegen_llvm` crate. Here is the breakdown of the most
@@ -51,7 +56,7 @@ While the LLVM-specific code will be left in `rustc_codegen_llvm`, all the new
traits and backend-agnostic code will be moved in `rustc_codegen_ssa` (name
suggestion by @eddyb).
-## Generic types and structures
+### Generic types and structures
@irinagpopa started to parametrize the types of `rustc_codegen_llvm` by a
generic `Value` type, implemented in LLVM by a reference `&'ll Value`. This
@@ -103,7 +108,7 @@ of the backend and it makes more sense to leave their definition to the backend
implementor than to allow just a narrow spot via a generic field for the
backend's context.
-## Traits and interface
+### Traits and interface
Because they have to be defined by the backend, `CodegenCx` and `Builder` will
be the structures implementing all the traits defining the backend's interface.
@@ -170,7 +175,7 @@ called. However, when implementing a Rust backend for `rustc`, these methods
will need information from `CodegenCx`, hence the additional parameter (unused
in the LLVM implementation of the trait).
-## State of the code after the refactoring
+### State of the code after the refactoring
The traits offer an API which is very similar to the API of LLVM. This is not
the best solution since LLVM has a very special way of doing things: when
diff --git a/src/doc/rustc-dev-guide/src/backend/monomorph.md b/src/doc/rustc-dev-guide/src/backend/monomorph.md
index 4a0b55f62..cbc56acfc 100644
--- a/src/doc/rustc-dev-guide/src/backend/monomorph.md
+++ b/src/doc/rustc-dev-guide/src/backend/monomorph.md
@@ -133,7 +133,7 @@ the substitutions with the identity parameter before being added to the set
of collected items - thereby reducing the copies from two (`[u16, u32]` and
`[u64, u32]`) to one (`[A, u32]`).
-`unused_generic_params` will also invoked during code generation when the
+`unused_generic_params` will also be invoked during code generation when the
symbol name for `foo` is being computed for use in the callsites of `foo`
(which have the regular substitutions present, otherwise there would be a
symbol mismatch between the caller and the function).
diff --git a/src/doc/rustc-dev-guide/src/backend/updating-llvm.md b/src/doc/rustc-dev-guide/src/backend/updating-llvm.md
index 38fbb2e44..a02011149 100644
--- a/src/doc/rustc-dev-guide/src/backend/updating-llvm.md
+++ b/src/doc/rustc-dev-guide/src/backend/updating-llvm.md
@@ -2,7 +2,7 @@
<!-- toc -->
-<!-- date-check: Aug 2022 -->
+<!-- date-check: Feb 2023 -->
There is no formal policy about when to update LLVM or what it can be updated to,
but a few guidelines are applied:
@@ -16,9 +16,9 @@ but a few guidelines are applied:
There are two reasons we would want to update LLVM:
-* A bug could have been fixed! Often we find bugs in the compiler and fix
- them upstream in LLVM. We'll want to pull fixes back to the compiler itself as
- they're merged upstream.
+* A bug could have been fixed!
+ Note that if we are the ones who fixed such a bug,
+ we prefer to upstream it, then pull it back for use by rustc.
* LLVM itself may have a new release.
@@ -172,9 +172,11 @@ so let's go through each in detail.
Ideally the above instructions are pretty smooth, but here's some caveats to
keep in mind while going through them:
-* LLVM bugs are hard to find, don't hesitate to ask for help! Bisection is
- definitely your friend here (yes LLVM takes forever to build, yet bisection is
- still your friend)
+* LLVM bugs are hard to find, don't hesitate to ask for help!
+ Bisection is definitely your friend here
+ (yes LLVM takes forever to build, yet bisection is still your friend).
+ Note that you can make use of [Dev Desktops],
+ which is an initiative to provide the contributors with remote access to powerful hardware.
* If you've got general questions, [wg-llvm] can help you out.
* Creating branches is a privileged operation on GitHub, so you'll need someone
with write access to create the branches for you most likely.
@@ -184,3 +186,4 @@ keep in mind while going through them:
[llvm/llvm-project repository]: https://github.com/llvm/llvm-project
[`llvm-wrapper`]: https://github.com/rust-lang/rust/tree/master/compiler/rustc_llvm/llvm-wrapper
[wg-llvm]: https://rust-lang.zulipchat.com/#narrow/stream/187780-t-compiler.2Fwg-llvm
+[Dev Desktops]: https://forge.rust-lang.org/infra/docs/dev-desktop.html