Skip to content

Commit 604d40f

Browse files
committed
Update to Cranelift 0.133
1 parent 84632b1 commit 604d40f

17 files changed

Lines changed: 162 additions & 132 deletions

Cargo.lock

Lines changed: 37 additions & 36 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.132.0", default-features = false, features = ["std", "timing", "unwind", "all-native-arch"] }
12-
cranelift-frontend = { version = "0.132.0" }
13-
cranelift-module = { version = "0.132.0" }
14-
cranelift-native = { version = "0.132.0" }
15-
cranelift-jit = { version = "0.132.0", optional = true }
16-
cranelift-object = { version = "0.132.0" }
11+
cranelift-codegen = { version = "0.133.0", default-features = false, features = ["std", "timing", "unwind", "all-native-arch"] }
12+
cranelift-frontend = { version = "0.133.0" }
13+
cranelift-module = { version = "0.133.0" }
14+
cranelift-native = { version = "0.133.0" }
15+
cranelift-jit = { version = "0.133.0", optional = true }
16+
cranelift-object = { version = "0.133.0", default-features = false }
1717
target-lexicon = "0.13"
1818
gimli = { version = "0.33", default-features = false, features = ["write"] }
1919
object = { version = "0.39.1", default-features = false, features = ["std", "read_core", "write", "archive", "coff", "elf", "macho", "pe"] }
@@ -24,12 +24,12 @@ smallvec = "1.8.1"
2424

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

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

