Skip to content

Commit 35debd4

Browse files
committed
Auto merge of #77975 - bjorn3:cg_clif_subtree3, r=Mark-Simulacrum
Add cg_clif as optional codegen backend Rustc_codegen_cranelift is an alternative codegen backend for rustc based on Cranelift. It has the potential to improve compilation times in debug mode. In my experience the compile time improvements over debug mode LLVM for a clean build are about 20-30% in most cases. This PR adds cg_clif as optional codegen backend. By default it is only enabled for `./x.py check`. It can be enabled for `./x.py build` too by adding `cranelift` to the `rust.codegen-backends` array in `config.toml`. MCP: rust-lang/compiler-team#270 r? `@Mark-Simulacrum`
2 parents c96e11c + ac4f7de commit 35debd4

File tree

98 files changed

+17049
-39
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+17049
-39
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ members = [
3131
]
3232
exclude = [
3333
"build",
34+
"compiler/rustc_codegen_cranelift",
3435
# HACK(eddyb) This hardcodes the fact that our CI uses `/checkout/obj`.
3536
"obj",
3637
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: CI
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
build:
9+
runs-on: ${{ matrix.os }}
10+
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: [ubuntu-latest, macos-latest]
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- name: Cache cargo installed crates
20+
uses: actions/cache@v2
21+
with:
22+
path: ~/.cargo/bin
23+
key: ${{ runner.os }}-cargo-installed-crates
24+
25+
- name: Cache cargo registry and index
26+
uses: actions/cache@v2
27+
with:
28+
path: |
29+
~/.cargo/registry
30+
~/.cargo/git
31+
key: ${{ runner.os }}-cargo-registry-and-index-${{ hashFiles('**/Cargo.lock') }}
32+
33+
- name: Cache cargo target dir
34+
uses: actions/cache@v2
35+
with:
36+
path: target
37+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
38+
39+
- name: Prepare dependencies
40+
run: |
41+
git config --global user.email "[email protected]"
42+
git config --global user.name "User"
43+
./prepare.sh
44+
45+
- name: Test
46+
run: |
47+
# Enable backtraces for easier debugging
48+
export RUST_BACKTRACE=1
49+
50+
# Reduce amount of benchmark runs as they are slow
51+
export COMPILE_RUNS=2
52+
export RUN_RUNS=2
53+
54+
./test.sh --release
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
target
2+
**/*.rs.bk
3+
*.rlib
4+
*.o
5+
perf.data
6+
perf.data.old
7+
*.events
8+
*.string*
9+
/build_sysroot/sysroot
10+
/build_sysroot/sysroot_src
11+
/rust
12+
/rand
13+
/regex
14+
/simple-raytracer
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
// source for rustc_* is not included in the rust-src component; disable the errors about this
3+
"rust-analyzer.diagnostics.disabled": ["unresolved-extern-crate"],
4+
"rust-analyzer.cargo.loadOutDirsFromCheck": true,
5+
"rust-analyzer.linkedProjects": [
6+
"./Cargo.toml",
7+
//"./build_sysroot/sysroot_src/src/libstd/Cargo.toml",
8+
{
9+
"roots": [
10+
"./example/mini_core.rs",
11+
"./example/mini_core_hello_world.rs",
12+
"./example/mod_bench.rs"
13+
],
14+
"crates": [
15+
{
16+
"root_module": "./example/mini_core.rs",
17+
"edition": "2018",
18+
"deps": [],
19+
"cfg": [],
20+
},
21+
{
22+
"root_module": "./example/mini_core_hello_world.rs",
23+
"edition": "2018",
24+
"deps": [{ "crate": 0, "name": "mini_core" }],
25+
"cfg": [],
26+
},
27+
{
28+
"root_module": "./example/mod_bench.rs",
29+
"edition": "2018",
30+
"deps": [],
31+
"cfg": [],
32+
},
33+
]
34+
},
35+
{
36+
"roots": ["./scripts/filter_profile.rs"],
37+
"crates": [
38+
{
39+
"root_module": "./scripts/filter_profile.rs",
40+
"edition": "2018",
41+
"deps": [{ "crate": 1, "name": "std" }],
42+
"cfg": [],
43+
},
44+
{
45+
"root_module": "./build_sysroot/sysroot_src/library/std/src/lib.rs",
46+
"edition": "2018",
47+
"deps": [],
48+
"cfg": [],
49+
},
50+
]
51+
}
52+
]
53+
}

0 commit comments

Comments
 (0)