Skip to content

Commit efa66db

Browse files
committed
Explain what the rest of the backend agnostic page is about
1 parent 91d8bbe commit efa66db

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/backend/backend-agnostic.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@ namely LLVM, [Cranelift], and [GCC].
1010
[GCC]: https://github.com/rust-lang/rustc_codegen_gcc
1111
[`rustc_codegen_ssa`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/index.html
1212

13-
# Refactoring of `rustc_codegen_llvm`
13+
Below is some background information on the refactoring that created this
14+
abstract interface.
15+
16+
## Refactoring of `rustc_codegen_llvm`
1417
by Denis Merigoux, October 23rd 2018
1518

16-
## State of the code before the refactoring
19+
### State of the code before the refactoring
1720

1821
All the code related to the compilation of MIR into LLVM IR was contained
1922
inside the `rustc_codegen_llvm` crate. Here is the breakdown of the most
@@ -53,7 +56,7 @@ While the LLVM-specific code will be left in `rustc_codegen_llvm`, all the new
5356
traits and backend-agnostic code will be moved in `rustc_codegen_ssa` (name
5457
suggestion by @eddyb).
5558

56-
## Generic types and structures
59+
### Generic types and structures
5760

5861
@irinagpopa started to parametrize the types of `rustc_codegen_llvm` by a
5962
generic `Value` type, implemented in LLVM by a reference `&'ll Value`. This
@@ -105,7 +108,7 @@ of the backend and it makes more sense to leave their definition to the backend
105108
implementor than to allow just a narrow spot via a generic field for the
106109
backend's context.
107110

108-
## Traits and interface
111+
### Traits and interface
109112

110113
Because they have to be defined by the backend, `CodegenCx` and `Builder` will
111114
be the structures implementing all the traits defining the backend's interface.
@@ -172,7 +175,7 @@ called. However, when implementing a Rust backend for `rustc`, these methods
172175
will need information from `CodegenCx`, hence the additional parameter (unused
173176
in the LLVM implementation of the trait).
174177

175-
## State of the code after the refactoring
178+
### State of the code after the refactoring
176179

177180
The traits offer an API which is very similar to the API of LLVM. This is not
178181
the best solution since LLVM has a very special way of doing things: when

0 commit comments

Comments
 (0)