Skip to content

Commit a40b37a

Browse files
committed
LLVM Backend: Lay the groundwork for compiling intrinsics
by building a basic runtime system.
1 parent a833ce4 commit a40b37a

File tree

17 files changed

+424
-219
lines changed

17 files changed

+424
-219
lines changed

.cargo/config.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
rustflags = [
33
"-Drust_2018_idioms",
44
"-Dunused_must_use",
5+
"-Dimproper_ctypes_definitions",
56
"-Dunused_crate_dependencies",
67
"-Dclippy::all",
78
"-Dclippy::pedantic",

Cargo.lock

+10-34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cargo-features = ["profile-rustflags"]
22

33
[workspace]
4-
members = ["compiler/*", "test/ui/framework"]
4+
members = ["compiler/*", "library/core/source/boot", "test/ui/framework"]
55
default-members = ["compiler/main"]

README.adoc

+28-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,34 @@ for the language server to work.
8585
For Lushui Metadata support, copy or symlink the folder `./project/editor/vscode/fmease.lushui-metadata-syntax-0.0.1`
8686
to `~/.vscode/extensions/`.
8787

88-
== Generated API Documentation
88+
== Compiling With LLVM (Experimental)
89+
90+
The LLVM backend is currently in the earliest of stages.
91+
You can only compile super simple programs.
92+
93+
First, compile the runtime system called `boot` (part of `core`).
94+
This step only needs to be done once (unless you want to modify the system).
95+
96+
[source,sh]
97+
----
98+
cargo build --release --package boot
99+
----
100+
101+
This should create the file `/target/release/libboot.a` necessary for compiling intrinsic functions.
102+
103+
Make sure that you have built / you are executing the compiler with the Cargo feature `llvm` enabled.
104+
Set the backend to `llvm` via the `--backend` option.
105+
106+
=== Example Invocation
107+
108+
[source,sh]
109+
----
110+
./lushui +llvm file build input.lushui -Zinternals --no-core --backend=llvm -Zverify-llvm-ir
111+
----
112+
113+
This should create an executable called `input`.
114+
115+
== Generating API Documentation
89116

90117
As hinted in the help text (`./lushui -h`), you use `./lushui doc` (and variations) to generate (HTML) documentation.
91118
To view it, just pass `--open`.

compiler/codegen_llvm/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ utilities = { path = "../utilities" }
1616

1717
[dependencies.inkwell]
1818
git = "https://github.com/TheDan64/inkwell"
19-
rev = "25b9fc5"
20-
features = ["llvm13-0"]
19+
rev = "4b67a7f"
20+
features = ["llvm14-0"]

0 commit comments

Comments
 (0)