Skip to content

Commit f6a65e7

Browse files
committed
[WIP] Update Cranelift
1 parent 1e80285 commit f6a65e7

File tree

6 files changed

+45
-116
lines changed

6 files changed

+45
-116
lines changed

Cargo.lock

Lines changed: 26 additions & 85 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ crate-type = ["dylib"]
88

99
[dependencies]
1010
# These have to be in sync with each other
11-
cranelift-codegen = { version = "0.121.0", default-features = false, features = ["std", "timing", "unwind", "all-native-arch", "incremental-cache"] }
12-
cranelift-frontend = { version = "0.121.0" }
13-
cranelift-module = { version = "0.121.0" }
14-
cranelift-native = { version = "0.121.0" }
15-
cranelift-jit = { version = "0.121.0", optional = true }
16-
cranelift-object = { version = "0.121.0" }
11+
cranelift-codegen = { version = "0.122.0", default-features = false, features = ["std", "timing", "unwind", "all-native-arch", "incremental-cache"] }
12+
cranelift-frontend = { version = "0.122.0" }
13+
cranelift-module = { version = "0.122.0" }
14+
cranelift-native = { version = "0.122.0" }
15+
cranelift-jit = { version = "0.122.0", optional = true }
16+
cranelift-object = { version = "0.122.0" }
1717
target-lexicon = "0.13"
1818
gimli = { version = "0.31", default-features = false, features = ["write"] }
1919
object = { version = "0.36", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
@@ -32,12 +32,12 @@ smallvec = "1.8.1"
3232
#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-34.0.0", version = "0.121.0" }
3333

3434
# Uncomment to use local checkout of cranelift
35-
#cranelift-codegen = { path = "../wasmtime/cranelift/codegen" }
36-
#cranelift-frontend = { path = "../wasmtime/cranelift/frontend" }
37-
#cranelift-module = { path = "../wasmtime/cranelift/module" }
38-
#cranelift-native = { path = "../wasmtime/cranelift/native" }
39-
#cranelift-jit = { path = "../wasmtime/cranelift/jit" }
40-
#cranelift-object = { path = "../wasmtime/cranelift/object" }
35+
cranelift-codegen = { path = "../wasmtime/cranelift/codegen" }
36+
cranelift-frontend = { path = "../wasmtime/cranelift/frontend" }
37+
cranelift-module = { path = "../wasmtime/cranelift/module" }
38+
cranelift-native = { path = "../wasmtime/cranelift/native" }
39+
cranelift-jit = { path = "../wasmtime/cranelift/jit" }
40+
cranelift-object = { path = "../wasmtime/cranelift/object" }
4141

4242
#gimli = { path = "../" }
4343

config.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
testsuite.no_sysroot
1616
build.mini_core
1717
build.example
18-
jit.mini_core_hello_world
18+
#jit.mini_core_hello_world
1919
aot.mini_core_hello_world
2020

2121
testsuite.base_sysroot
2222
aot.arbitrary_self_types_pointers_and_wrappers
23-
jit.std_example
23+
#jit.std_example
2424
aot.std_example
2525
aot.dst_field_align
2626
aot.subslice-patterns-const-eval

src/base.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use cranelift_codegen::CodegenError;
44
use cranelift_codegen::ir::UserFuncName;
5-
use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext, Variable};
5+
use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext};
66
use cranelift_module::ModuleError;
77
use rustc_ast::InlineAsmOptions;
88
use rustc_codegen_ssa::base::is_call_from_compiler_builtins_to_upstream_monomorphization;
@@ -87,8 +87,7 @@ pub(crate) fn codegen_fn<'tcx>(
8787
None
8888
};
8989

90-
let exception_slot = Variable::from_u32(0);
91-
bcx.declare_var(exception_slot, pointer_type);
90+
let exception_slot = bcx.declare_var(pointer_type);
9291

9392
let mut fx = FunctionCx {
9493
cx,
@@ -111,7 +110,6 @@ pub(crate) fn codegen_fn<'tcx>(
111110
exception_slot,
112111

113112
clif_comments,
114-
next_ssa_var: 1, // var0 is used for the exception slot
115113
inline_asm: String::new(),
116114
inline_asm_index: 0,
117115
};

src/common.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,6 @@ pub(crate) struct FunctionCx<'m, 'clif, 'tcx: 'm> {
293293

294294
pub(crate) clif_comments: crate::pretty_clif::CommentWriter,
295295

296-
/// This should only be accessed by `CPlace::new_var`.
297-
pub(crate) next_ssa_var: u32,
298-
299296
pub(crate) inline_asm: String,
300297
pub(crate) inline_asm_index: u32,
301298
}

src/value_and_place.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,7 @@ impl<'tcx> CPlace<'tcx> {
393393
local: Local,
394394
layout: TyAndLayout<'tcx>,
395395
) -> CPlace<'tcx> {
396-
let var = Variable::from_u32(fx.next_ssa_var);
397-
fx.next_ssa_var += 1;
398-
fx.bcx.declare_var(var, fx.clif_type(layout.ty).unwrap());
396+
let var = fx.bcx.declare_var(fx.clif_type(layout.ty).unwrap());
399397
CPlace { inner: CPlaceInner::Var(local, var), layout }
400398
}
401399

@@ -404,14 +402,9 @@ impl<'tcx> CPlace<'tcx> {
404402
local: Local,
405403
layout: TyAndLayout<'tcx>,
406404
) -> CPlace<'tcx> {
407-
let var1 = Variable::from_u32(fx.next_ssa_var);
408-
fx.next_ssa_var += 1;
409-
let var2 = Variable::from_u32(fx.next_ssa_var);
410-
fx.next_ssa_var += 1;
411-
412405
let (ty1, ty2) = fx.clif_pair_type(layout.ty).unwrap();
413-
fx.bcx.declare_var(var1, ty1);
414-
fx.bcx.declare_var(var2, ty2);
406+
let var1 = fx.bcx.declare_var(ty1);
407+
let var2 = fx.bcx.declare_var(ty2);
415408
CPlace { inner: CPlaceInner::VarPair(local, var1, var2), layout }
416409
}
417410

0 commit comments

Comments
 (0)