Skip to content

Commit 50aaa77

Browse files
committed
[WIP] Update to Cranelift 0.122
1 parent 8e71749 commit 50aaa77

File tree

5 files changed

+57
-87
lines changed

5 files changed

+57
-87
lines changed

Cargo.lock

Lines changed: 40 additions & 58 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"] }
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"] }
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"] }
@@ -24,12 +24,12 @@ smallvec = "1.8.1"
2424

2525
[patch.crates-io]
2626
# Uncomment to use an unreleased version of cranelift
27-
#cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-34.0.0", version = "0.121.0" }
28-
#cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-34.0.0", version = "0.121.0" }
29-
#cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-34.0.0", version = "0.121.0" }
30-
#cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-34.0.0", version = "0.121.0" }
31-
#cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-34.0.0", version = "0.121.0" }
32-
#cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-34.0.0", version = "0.121.0" }
27+
cranelift-codegen = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-35.0.0" }
28+
cranelift-frontend = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-35.0.0" }
29+
cranelift-module = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-35.0.0" }
30+
cranelift-native = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-35.0.0" }
31+
cranelift-jit = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-35.0.0" }
32+
cranelift-object = { git = "https://github.com/bytecodealliance/wasmtime.git", branch = "release-35.0.0" }
3333

3434
# Uncomment to use local checkout of cranelift
3535
#cranelift-codegen = { path = "../wasmtime/cranelift/codegen" }

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;
@@ -90,8 +90,7 @@ pub(crate) fn codegen_fn<'tcx>(
9090
None
9191
};
9292

93-
let exception_slot = Variable::from_u32(0);
94-
bcx.declare_var(exception_slot, pointer_type);
93+
let exception_slot = bcx.declare_var(pointer_type);
9594

9695
let mut fx = FunctionCx {
9796
module,
@@ -115,7 +114,6 @@ pub(crate) fn codegen_fn<'tcx>(
115114
exception_slot,
116115

117116
clif_comments,
118-
next_ssa_var: 1, // var0 is used for the exception slot
119117
inline_asm: String::new(),
120118
inline_asm_index: 0,
121119
};

src/common.rs

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

296296
pub(crate) clif_comments: crate::pretty_clif::CommentWriter,
297297

298-
/// This should only be accessed by `CPlace::new_var`.
299-
pub(crate) next_ssa_var: u32,
300-
301298
pub(crate) inline_asm: String,
302299
pub(crate) inline_asm_index: u32,
303300
}

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)