Skip to content

Commit

Permalink
LLVM Backend: Lay the groundwork for compiling intrinsics
Browse files Browse the repository at this point in the history
by building a basic runtime system.
  • Loading branch information
fmease committed Sep 22, 2022
1 parent a833ce4 commit 6a3b799
Show file tree
Hide file tree
Showing 17 changed files with 426 additions and 219 deletions.
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
rustflags = [
"-Drust_2018_idioms",
"-Dunused_must_use",
"-Dimproper_ctypes_definitions",
"-Dunused_crate_dependencies",
"-Dclippy::all",
"-Dclippy::pedantic",
Expand Down
44 changes: 10 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cargo-features = ["profile-rustflags"]

[workspace]
members = ["compiler/*", "test/ui/framework"]
members = ["compiler/*", "library/core/source/boot", "test/ui/framework"]
default-members = ["compiler/main"]
29 changes: 28 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,34 @@ for the language server to work.
For Lushui Metadata support, copy or symlink the folder `./project/editor/vscode/fmease.lushui-metadata-syntax-0.0.1`
to `~/.vscode/extensions/`.

== Generated API Documentation
== Compiling With LLVM (Experimental)

The LLVM backend is currently in the earliest of stages.
You can only compile super simple programs.

First, compile the runtime system called `boot` (part of `core`).
This step only needs to be done once (unless you want to modify the system).

[source,sh]
----
cargo build --release --package boot
----

This should create the file `/target/release/libboot.a` necessary for compiling intrinsic functions.

Make sure that you have built / you are executing the compiler with the Cargo feature `llvm` enabled.
Set the backend to `llvm` via the `--backend` option.

=== Example Invocation

[source,sh]
----
./lushui +llvm file build input.lushui -Zinternals --no-core --backend=llvm -Zverify-llvm-ir
----

This should create an executable called `input`.

== Generating API Documentation

As hinted in the help text (`./lushui -h`), you use `./lushui doc` (and variations) to generate (HTML) documentation.
To view it, just pass `--open`.
Expand Down
4 changes: 2 additions & 2 deletions compiler/codegen_llvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ utilities = { path = "../utilities" }

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

0 comments on commit 6a3b799

Please sign in to comment.