src/abi/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
147147
.map(|(param, &arg)| {
148148
if param.value_type == types::I128 {
149149
let arg_ptr = self.create_stack_slot(16, 16);
150-
arg_ptr.store(self, arg, MemFlags::trusted());
150+
arg_ptr.store(self, arg, MemFlagsData::trusted());
151151
(AbiParam::new(self.pointer_type), arg_ptr.get_addr(self))
152152
} else {
153153
(param, arg)
@@ -179,7 +179,7 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> {
179179

180180
self.lib_call_unadjusted(name, params, vec![], &args);
181181

182-
Cow::Owned(vec![ret_ptr.load(self, types::I128, MemFlags::trusted())])
182+
Cow::Owned(vec![ret_ptr.load(self, types::I128, MemFlagsData::trusted())])
183183
} else {
184184
Cow::Borrowed(self.lib_call_unadjusted(name, params, returns, &args))
185185
}

src/abi/pass_mode.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,11 @@ pub(super) fn to_casted_value<'tcx>(
211211
cast_target_to_abi_params(cast)
212212
.into_iter()
213213
.map(|(offset, param)| {
214-
ptr.offset_i64(fx, offset.bytes() as i64).load(fx, param.value_type, MemFlags::new())
214+
ptr.offset_i64(fx, offset.bytes() as i64).load(
215+
fx,
216+
param.value_type,
217+
MemFlagsData::new(),
218+
)
215219
})
216220
.collect()
217221
}
@@ -237,7 +241,7 @@ pub(super) fn from_casted_value<'tcx>(
237241
ptr.offset_i64(fx, offset.bytes() as i64).store(
238242
fx,
239243
block_params_iter.next().unwrap(),
240-
MemFlags::new(),
244+
MemFlagsData::trusted(),
241245
)
242246
}
243247
assert_eq!(block_params_iter.next(), None, "Leftover block param");

src/codegen_f16_f128.rs

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub(crate) fn f16_to_f32(fx: &mut FunctionCx<'_, '_, '_>, value: Value) -> Value
77
let (value, arg_ty) =
88
if fx.tcx.sess.target.is_like_darwin && fx.tcx.sess.target.arch == Arch::X86_64 {
99
(
10-
fx.bcx.ins().bitcast(types::I16, MemFlags::new(), value),
10+
fx.bcx.ins().bitcast(types::I16, MemFlagsData::new(), value),
1111
lib_call_arg_param(fx.tcx, types::I16, false),
1212
)
1313
} else {
@@ -33,7 +33,11 @@ pub(crate) fn f32_to_f16(fx: &mut FunctionCx<'_, '_, '_>, value: Value) -> Value
3333
vec![AbiParam::new(ret_ty)],
3434
&[value],
3535
)[0];
36-
if ret_ty == types::I16 { fx.bcx.ins().bitcast(types::F16, MemFlags::new(), ret) } else { ret }
36+
if ret_ty == types::I16 {
37+
fx.bcx.ins().bitcast(types::F16, MemFlagsData::new(), ret)
38+
} else {
39+
ret
40+
}
3741
}
3842

3943
fn f64_to_f16(fx: &mut FunctionCx<'_, '_, '_>, value: Value) -> Value {
@@ -48,7 +52,11 @@ fn f64_to_f16(fx: &mut FunctionCx<'_, '_, '_>, value: Value) -> Value {
4852
vec![AbiParam::new(ret_ty)],
4953
&[value],
5054
)[0];
51-
if ret_ty == types::I16 { fx.bcx.ins().bitcast(types::F16, MemFlags::new(), ret) } else { ret }
55+
if ret_ty == types::I16 {
56+
fx.bcx.ins().bitcast(types::F16, MemFlagsData::new(), ret)
57+
} else {
58+
ret
59+
}
5260
}
5361

5462
// FIXME(bytecodealliance/wasmtime#8312): Remove once backend lowerings have
@@ -139,52 +147,52 @@ pub(crate) fn codegen_f128_binop(
139147
}
140148

141149
pub(crate) fn neg_f16(fx: &mut FunctionCx<'_, '_, '_>, value: Value) -> Value {
142-
let bits = fx.bcx.ins().bitcast(types::I16, MemFlags::new(), value);
150+
let bits = fx.bcx.ins().bitcast(types::I16, MemFlagsData::new(), value);
143151
let bits = fx.bcx.ins().bxor_imm(bits, 0x8000);
144-
fx.bcx.ins().bitcast(types::F16, MemFlags::new(), bits)
152+
fx.bcx.ins().bitcast(types::F16, MemFlagsData::new(), bits)
145153
}
146154

147155
pub(crate) fn neg_f128(fx: &mut FunctionCx<'_, '_, '_>, value: Value) -> Value {
148-
let bits = fx.bcx.ins().bitcast(types::I128, MemFlags::new(), value);
156+
let bits = fx.bcx.ins().bitcast(types::I128, MemFlagsData::new(), value);
149157
let (low, high) = fx.bcx.ins().isplit(bits);
150158
let high = fx.bcx.ins().bxor_imm(high, 0x8000_0000_0000_0000_u64 as i64);
151159
let bits = fx.bcx.ins().iconcat(low, high);
152-
fx.bcx.ins().bitcast(types::F128, MemFlags::new(), bits)
160+
fx.bcx.ins().bitcast(types::F128, MemFlagsData::new(), bits)
153161
}
154162

155163
pub(crate) fn abs_f16(fx: &mut FunctionCx<'_, '_, '_>, value: Value) -> Value {
156-
let bits = fx.bcx.ins().bitcast(types::I16, MemFlags::new(), value);
164+
let bits = fx.bcx.ins().bitcast(types::I16, MemFlagsData::new(), value);
157165
let bits = fx.bcx.ins().band_imm(bits, 0x7fff);
158-
fx.bcx.ins().bitcast(types::F16, MemFlags::new(), bits)
166+
fx.bcx.ins().bitcast(types::F16, MemFlagsData::new(), bits)
159167
}
160168

161169
pub(crate) fn abs_f128(fx: &mut FunctionCx<'_, '_, '_>, value: Value) -> Value {
162-
let bits = fx.bcx.ins().bitcast(types::I128, MemFlags::new(), value);
170+
let bits = fx.bcx.ins().bitcast(types::I128, MemFlagsData::new(), value);
163171
let (low, high) = fx.bcx.ins().isplit(bits);
164172
let high = fx.bcx.ins().band_imm(high, 0x7fff_ffff_ffff_ffff_u64 as i64);
165173
let bits = fx.bcx.ins().iconcat(low, high);
166-
fx.bcx.ins().bitcast(types::F128, MemFlags::new(), bits)
174+
fx.bcx.ins().bitcast(types::F128, MemFlagsData::new(), bits)
167175
}
168176

169177
pub(crate) fn copysign_f16(fx: &mut FunctionCx<'_, '_, '_>, lhs: Value, rhs: Value) -> Value {
170-
let lhs = fx.bcx.ins().bitcast(types::I16, MemFlags::new(), lhs);
171-
let rhs = fx.bcx.ins().bitcast(types::I16, MemFlags::new(), rhs);
178+
let lhs = fx.bcx.ins().bitcast(types::I16, MemFlagsData::new(), lhs);
179+
let rhs = fx.bcx.ins().bitcast(types::I16, MemFlagsData::new(), rhs);
172180
let res = fx.bcx.ins().band_imm(lhs, 0x7fff);
173181
let sign = fx.bcx.ins().band_imm(rhs, 0x8000);
174182
let res = fx.bcx.ins().bor(res, sign);
175-
fx.bcx.ins().bitcast(types::F16, MemFlags::new(), res)
183+
fx.bcx.ins().bitcast(types::F16, MemFlagsData::new(), res)
176184
}
177185

178186
pub(crate) fn copysign_f128(fx: &mut FunctionCx<'_, '_, '_>, lhs: Value, rhs: Value) -> Value {
179-
let lhs = fx.bcx.ins().bitcast(types::I128, MemFlags::new(), lhs);
180-
let rhs = fx.bcx.ins().bitcast(types::I128, MemFlags::new(), rhs);
187+
let lhs = fx.bcx.ins().bitcast(types::I128, MemFlagsData::new(), lhs);
188+
let rhs = fx.bcx.ins().bitcast(types::I128, MemFlagsData::new(), rhs);
181189
let (low, lhs_high) = fx.bcx.ins().isplit(lhs);
182190
let (_, rhs_high) = fx.bcx.ins().isplit(rhs);
183191
let high = fx.bcx.ins().band_imm(lhs_high, 0x7fff_ffff_ffff_ffff_u64 as i64);
184192
let sign = fx.bcx.ins().band_imm(rhs_high, 0x8000_0000_0000_0000_u64 as i64);
185193
let high = fx.bcx.ins().bor(high, sign);
186194
let res = fx.bcx.ins().iconcat(low, high);
187-
fx.bcx.ins().bitcast(types::F128, MemFlags::new(), res)
195+
fx.bcx.ins().bitcast(types::F128, MemFlagsData::new(), res)
188196
}
189197

190198
pub(crate) fn codegen_cast(

0 commit comments

Comments
 (0)