You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/bgen.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,11 @@ The architecture of the B compiler attempts to loosely decouple the front end (t
4
4
5
5
When it comes to the back end there are two main terms to consider:
6
6
1.**Target** is whatever you select using the `-t` flag of both `b` and `btest` programs. To get the list of all available targets use flag `-tlist` on any of them.
7
-
2.**Codegen** is a collection of Targets implemented as a submodule of the `codegen` module. All codegens are located in the `<root>/src/codegen/` folder.
7
+
2.**Codegen** is a collection of Targets implemented as a submodule of the `codegen` module. All codegens are located in the [`<root>/src/codegen/`](../src/codegen) folder.
8
8
9
-
The reason it is organized like that is because some targets share a lot of code with each other. Especially when they are implemented for the same CPU architecture. For example targets `gas-x86_64-linux`, `gas-x86_64-windows`, and `gas-x86_64-darwin` are part of a single codegen `gas_x86_64` and differ only in how they pass arguments to function calls according their platform ABIs.
9
+
The reason it is organized like that is because some targets share a lot of code with each other. Especially when they are implemented for the same CPU architecture. For example targets `gas-x86_64-linux`, `gas-x86_64-windows`, and `gas-x86_64-darwin` are part of a single codegen [gas_x86_64](../src/codegen/gas_x86_64) and differ only in how they pass arguments to function calls according their platform ABIs.
10
10
11
-
Any valid Rust module under `<root>/src/codegen/` folder is automatically picked up by the build system and plugged as an additional codegen. For an example of a "pluggable" codegen see [https://github.com/bext-lang/dotnet_mono](https://github.com/bext-lang/dotnet_mono). The way you plug it in is
11
+
Any valid Rust module under [`<root>/src/codegen/](../src/codegen/)` folder is automatically picked up by the build system and plugged as an additional codegen. For an example of a "pluggable" codegen see [https://github.com/bext-lang/dotnet_mono](https://github.com/bext-lang/dotnet_mono). The way you plug it in is
For an example of a minimal pluggable codegen see `<root>/src/codegen/noop.rs`.
22
+
For an example of a minimal pluggable codegen see [`<root>/src/codegen/noop.rs`](../src/codegen/noop.rs).
23
23
24
24
## The Pluggable Codegen Format™
25
25
26
-
A pluggable codegen is a usually a valid [git repo](https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository) and a valid [Rust module](https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html) simultaneously. This is what enables just `git clone`-ing it into `<root>/src/codegen`.
26
+
A pluggable codegen is usually a valid [git repo](https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository) and a valid [Rust module](https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html) simultaneously. This is what enables just `git clone`-ing it into [`<root>/src/codegen`](../src/codegen/).
27
27
28
-
On top of being a Rust module the Codegen is allowed to have additional special folders and files.
28
+
On top of being a Rust module the Codegen is allowed to have additional special folders and files:
29
29
30
-
-`<codegen_root>/libb/*` - a collection of libb implementation for all the targets codegen provides. All such folders for all codegens are automatically detected by the build system and aggregated into `<root>/build/libb/*` so all of them are available to the B compiler.
30
+
-`<codegen_root>/libb/*` - a collection of libb implementations for all the targets codegen provides. All such folders for all codegens are automatically detected by the build system and aggregated into `<root>/build/libb/*` so all of them are available to the `<root>/build/b` compiler.
0 commit comments