Skip to content

Commit 02e1fd4

Browse files
Rollup merge of rust-lang#81618 - bjorn3:sync_cg_clif-2021-02-01, r=bjorn3
Sync rustc_codegen_cranelift The highlight of this sync are abi compatibility with cg_llvm allowing mixing of cg_clif and cg_llvm compiled crates and switching to the x64 cranelift backend based on the new backend framework. r? ``@ghost`` ``@rustbot`` label +A-codegen +A-cranelift +T-compiler
2 parents 2b8f2ac + a75f9bc commit 02e1fd4

39 files changed

+993
-718
lines changed

.github/workflows/main.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
os: [ubuntu-latest, macos-latest]
15+
env:
16+
- BACKEND: ""
17+
- BACKEND: --oldbe
1518

1619
steps:
1720
- uses: actions/checkout@v2
@@ -51,7 +54,7 @@ jobs:
5154
export COMPILE_RUNS=2
5255
export RUN_RUNS=2
5356
54-
./test.sh
57+
./test.sh $BACKEND
5558
5659
- name: Package prebuilt cg_clif
5760
run: tar cvfJ cg_clif.tar.xz build

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ perf.data.old
88
*.string*
99
/build
1010
/build_sysroot/sysroot_src
11+
/build_sysroot/compiler-builtins
1112
/rust
1213
/rand
1314
/regex

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
// source for rustc_* is not included in the rust-src component; disable the errors about this
33
"rust-analyzer.diagnostics.disabled": ["unresolved-extern-crate"],
4-
"rust-analyzer.assist.importMergeBehaviour": "last",
4+
"rust-analyzer.assist.importMergeBehavior": "last",
55
"rust-analyzer.cargo.loadOutDirsFromCheck": true,
66
"rust-analyzer.linkedProjects": [
77
"./Cargo.toml",

Cargo.lock

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

Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ crate-type = ["dylib"]
99

1010
[dependencies]
1111
# These have to be in sync with each other
12-
cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", features = ["unwind"] }
12+
cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", features = ["unwind", "x86", "x64"] }
1313
cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
1414
cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main" }
1515
cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime/", branch = "main", optional = true }
@@ -21,6 +21,7 @@ object = { version = "0.22.0", default-features = false, features = ["std", "rea
2121
ar = { git = "https://github.com/bjorn3/rust-ar.git", branch = "do_not_remove_cg_clif_ranlib" }
2222
indexmap = "1.0.2"
2323
libloading = { version = "0.6.0", optional = true }
24+
smallvec = "1.6.1"
2425

2526
# Uncomment to use local checkout of cranelift
2627
#[patch."https://github.com/bytecodealliance/wasmtime/"]
@@ -37,6 +38,7 @@ libloading = { version = "0.6.0", optional = true }
3738
default = ["jit", "inline_asm"]
3839
jit = ["cranelift-jit", "libloading"]
3940
inline_asm = []
41+
oldbe = []
4042

4143
[profile.dev]
4244
# By compiling dependencies with optimizations, performing tests gets much faster.

Readme.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# WIP Cranelift codegen backend for rust
2-
3-
> ⚠⚠⚠ Certain kinds of FFI don't work yet. ⚠⚠⚠
1+
# Cranelift codegen backend for rust
42

53
The goal of this project is to create an alternative codegen backend for the rust compiler based on [Cranelift](https://github.com/bytecodealliance/wasmtime/blob/main/cranelift).
64
This has the potential to improve compilation times in debug mode.
@@ -103,8 +101,7 @@ function jit_calc() {
103101

104102
## Not yet supported
105103

106-
* Good non-rust abi support ([several problems](https://github.com/bjorn3/rustc_codegen_cranelift/issues/10))
107-
* Inline assembly ([no cranelift support](https://github.com/bytecodealliance/wasmtime/issues/1041)
104+
* Inline assembly ([no cranelift support](https://github.com/bytecodealliance/wasmtime/issues/1041))
108105
* On Linux there is support for invoking an external assembler for `global_asm!` and `asm!`.
109106
`llvm_asm!` will remain unimplemented forever. `asm!` doesn't yet support reg classes. You
110107
have to specify specific registers instead.

0 commit comments

Comments
 (0)