Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a53204f

Browse files
authoredDec 20, 2024
Rollup merge of #133103 - tiif:fnabi, r=RalfJung
Pass FnAbi to find_mir_or_eval_fn rust-lang/miri#4013 needs information from ``FnAbi``, hence it is passed to ``find_mir_or_eval_fn``. r? `@RalfJung`
2 parents 1ec6d09 + fd8b983 commit a53204f

File tree

31 files changed

+484
-455
lines changed

31 files changed

+484
-455
lines changed
 

‎compiler/rustc_const_eval/src/const_eval/dummy_machine.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
use rustc_middle::mir::interpret::{AllocId, ConstAllocation, InterpResult};
22
use rustc_middle::mir::*;
33
use rustc_middle::query::TyCtxtAt;
4+
use rustc_middle::ty::Ty;
45
use rustc_middle::ty::layout::TyAndLayout;
56
use rustc_middle::{bug, span_bug, ty};
67
use rustc_span::def_id::DefId;
8+
use rustc_target::callconv::FnAbi;
79

810
use crate::interpret::{
911
self, HasStaticRootDefId, ImmTy, Immediate, InterpCx, PointerArithmetic, interp_ok,
@@ -86,7 +88,7 @@ impl<'tcx> interpret::Machine<'tcx> for DummyMachine {
8688
fn find_mir_or_eval_fn(
8789
_ecx: &mut InterpCx<'tcx, Self>,
8890
_instance: ty::Instance<'tcx>,
89-
_abi: rustc_abi::ExternAbi,
91+
_abi: &FnAbi<'tcx, Ty<'tcx>>,
9092
_args: &[interpret::FnArg<'tcx, Self::Provenance>],
9193
_destination: &interpret::MPlaceTy<'tcx, Self::Provenance>,
9294
_target: Option<BasicBlock>,

‎compiler/rustc_const_eval/src/const_eval/machine.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::borrow::{Borrow, Cow};
22
use std::fmt;
33
use std::hash::Hash;
44

5-
use rustc_abi::{Align, ExternAbi, Size};
5+
use rustc_abi::{Align, Size};
66
use rustc_ast::Mutability;
77
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, IndexEntry};
88
use rustc_hir::def_id::{DefId, LocalDefId};
@@ -14,6 +14,7 @@ use rustc_middle::ty::layout::{HasTypingEnv, TyAndLayout};
1414
use rustc_middle::ty::{self, Ty, TyCtxt};
1515
use rustc_middle::{bug, mir};
1616
use rustc_span::{Span, Symbol, sym};
17+
use rustc_target::callconv::FnAbi;
1718
use tracing::debug;
1819

1920
use super::error::*;
@@ -339,7 +340,7 @@ impl<'tcx> interpret::Machine<'tcx> for CompileTimeMachine<'tcx> {
339340
fn find_mir_or_eval_fn(
340341
ecx: &mut InterpCx<'tcx, Self>,
341342
orig_instance: ty::Instance<'tcx>,
342-
_abi: ExternAbi,
343+
_abi: &FnAbi<'tcx, Ty<'tcx>>,
343344
args: &[FnArg<'tcx>],
344345
dest: &MPlaceTy<'tcx>,
345346
ret: Option<mir::BasicBlock>,

‎compiler/rustc_const_eval/src/interpret/call.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
519519
return M::call_extra_fn(
520520
self,
521521
extra,
522-
caller_abi,
522+
caller_fn_abi,
523523
args,
524524
destination,
525525
target,
@@ -570,7 +570,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
570570
let Some((body, instance)) = M::find_mir_or_eval_fn(
571571
self,
572572
instance,
573-
caller_abi,
573+
caller_fn_abi,
574574
args,
575575
destination,
576576
target,

‎compiler/rustc_const_eval/src/interpret/machine.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::borrow::{Borrow, Cow};
66
use std::fmt::Debug;
77
use std::hash::Hash;
88

9-
use rustc_abi::{Align, ExternAbi, Size};
9+
use rustc_abi::{Align, Size};
1010
use rustc_apfloat::{Float, FloatConvert};
1111
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
1212
use rustc_middle::query::TyCtxtAt;
@@ -15,6 +15,7 @@ use rustc_middle::ty::layout::TyAndLayout;
1515
use rustc_middle::{mir, ty};
1616
use rustc_span::Span;
1717
use rustc_span::def_id::DefId;
18+
use rustc_target::callconv::FnAbi;
1819

1920
use super::{
2021
AllocBytes, AllocId, AllocKind, AllocRange, Allocation, CTFE_ALLOC_SALT, ConstAllocation,
@@ -201,7 +202,7 @@ pub trait Machine<'tcx>: Sized {
201202
fn find_mir_or_eval_fn(
202203
ecx: &mut InterpCx<'tcx, Self>,
203204
instance: ty::Instance<'tcx>,
204-
abi: ExternAbi,
205+
abi: &FnAbi<'tcx, Ty<'tcx>>,
205206
args: &[FnArg<'tcx, Self::Provenance>],
206207
destination: &MPlaceTy<'tcx, Self::Provenance>,
207208
target: Option<mir::BasicBlock>,
@@ -213,7 +214,7 @@ pub trait Machine<'tcx>: Sized {
213214
fn call_extra_fn(
214215
ecx: &mut InterpCx<'tcx, Self>,
215216
fn_val: Self::ExtraFnVal,
216-
abi: ExternAbi,
217+
abi: &FnAbi<'tcx, Ty<'tcx>>,
217218
args: &[FnArg<'tcx, Self::Provenance>],
218219
destination: &MPlaceTy<'tcx, Self::Provenance>,
219220
target: Option<mir::BasicBlock>,
@@ -656,7 +657,7 @@ pub macro compile_time_machine(<$tcx: lifetime>) {
656657
fn call_extra_fn(
657658
_ecx: &mut InterpCx<$tcx, Self>,
658659
fn_val: !,
659-
_abi: ExternAbi,
660+
_abi: &FnAbi<$tcx, Ty<$tcx>>,
660661
_args: &[FnArg<$tcx>],
661662
_destination: &MPlaceTy<$tcx, Self::Provenance>,
662663
_target: Option<mir::BasicBlock>,

‎src/tools/miri/src/helpers.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use rustc_middle::ty::layout::{FnAbiOf, LayoutOf, MaybeResult, TyAndLayout};
1919
use rustc_middle::ty::{self, FloatTy, IntTy, Ty, TyCtxt, UintTy};
2020
use rustc_session::config::CrateType;
2121
use rustc_span::{Span, Symbol};
22+
use rustc_target::callconv::{Conv, FnAbi};
2223

2324
use crate::*;
2425

@@ -914,13 +915,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
914915
}
915916

916917
/// Check that the ABI is what we expect.
917-
fn check_abi<'a>(&self, abi: ExternAbi, exp_abi: ExternAbi) -> InterpResult<'a, ()> {
918-
if abi != exp_abi {
918+
fn check_abi<'a>(&self, fn_abi: &FnAbi<'tcx, Ty<'tcx>>, exp_abi: Conv) -> InterpResult<'a, ()> {
919+
if fn_abi.conv != exp_abi {
919920
throw_ub_format!(
920-
"calling a function with ABI {} using caller ABI {}",
921-
exp_abi.name(),
922-
abi.name()
923-
)
921+
"calling a function with ABI {:?} using caller ABI {:?}",
922+
exp_abi, fn_abi.conv);
924923
}
925924
interp_ok(())
926925
}
@@ -950,8 +949,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
950949

951950
fn check_abi_and_shim_symbol_clash(
952951
&mut self,
953-
abi: ExternAbi,
954-
exp_abi: ExternAbi,
952+
abi: &FnAbi<'tcx, Ty<'tcx>>,
953+
exp_abi: Conv,
955954
link_name: Symbol,
956955
) -> InterpResult<'tcx, ()> {
957956
self.check_abi(abi, exp_abi)?;
@@ -975,8 +974,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
975974

976975
fn check_shim<'a, const N: usize>(
977976
&mut self,
978-
abi: ExternAbi,
979-
exp_abi: ExternAbi,
977+
abi: &FnAbi<'tcx, Ty<'tcx>>,
978+
exp_abi: Conv,
980979
link_name: Symbol,
981980
args: &'a [OpTy<'tcx>],
982981
) -> InterpResult<'tcx, &'a [OpTy<'tcx>; N]>

‎src/tools/miri/src/machine.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use rand::{Rng, SeedableRng};
1313
use rustc_abi::{Align, ExternAbi, Size};
1414
use rustc_attr_parsing::InlineAttr;
1515
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
16+
use rustc_target::callconv::FnAbi;
1617
#[allow(unused)]
1718
use rustc_data_structures::static_assert_size;
1819
use rustc_middle::mir;
@@ -1010,7 +1011,7 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
10101011
fn find_mir_or_eval_fn(
10111012
ecx: &mut MiriInterpCx<'tcx>,
10121013
instance: ty::Instance<'tcx>,
1013-
abi: ExternAbi,
1014+
abi: &FnAbi<'tcx, Ty<'tcx>>,
10141015
args: &[FnArg<'tcx, Provenance>],
10151016
dest: &MPlaceTy<'tcx>,
10161017
ret: Option<mir::BasicBlock>,
@@ -1037,7 +1038,7 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
10371038
fn call_extra_fn(
10381039
ecx: &mut MiriInterpCx<'tcx>,
10391040
fn_val: DynSym,
1040-
abi: ExternAbi,
1041+
abi: &FnAbi<'tcx, Ty<'tcx>>,
10411042
args: &[FnArg<'tcx, Provenance>],
10421043
dest: &MPlaceTy<'tcx>,
10431044
ret: Option<mir::BasicBlock>,

‎src/tools/miri/src/shims/backtrace.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
use rustc_abi::{ExternAbi, Size};
1+
use rustc_abi::Size;
22
use rustc_middle::ty::layout::LayoutOf as _;
33
use rustc_middle::ty::{self, Instance, Ty};
44
use rustc_span::{BytePos, Loc, Symbol, hygiene};
5+
use rustc_target::callconv::{Conv, FnAbi};
56

67
use crate::helpers::check_min_arg_count;
78
use crate::*;
@@ -10,13 +11,13 @@ impl<'tcx> EvalContextExt<'tcx> for crate::MiriInterpCx<'tcx> {}
1011
pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1112
fn handle_miri_backtrace_size(
1213
&mut self,
13-
abi: ExternAbi,
14+
abi: &FnAbi<'tcx, Ty<'tcx>>,
1415
link_name: Symbol,
1516
args: &[OpTy<'tcx>],
1617
dest: &MPlaceTy<'tcx>,
1718
) -> InterpResult<'tcx> {
1819
let this = self.eval_context_mut();
19-
let [flags] = this.check_shim(abi, ExternAbi::Rust, link_name, args)?;
20+
let [flags] = this.check_shim(abi, Conv::Rust, link_name, args)?;
2021

2122
let flags = this.read_scalar(flags)?.to_u64()?;
2223
if flags != 0 {
@@ -30,7 +31,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
3031

3132
fn handle_miri_get_backtrace(
3233
&mut self,
33-
abi: ExternAbi,
34+
abi: &FnAbi<'tcx, Ty<'tcx>>,
3435
link_name: Symbol,
3536
args: &[OpTy<'tcx>],
3637
dest: &MPlaceTy<'tcx>,
@@ -71,7 +72,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
7172
// storage for pointers is allocated by miri
7273
// deallocating the slice is undefined behavior with a custom global allocator
7374
0 => {
74-
let [_flags] = this.check_shim(abi, ExternAbi::Rust, link_name, args)?;
75+
let [_flags] = this.check_shim(abi, Conv::Rust, link_name, args)?;
7576

7677
let alloc = this.allocate(array_layout, MiriMemoryKind::Rust.into())?;
7778

@@ -86,7 +87,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
8687
}
8788
// storage for pointers is allocated by the caller
8889
1 => {
89-
let [_flags, buf] = this.check_shim(abi, ExternAbi::Rust, link_name, args)?;
90+
let [_flags, buf] = this.check_shim(abi, Conv::Rust, link_name, args)?;
9091

9192
let buf_place = this.deref_pointer(buf)?;
9293

@@ -136,13 +137,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
136137

137138
fn handle_miri_resolve_frame(
138139
&mut self,
139-
abi: ExternAbi,
140+
abi: &FnAbi<'tcx, Ty<'tcx>>,
140141
link_name: Symbol,
141142
args: &[OpTy<'tcx>],
142143
dest: &MPlaceTy<'tcx>,
143144
) -> InterpResult<'tcx> {
144145
let this = self.eval_context_mut();
145-
let [ptr, flags] = this.check_shim(abi, ExternAbi::Rust, link_name, args)?;
146+
let [ptr, flags] = this.check_shim(abi, Conv::Rust, link_name, args)?;
146147

147148
let flags = this.read_scalar(flags)?.to_u64()?;
148149

@@ -207,14 +208,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
207208

208209
fn handle_miri_resolve_frame_names(
209210
&mut self,
210-
abi: ExternAbi,
211+
abi: &FnAbi<'tcx, Ty<'tcx>>,
211212
link_name: Symbol,
212213
args: &[OpTy<'tcx>],
213214
) -> InterpResult<'tcx> {
214215
let this = self.eval_context_mut();
215216

216217
let [ptr, flags, name_ptr, filename_ptr] =
217-
this.check_shim(abi, ExternAbi::Rust, link_name, args)?;
218+
this.check_shim(abi, Conv::Rust, link_name, args)?;
218219

219220
let flags = this.read_scalar(flags)?.to_u64()?;
220221
if flags != 0 {

‎src/tools/miri/src/shims/foreign_items.rs

Lines changed: 45 additions & 43 deletions
Large diffs are not rendered by default.

‎src/tools/miri/src/shims/unix/android/foreign_items.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
use rustc_abi::ExternAbi;
1+
use rustc_middle::ty::Ty;
22
use rustc_span::Symbol;
3+
use rustc_target::callconv::{Conv, FnAbi};
4+
5+
36

47
use crate::shims::unix::android::thread::prctl;
58
use crate::shims::unix::linux_like::epoll::EvalContextExt as _;
@@ -16,7 +19,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1619
fn emulate_foreign_item_inner(
1720
&mut self,
1821
link_name: Symbol,
19-
abi: ExternAbi,
22+
abi: &FnAbi<'tcx, Ty<'tcx>>,
2023
args: &[OpTy<'tcx>],
2124
dest: &MPlaceTy<'tcx>,
2225
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -25,31 +28,31 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
2528
// epoll, eventfd
2629
"epoll_create1" => {
2730
let [flag] =
28-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
31+
this.check_shim(abi, Conv::C, link_name, args)?;
2932
let result = this.epoll_create1(flag)?;
3033
this.write_scalar(result, dest)?;
3134
}
3235
"epoll_ctl" => {
3336
let [epfd, op, fd, event] =
34-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
37+
this.check_shim(abi, Conv::C, link_name, args)?;
3538
let result = this.epoll_ctl(epfd, op, fd, event)?;
3639
this.write_scalar(result, dest)?;
3740
}
3841
"epoll_wait" => {
3942
let [epfd, events, maxevents, timeout] =
40-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
43+
this.check_shim(abi, Conv::C, link_name, args)?;
4144
this.epoll_wait(epfd, events, maxevents, timeout, dest)?;
4245
}
4346
"eventfd" => {
4447
let [val, flag] =
45-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
48+
this.check_shim(abi, Conv::C, link_name, args)?;
4649
let result = this.eventfd(val, flag)?;
4750
this.write_scalar(result, dest)?;
4851
}
4952

5053
// Miscellaneous
5154
"__errno" => {
52-
let [] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
55+
let [] = this.check_shim(abi, Conv::C, link_name, args)?;
5356
let errno_place = this.last_error_place()?;
5457
this.write_scalar(errno_place.to_ref(this).to_scalar(), dest)?;
5558
}

‎src/tools/miri/src/shims/unix/android/thread.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
use rustc_abi::{ExternAbi, Size};
1+
use rustc_abi::Size;
2+
use rustc_middle::ty::Ty;
23
use rustc_span::Symbol;
4+
use rustc_target::callconv::{Conv, FnAbi};
35

46
use crate::helpers::check_min_arg_count;
57
use crate::shims::unix::thread::{EvalContextExt as _, ThreadNameResult};
@@ -10,13 +12,13 @@ const TASK_COMM_LEN: usize = 16;
1012
pub fn prctl<'tcx>(
1113
ecx: &mut MiriInterpCx<'tcx>,
1214
link_name: Symbol,
13-
abi: ExternAbi,
15+
abi: &FnAbi<'tcx, Ty<'tcx>>,
1416
args: &[OpTy<'tcx>],
1517
dest: &MPlaceTy<'tcx>,
1618
) -> InterpResult<'tcx> {
1719
// We do not use `check_shim` here because `prctl` is variadic. The argument
1820
// count is checked bellow.
19-
ecx.check_abi_and_shim_symbol_clash(abi, ExternAbi::C { unwind: false }, link_name)?;
21+
ecx.check_abi_and_shim_symbol_clash(abi, Conv::C, link_name)?;
2022

2123
// FIXME: Use constants once https://github.com/rust-lang/libc/pull/3941 backported to the 0.2 branch.
2224
let pr_set_name = 15;

‎src/tools/miri/src/shims/unix/foreign_items.rs

Lines changed: 103 additions & 103 deletions
Large diffs are not rendered by default.

‎src/tools/miri/src/shims/unix/freebsd/foreign_items.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
use rustc_abi::ExternAbi;
1+
use rustc_middle::ty::Ty;
22
use rustc_span::Symbol;
3+
use rustc_target::callconv::{Conv, FnAbi};
34

45
use crate::shims::unix::*;
56
use crate::*;
@@ -13,7 +14,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1314
fn emulate_foreign_item_inner(
1415
&mut self,
1516
link_name: Symbol,
16-
abi: ExternAbi,
17+
abi: &FnAbi<'tcx, Ty<'tcx>>,
1718
args: &[OpTy<'tcx>],
1819
dest: &MPlaceTy<'tcx>,
1920
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -22,7 +23,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
2223
// Threading
2324
"pthread_set_name_np" => {
2425
let [thread, name] =
25-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
26+
this.check_shim(abi, Conv::C, link_name, args)?;
2627
let max_len = usize::MAX; // FreeBSD does not seem to have a limit.
2728
// FreeBSD's pthread_set_name_np does not return anything.
2829
this.pthread_setname_np(
@@ -34,7 +35,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
3435
}
3536
"pthread_get_name_np" => {
3637
let [thread, name, len] =
37-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
38+
this.check_shim(abi, Conv::C, link_name, args)?;
3839
// FreeBSD's pthread_get_name_np does not return anything
3940
// and uses strlcpy, which truncates the resulting value,
4041
// but always adds a null terminator (except for zero-sized buffers).
@@ -52,32 +53,32 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
5253
// since freebsd 12 the former form can be expected.
5354
"stat" | "stat@FBSD_1.0" => {
5455
let [path, buf] =
55-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
56+
this.check_shim(abi, Conv::C, link_name, args)?;
5657
let result = this.macos_fbsd_solaris_stat(path, buf)?;
5758
this.write_scalar(result, dest)?;
5859
}
5960
"lstat" | "lstat@FBSD_1.0" => {
6061
let [path, buf] =
61-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
62+
this.check_shim(abi, Conv::C, link_name, args)?;
6263
let result = this.macos_fbsd_solaris_lstat(path, buf)?;
6364
this.write_scalar(result, dest)?;
6465
}
6566
"fstat" | "fstat@FBSD_1.0" => {
6667
let [fd, buf] =
67-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
68+
this.check_shim(abi, Conv::C, link_name, args)?;
6869
let result = this.macos_fbsd_solaris_fstat(fd, buf)?;
6970
this.write_scalar(result, dest)?;
7071
}
7172
"readdir_r" | "readdir_r@FBSD_1.0" => {
7273
let [dirp, entry, result] =
73-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
74+
this.check_shim(abi, Conv::C, link_name, args)?;
7475
let result = this.macos_fbsd_readdir_r(dirp, entry, result)?;
7576
this.write_scalar(result, dest)?;
7677
}
7778

7879
// Miscellaneous
7980
"__error" => {
80-
let [] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
81+
let [] = this.check_shim(abi, Conv::C, link_name, args)?;
8182
let errno_place = this.last_error_place()?;
8283
this.write_scalar(errno_place.to_ref(this).to_scalar(), dest)?;
8384
}
@@ -86,7 +87,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
8687
// These shims are enabled only when the caller is in the standard library.
8788
"pthread_attr_get_np" if this.frame_in_std() => {
8889
let [_thread, _attr] =
89-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
90+
this.check_shim(abi, Conv::C, link_name, args)?;
9091
this.write_null(dest)?;
9192
}
9293

‎src/tools/miri/src/shims/unix/linux/foreign_items.rs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
use rustc_abi::ExternAbi;
1+
use rustc_middle::ty::Ty;
22
use rustc_span::Symbol;
3+
use rustc_target::callconv::{Conv, FnAbi};
34

45
use self::shims::unix::linux::mem::EvalContextExt as _;
56
use self::shims::unix::linux_like::epoll::EvalContextExt as _;
@@ -24,7 +25,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
2425
fn emulate_foreign_item_inner(
2526
&mut self,
2627
link_name: Symbol,
27-
abi: ExternAbi,
28+
abi: &FnAbi<'tcx, Ty<'tcx>>,
2829
args: &[OpTy<'tcx>],
2930
dest: &MPlaceTy<'tcx>,
3031
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -36,52 +37,52 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
3637
// File related shims
3738
"readdir64" => {
3839
let [dirp] =
39-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
40+
this.check_shim(abi, Conv::C, link_name, args)?;
4041
let result = this.linux_readdir64(dirp)?;
4142
this.write_scalar(result, dest)?;
4243
}
4344
"sync_file_range" => {
4445
let [fd, offset, nbytes, flags] =
45-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
46+
this.check_shim(abi, Conv::C, link_name, args)?;
4647
let result = this.sync_file_range(fd, offset, nbytes, flags)?;
4748
this.write_scalar(result, dest)?;
4849
}
4950
"statx" => {
5051
let [dirfd, pathname, flags, mask, statxbuf] =
51-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
52+
this.check_shim(abi, Conv::C, link_name, args)?;
5253
let result = this.linux_statx(dirfd, pathname, flags, mask, statxbuf)?;
5354
this.write_scalar(result, dest)?;
5455
}
5556

5657
// epoll, eventfd
5758
"epoll_create1" => {
5859
let [flag] =
59-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
60+
this.check_shim(abi, Conv::C, link_name, args)?;
6061
let result = this.epoll_create1(flag)?;
6162
this.write_scalar(result, dest)?;
6263
}
6364
"epoll_ctl" => {
6465
let [epfd, op, fd, event] =
65-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
66+
this.check_shim(abi, Conv::C, link_name, args)?;
6667
let result = this.epoll_ctl(epfd, op, fd, event)?;
6768
this.write_scalar(result, dest)?;
6869
}
6970
"epoll_wait" => {
7071
let [epfd, events, maxevents, timeout] =
71-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
72+
this.check_shim(abi, Conv::C, link_name, args)?;
7273
this.epoll_wait(epfd, events, maxevents, timeout, dest)?;
7374
}
7475
"eventfd" => {
7576
let [val, flag] =
76-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
77+
this.check_shim(abi, Conv::C, link_name, args)?;
7778
let result = this.eventfd(val, flag)?;
7879
this.write_scalar(result, dest)?;
7980
}
8081

8182
// Threading
8283
"pthread_setname_np" => {
8384
let [thread, name] =
84-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
85+
this.check_shim(abi, Conv::C, link_name, args)?;
8586
let res = match this.pthread_setname_np(
8687
this.read_scalar(thread)?,
8788
this.read_scalar(name)?,
@@ -97,7 +98,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
9798
}
9899
"pthread_getname_np" => {
99100
let [thread, name, len] =
100-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
101+
this.check_shim(abi, Conv::C, link_name, args)?;
101102
// The function's behavior isn't portable between platforms.
102103
// In case of glibc, the length of the output buffer must
103104
// be not shorter than TASK_COMM_LEN.
@@ -120,7 +121,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
120121
this.write_scalar(res, dest)?;
121122
}
122123
"gettid" => {
123-
let [] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
124+
let [] = this.check_shim(abi, Conv::C, link_name, args)?;
124125
let result = this.linux_gettid()?;
125126
this.write_scalar(result, dest)?;
126127
}
@@ -133,35 +134,35 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
133134
// Miscellaneous
134135
"mmap64" => {
135136
let [addr, length, prot, flags, fd, offset] =
136-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
137+
this.check_shim(abi, Conv::C, link_name, args)?;
137138
let offset = this.read_scalar(offset)?.to_i64()?;
138139
let ptr = this.mmap(addr, length, prot, flags, fd, offset.into())?;
139140
this.write_scalar(ptr, dest)?;
140141
}
141142
"mremap" => {
142143
let [old_address, old_size, new_size, flags] =
143-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
144+
this.check_shim(abi, Conv::C, link_name, args)?;
144145
let ptr = this.mremap(old_address, old_size, new_size, flags)?;
145146
this.write_scalar(ptr, dest)?;
146147
}
147148
"__xpg_strerror_r" => {
148149
let [errnum, buf, buflen] =
149-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
150+
this.check_shim(abi, Conv::C, link_name, args)?;
150151
let result = this.strerror_r(errnum, buf, buflen)?;
151152
this.write_scalar(result, dest)?;
152153
}
153154
"__errno_location" => {
154-
let [] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
155+
let [] = this.check_shim(abi, Conv::C, link_name, args)?;
155156
let errno_place = this.last_error_place()?;
156157
this.write_scalar(errno_place.to_ref(this).to_scalar(), dest)?;
157158
}
158159
"__libc_current_sigrtmin" => {
159-
let [] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
160+
let [] = this.check_shim(abi, Conv::C, link_name, args)?;
160161

161162
this.write_int(SIGRTMIN, dest)?;
162163
}
163164
"__libc_current_sigrtmax" => {
164-
let [] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
165+
let [] = this.check_shim(abi, Conv::C, link_name, args)?;
165166

166167
this.write_int(SIGRTMAX, dest)?;
167168
}
@@ -170,7 +171,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
170171
// These shims are enabled only when the caller is in the standard library.
171172
"pthread_getattr_np" if this.frame_in_std() => {
172173
let [_thread, _attr] =
173-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
174+
this.check_shim(abi, Conv::C, link_name, args)?;
174175
this.write_null(dest)?;
175176
}
176177

‎src/tools/miri/src/shims/unix/linux_like/syscall.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
use rustc_abi::ExternAbi;
1+
use rustc_middle::ty::Ty;
22
use rustc_span::Symbol;
3+
use rustc_target::callconv::{Conv, FnAbi};
4+
35

46
use crate::helpers::check_min_arg_count;
57
use crate::shims::unix::linux_like::eventfd::EvalContextExt as _;
@@ -9,13 +11,13 @@ use crate::*;
911
pub fn syscall<'tcx>(
1012
ecx: &mut MiriInterpCx<'tcx>,
1113
link_name: Symbol,
12-
abi: ExternAbi,
14+
abi: &FnAbi<'tcx, Ty<'tcx>>,
1315
args: &[OpTy<'tcx>],
1416
dest: &MPlaceTy<'tcx>,
1517
) -> InterpResult<'tcx> {
1618
// We do not use `check_shim` here because `syscall` is variadic. The argument
1719
// count is checked bellow.
18-
ecx.check_abi_and_shim_symbol_clash(abi, ExternAbi::C { unwind: false }, link_name)?;
20+
ecx.check_abi_and_shim_symbol_clash(abi, Conv::C, link_name)?;
1921
// The syscall variadic function is legal to call with more arguments than needed,
2022
// extra arguments are simply ignored. The important check is that when we use an
2123
// argument, we have to also check all arguments *before* it to ensure that they

‎src/tools/miri/src/shims/unix/macos/foreign_items.rs

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
use rustc_abi::ExternAbi;
1+
use rustc_middle::ty::Ty;
22
use rustc_span::Symbol;
3+
use rustc_target::callconv::{Conv, FnAbi};
34

45
use super::sync::EvalContextExt as _;
56
use crate::shims::unix::*;
@@ -14,7 +15,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1415
fn emulate_foreign_item_inner(
1516
&mut self,
1617
link_name: Symbol,
17-
abi: ExternAbi,
18+
abi: &FnAbi<'tcx, Ty<'tcx>>,
1819
args: &[OpTy<'tcx>],
1920
dest: &MPlaceTy<'tcx>,
2021
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -25,66 +26,66 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
2526
match link_name.as_str() {
2627
// errno
2728
"__error" => {
28-
let [] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
29+
let [] = this.check_shim(abi, Conv::C, link_name, args)?;
2930
let errno_place = this.last_error_place()?;
3031
this.write_scalar(errno_place.to_ref(this).to_scalar(), dest)?;
3132
}
3233

3334
// File related shims
3435
"close$NOCANCEL" => {
3536
let [result] =
36-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
37+
this.check_shim(abi, Conv::C, link_name, args)?;
3738
let result = this.close(result)?;
3839
this.write_scalar(result, dest)?;
3940
}
4041
"stat" | "stat64" | "stat$INODE64" => {
4142
let [path, buf] =
42-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
43+
this.check_shim(abi, Conv::C, link_name, args)?;
4344
let result = this.macos_fbsd_solaris_stat(path, buf)?;
4445
this.write_scalar(result, dest)?;
4546
}
4647
"lstat" | "lstat64" | "lstat$INODE64" => {
4748
let [path, buf] =
48-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
49+
this.check_shim(abi, Conv::C, link_name, args)?;
4950
let result = this.macos_fbsd_solaris_lstat(path, buf)?;
5051
this.write_scalar(result, dest)?;
5152
}
5253
"fstat" | "fstat64" | "fstat$INODE64" => {
5354
let [fd, buf] =
54-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
55+
this.check_shim(abi, Conv::C, link_name, args)?;
5556
let result = this.macos_fbsd_solaris_fstat(fd, buf)?;
5657
this.write_scalar(result, dest)?;
5758
}
5859
"opendir$INODE64" => {
5960
let [name] =
60-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
61+
this.check_shim(abi, Conv::C, link_name, args)?;
6162
let result = this.opendir(name)?;
6263
this.write_scalar(result, dest)?;
6364
}
6465
"readdir_r" | "readdir_r$INODE64" => {
6566
let [dirp, entry, result] =
66-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
67+
this.check_shim(abi, Conv::C, link_name, args)?;
6768
let result = this.macos_fbsd_readdir_r(dirp, entry, result)?;
6869
this.write_scalar(result, dest)?;
6970
}
7071
"realpath$DARWIN_EXTSN" => {
7172
let [path, resolved_path] =
72-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
73+
this.check_shim(abi, Conv::C, link_name, args)?;
7374
let result = this.realpath(path, resolved_path)?;
7475
this.write_scalar(result, dest)?;
7576
}
7677

7778
// Environment related shims
7879
"_NSGetEnviron" => {
79-
let [] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
80+
let [] = this.check_shim(abi, Conv::C, link_name, args)?;
8081
let environ = this.machine.env_vars.unix().environ();
8182
this.write_pointer(environ, dest)?;
8283
}
8384

8485
// Random data generation
8586
"CCRandomGenerateBytes" => {
8687
let [bytes, count] =
87-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
88+
this.check_shim(abi, Conv::C, link_name, args)?;
8889
let bytes = this.read_pointer(bytes)?;
8990
let count = this.read_target_usize(count)?;
9091
let success = this.eval_libc_i32("kCCSuccess");
@@ -94,30 +95,30 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
9495

9596
// Time related shims
9697
"mach_absolute_time" => {
97-
let [] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
98+
let [] = this.check_shim(abi, Conv::C, link_name, args)?;
9899
let result = this.mach_absolute_time()?;
99100
this.write_scalar(result, dest)?;
100101
}
101102

102103
"mach_timebase_info" => {
103104
let [info] =
104-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
105+
this.check_shim(abi, Conv::C, link_name, args)?;
105106
let result = this.mach_timebase_info(info)?;
106107
this.write_scalar(result, dest)?;
107108
}
108109

109110
// Access to command-line arguments
110111
"_NSGetArgc" => {
111-
let [] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
112+
let [] = this.check_shim(abi, Conv::C, link_name, args)?;
112113
this.write_pointer(this.machine.argc.expect("machine must be initialized"), dest)?;
113114
}
114115
"_NSGetArgv" => {
115-
let [] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
116+
let [] = this.check_shim(abi, Conv::C, link_name, args)?;
116117
this.write_pointer(this.machine.argv.expect("machine must be initialized"), dest)?;
117118
}
118119
"_NSGetExecutablePath" => {
119120
let [buf, bufsize] =
120-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
121+
this.check_shim(abi, Conv::C, link_name, args)?;
121122
this.check_no_isolation("`_NSGetExecutablePath`")?;
122123

123124
let buf_ptr = this.read_pointer(buf)?;
@@ -143,7 +144,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
143144
// Thread-local storage
144145
"_tlv_atexit" => {
145146
let [dtor, data] =
146-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
147+
this.check_shim(abi, Conv::C, link_name, args)?;
147148
let dtor = this.read_pointer(dtor)?;
148149
let dtor = this.get_ptr_fn(dtor)?.as_instance()?;
149150
let data = this.read_scalar(data)?;
@@ -154,14 +155,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
154155
// Querying system information
155156
"pthread_get_stackaddr_np" => {
156157
let [thread] =
157-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
158+
this.check_shim(abi, Conv::C, link_name, args)?;
158159
this.read_target_usize(thread)?;
159160
let stack_addr = Scalar::from_uint(this.machine.stack_addr, this.pointer_size());
160161
this.write_scalar(stack_addr, dest)?;
161162
}
162163
"pthread_get_stacksize_np" => {
163164
let [thread] =
164-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
165+
this.check_shim(abi, Conv::C, link_name, args)?;
165166
this.read_target_usize(thread)?;
166167
let stack_size = Scalar::from_uint(this.machine.stack_size, this.pointer_size());
167168
this.write_scalar(stack_size, dest)?;
@@ -170,7 +171,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
170171
// Threading
171172
"pthread_setname_np" => {
172173
let [name] =
173-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
174+
this.check_shim(abi, Conv::C, link_name, args)?;
174175

175176
// The real implementation has logic in two places:
176177
// * in userland at https://github.com/apple-oss-distributions/libpthread/blob/c032e0b076700a0a47db75528a282b8d3a06531a/src/pthread.c#L1178-L1200,
@@ -198,7 +199,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
198199
}
199200
"pthread_getname_np" => {
200201
let [thread, name, len] =
201-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
202+
this.check_shim(abi, Conv::C, link_name, args)?;
202203

203204
// The function's behavior isn't portable between platforms.
204205
// In case of macOS, a truncated name (due to a too small buffer)
@@ -224,27 +225,27 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
224225

225226
"os_unfair_lock_lock" => {
226227
let [lock_op] =
227-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
228+
this.check_shim(abi, Conv::C, link_name, args)?;
228229
this.os_unfair_lock_lock(lock_op)?;
229230
}
230231
"os_unfair_lock_trylock" => {
231232
let [lock_op] =
232-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
233+
this.check_shim(abi, Conv::C, link_name, args)?;
233234
this.os_unfair_lock_trylock(lock_op, dest)?;
234235
}
235236
"os_unfair_lock_unlock" => {
236237
let [lock_op] =
237-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
238+
this.check_shim(abi, Conv::C, link_name, args)?;
238239
this.os_unfair_lock_unlock(lock_op)?;
239240
}
240241
"os_unfair_lock_assert_owner" => {
241242
let [lock_op] =
242-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
243+
this.check_shim(abi, Conv::C, link_name, args)?;
243244
this.os_unfair_lock_assert_owner(lock_op)?;
244245
}
245246
"os_unfair_lock_assert_not_owner" => {
246247
let [lock_op] =
247-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
248+
this.check_shim(abi, Conv::C, link_name, args)?;
248249
this.os_unfair_lock_assert_not_owner(lock_op)?;
249250
}
250251

‎src/tools/miri/src/shims/unix/solarish/foreign_items.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
use rustc_abi::ExternAbi;
1+
use rustc_middle::ty::Ty;
22
use rustc_span::Symbol;
3+
use rustc_target::callconv::{Conv, FnAbi};
34

45
use crate::shims::unix::foreign_items::EvalContextExt as _;
56
use crate::shims::unix::*;
@@ -14,7 +15,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1415
fn emulate_foreign_item_inner(
1516
&mut self,
1617
link_name: Symbol,
17-
abi: ExternAbi,
18+
abi: &FnAbi<'tcx, Ty<'tcx>>,
1819
args: &[OpTy<'tcx>],
1920
dest: &MPlaceTy<'tcx>,
2021
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -23,7 +24,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
2324
// Threading
2425
"pthread_setname_np" => {
2526
let [thread, name] =
26-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
27+
this.check_shim(abi, Conv::C, link_name, args)?;
2728
// THREAD_NAME_MAX allows a thread name of 31+1 length
2829
// https://github.com/illumos/illumos-gate/blob/7671517e13b8123748eda4ef1ee165c6d9dba7fe/usr/src/uts/common/sys/thread.h#L613
2930
let max_len = 32;
@@ -42,7 +43,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
4243
}
4344
"pthread_getname_np" => {
4445
let [thread, name, len] =
45-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
46+
this.check_shim(abi, Conv::C, link_name, args)?;
4647
// See https://illumos.org/man/3C/pthread_getname_np for the error codes.
4748
let res = match this.pthread_getname_np(
4849
this.read_scalar(thread)?,
@@ -60,33 +61,33 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
6061
// File related shims
6162
"stat" | "stat64" => {
6263
let [path, buf] =
63-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
64+
this.check_shim(abi, Conv::C, link_name, args)?;
6465
let result = this.macos_fbsd_solaris_stat(path, buf)?;
6566
this.write_scalar(result, dest)?;
6667
}
6768
"lstat" | "lstat64" => {
6869
let [path, buf] =
69-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
70+
this.check_shim(abi, Conv::C, link_name, args)?;
7071
let result = this.macos_fbsd_solaris_lstat(path, buf)?;
7172
this.write_scalar(result, dest)?;
7273
}
7374
"fstat" | "fstat64" => {
7475
let [fd, buf] =
75-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
76+
this.check_shim(abi, Conv::C, link_name, args)?;
7677
let result = this.macos_fbsd_solaris_fstat(fd, buf)?;
7778
this.write_scalar(result, dest)?;
7879
}
7980

8081
// Miscellaneous
8182
"___errno" => {
82-
let [] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
83+
let [] = this.check_shim(abi, Conv::C, link_name, args)?;
8384
let errno_place = this.last_error_place()?;
8485
this.write_scalar(errno_place.to_ref(this).to_scalar(), dest)?;
8586
}
8687

8788
"stack_getbounds" => {
8889
let [stack] =
89-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
90+
this.check_shim(abi, Conv::C, link_name, args)?;
9091
let stack = this.deref_pointer_as(stack, this.libc_ty_layout("stack_t"))?;
9192

9293
this.write_int_fields_named(
@@ -105,7 +106,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
105106

106107
"pset_info" => {
107108
let [pset, tpe, cpus, list] =
108-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
109+
this.check_shim(abi, Conv::C, link_name, args)?;
109110
// We do not need to handle the current process cpu mask, available_parallelism
110111
// implementation pass null anyway. We only care for the number of
111112
// cpus.
@@ -135,7 +136,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
135136

136137
"__sysconf_xpg7" => {
137138
let [val] =
138-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
139+
this.check_shim(abi, Conv::C, link_name, args)?;
139140
let result = this.sysconf(val)?;
140141
this.write_scalar(result, dest)?;
141142
}

‎src/tools/miri/src/shims/wasi/foreign_items.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
use rustc_abi::ExternAbi;
1+
use rustc_middle::ty::Ty;
22
use rustc_span::Symbol;
3+
use rustc_target::callconv::{Conv, FnAbi};
34

45
use crate::shims::alloc::EvalContextExt as _;
56
use crate::*;
@@ -13,7 +14,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1314
fn emulate_foreign_item_inner(
1415
&mut self,
1516
link_name: Symbol,
16-
abi: ExternAbi,
17+
abi: &FnAbi<'tcx, Ty<'tcx>>,
1718
args: &[OpTy<'tcx>],
1819
dest: &MPlaceTy<'tcx>,
1920
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -22,13 +23,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
2223
// Allocation
2324
"posix_memalign" => {
2425
let [memptr, align, size] =
25-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
26+
this.check_shim(abi, Conv::C, link_name, args)?;
2627
let result = this.posix_memalign(memptr, align, size)?;
2728
this.write_scalar(result, dest)?;
2829
}
2930
"aligned_alloc" => {
3031
let [align, size] =
31-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
32+
this.check_shim(abi, Conv::C, link_name, args)?;
3233
let res = this.aligned_alloc(align, size)?;
3334
this.write_pointer(res, dest)?;
3435
}

‎src/tools/miri/src/shims/windows/foreign_items.rs

Lines changed: 66 additions & 59 deletions
Large diffs are not rendered by default.

‎src/tools/miri/src/shims/x86/aesni.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use rustc_abi::ExternAbi;
21
use rustc_middle::ty::Ty;
32
use rustc_middle::ty::layout::LayoutOf as _;
43
use rustc_span::Symbol;
4+
use rustc_target::callconv::{Conv, FnAbi};
55

66
use crate::*;
77

@@ -10,7 +10,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1010
fn emulate_x86_aesni_intrinsic(
1111
&mut self,
1212
link_name: Symbol,
13-
abi: ExternAbi,
13+
abi: &FnAbi<'tcx, Ty<'tcx>>,
1414
args: &[OpTy<'tcx>],
1515
dest: &MPlaceTy<'tcx>,
1616
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -27,8 +27,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
2727
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesdec_si128
2828
"aesdec" | "aesdec.256" | "aesdec.512" => {
2929
let [state, key] =
30-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
31-
30+
this.check_shim(abi, Conv::C, link_name, args)?;
3231
aes_round(this, state, key, dest, |state, key| {
3332
let key = aes::Block::from(key.to_le_bytes());
3433
let mut state = aes::Block::from(state.to_le_bytes());
@@ -45,7 +44,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
4544
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesdeclast_si128
4645
"aesdeclast" | "aesdeclast.256" | "aesdeclast.512" => {
4746
let [state, key] =
48-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
47+
this.check_shim(abi, Conv::C, link_name, args)?;
4948

5049
aes_round(this, state, key, dest, |state, key| {
5150
let mut state = aes::Block::from(state.to_le_bytes());
@@ -70,8 +69,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
7069
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesenc_si128
7170
"aesenc" | "aesenc.256" | "aesenc.512" => {
7271
let [state, key] =
73-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
74-
72+
this.check_shim(abi, Conv::C, link_name, args)?;
7573
aes_round(this, state, key, dest, |state, key| {
7674
let key = aes::Block::from(key.to_le_bytes());
7775
let mut state = aes::Block::from(state.to_le_bytes());
@@ -88,8 +86,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
8886
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aesenclast_si128
8987
"aesenclast" | "aesenclast.256" | "aesenclast.512" => {
9088
let [state, key] =
91-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
92-
89+
this.check_shim(abi, Conv::C, link_name, args)?;
9390
aes_round(this, state, key, dest, |state, key| {
9491
let mut state = aes::Block::from(state.to_le_bytes());
9592
// `aes::hazmat::cipher_round` does the following operations:
@@ -109,8 +106,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
109106
// Used to implement the _mm_aesimc_si128 function.
110107
// Performs the AES InvMixColumns operation on `op`
111108
"aesimc" => {
112-
let [op] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
113-
109+
let [op] = this.check_shim(abi, Conv::C, link_name, args)?;
114110
// Transmute to `u128`
115111
let op = op.transmute(this.machine.layouts.u128, this)?;
116112
let dest = dest.transmute(this.machine.layouts.u128, this)?;

‎src/tools/miri/src/shims/x86/avx.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use rustc_abi::ExternAbi;
21
use rustc_apfloat::ieee::{Double, Single};
32
use rustc_middle::mir;
43
use rustc_middle::ty::Ty;
54
use rustc_middle::ty::layout::LayoutOf as _;
65
use rustc_span::Symbol;
6+
use rustc_target::callconv::{Conv, FnAbi};
77

88
use super::{
99
FloatBinOp, FloatUnaryOp, bin_op_simd_float_all, conditional_dot_product, convert_float_to_int,
@@ -17,7 +17,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1717
fn emulate_x86_avx_intrinsic(
1818
&mut self,
1919
link_name: Symbol,
20-
abi: ExternAbi,
20+
abi: &FnAbi<'tcx, Ty<'tcx>>,
2121
args: &[OpTy<'tcx>],
2222
dest: &MPlaceTy<'tcx>,
2323
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -34,7 +34,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
3434
// semantics.
3535
"min.ps.256" | "max.ps.256" => {
3636
let [left, right] =
37-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
37+
this.check_shim(abi, Conv::C, link_name, args)?;
3838

3939
let which = match unprefixed_name {
4040
"min.ps.256" => FloatBinOp::Min,
@@ -47,7 +47,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
4747
// Used to implement _mm256_min_pd and _mm256_max_pd functions.
4848
"min.pd.256" | "max.pd.256" => {
4949
let [left, right] =
50-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
50+
this.check_shim(abi, Conv::C, link_name, args)?;
5151

5252
let which = match unprefixed_name {
5353
"min.pd.256" => FloatBinOp::Min,
@@ -61,22 +61,22 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
6161
// Rounds the elements of `op` according to `rounding`.
6262
"round.ps.256" => {
6363
let [op, rounding] =
64-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
64+
this.check_shim(abi, Conv::C, link_name, args)?;
6565

6666
round_all::<rustc_apfloat::ieee::Single>(this, op, rounding, dest)?;
6767
}
6868
// Used to implement the _mm256_round_pd function.
6969
// Rounds the elements of `op` according to `rounding`.
7070
"round.pd.256" => {
7171
let [op, rounding] =
72-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
72+
this.check_shim(abi, Conv::C, link_name, args)?;
7373

7474
round_all::<rustc_apfloat::ieee::Double>(this, op, rounding, dest)?;
7575
}
7676
// Used to implement _mm256_{rcp,rsqrt}_ps functions.
7777
// Performs the operations on all components of `op`.
7878
"rcp.ps.256" | "rsqrt.ps.256" => {
79-
let [op] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
79+
let [op] = this.check_shim(abi, Conv::C, link_name, args)?;
8080

8181
let which = match unprefixed_name {
8282
"rcp.ps.256" => FloatUnaryOp::Rcp,
@@ -89,7 +89,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
8989
// Used to implement the _mm256_dp_ps function.
9090
"dp.ps.256" => {
9191
let [left, right, imm] =
92-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
92+
this.check_shim(abi, Conv::C, link_name, args)?;
9393

9494
conditional_dot_product(this, left, right, imm, dest)?;
9595
}
@@ -98,7 +98,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
9898
// in `left` and `right`.
9999
"hadd.ps.256" | "hadd.pd.256" | "hsub.ps.256" | "hsub.pd.256" => {
100100
let [left, right] =
101-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
101+
this.check_shim(abi, Conv::C, link_name, args)?;
102102

103103
let which = match unprefixed_name {
104104
"hadd.ps.256" | "hadd.pd.256" => mir::BinOp::Add,
@@ -114,7 +114,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
114114
// if true.
115115
"cmp.ps.256" => {
116116
let [left, right, imm] =
117-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
117+
this.check_shim(abi, Conv::C, link_name, args)?;
118118

119119
let which =
120120
FloatBinOp::cmp_from_imm(this, this.read_scalar(imm)?.to_i8()?, link_name)?;
@@ -127,7 +127,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
127127
// if true.
128128
"cmp.pd.256" => {
129129
let [left, right, imm] =
130-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
130+
this.check_shim(abi, Conv::C, link_name, args)?;
131131

132132
let which =
133133
FloatBinOp::cmp_from_imm(this, this.read_scalar(imm)?.to_i8()?, link_name)?;
@@ -138,7 +138,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
138138
// and _mm256_cvttpd_epi32 functions.
139139
// Converts packed f32/f64 to packed i32.
140140
"cvt.ps2dq.256" | "cvtt.ps2dq.256" | "cvt.pd2dq.256" | "cvtt.pd2dq.256" => {
141-
let [op] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
141+
let [op] = this.check_shim(abi, Conv::C, link_name, args)?;
142142

143143
let rnd = match unprefixed_name {
144144
// "current SSE rounding mode", assume nearest
@@ -157,7 +157,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
157157
// `control` determines which element of the current `data` array is written.
158158
"vpermilvar.ps" | "vpermilvar.ps.256" => {
159159
let [data, control] =
160-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
160+
this.check_shim(abi, Conv::C, link_name, args)?;
161161

162162
let (data, data_len) = this.project_to_simd(data)?;
163163
let (control, control_len) = this.project_to_simd(control)?;
@@ -191,7 +191,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
191191
// written.
192192
"vpermilvar.pd" | "vpermilvar.pd.256" => {
193193
let [data, control] =
194-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
194+
this.check_shim(abi, Conv::C, link_name, args)?;
195195

196196
let (data, data_len) = this.project_to_simd(data)?;
197197
let (control, control_len) = this.project_to_simd(control)?;
@@ -224,7 +224,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
224224
// zero, according to `imm`.
225225
"vperm2f128.ps.256" | "vperm2f128.pd.256" | "vperm2f128.si.256" => {
226226
let [left, right, imm] =
227-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
227+
this.check_shim(abi, Conv::C, link_name, args)?;
228228

229229
assert_eq!(dest.layout, left.layout);
230230
assert_eq!(dest.layout, right.layout);
@@ -268,7 +268,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
268268
// loaded.
269269
"maskload.ps" | "maskload.pd" | "maskload.ps.256" | "maskload.pd.256" => {
270270
let [ptr, mask] =
271-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
271+
this.check_shim(abi, Conv::C, link_name, args)?;
272272

273273
mask_load(this, ptr, mask, dest)?;
274274
}
@@ -279,7 +279,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
279279
// Unlike SSE2's _mm_maskmoveu_si128, these are not non-temporal stores.
280280
"maskstore.ps" | "maskstore.pd" | "maskstore.ps.256" | "maskstore.pd.256" => {
281281
let [ptr, mask, value] =
282-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
282+
this.check_shim(abi, Conv::C, link_name, args)?;
283283

284284
mask_store(this, ptr, mask, value)?;
285285
}
@@ -290,7 +290,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
290290
// unaligned read.
291291
"ldu.dq.256" => {
292292
let [src_ptr] =
293-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
293+
this.check_shim(abi, Conv::C, link_name, args)?;
294294
let src_ptr = this.read_pointer(src_ptr)?;
295295
let dest = dest.force_mplace(this)?;
296296

@@ -303,7 +303,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
303303
// `op & mask != 0 && op & mask != mask`
304304
"ptestz.256" | "ptestc.256" | "ptestnzc.256" => {
305305
let [op, mask] =
306-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
306+
this.check_shim(abi, Conv::C, link_name, args)?;
307307

308308
let (all_zero, masked_set) = test_bits_masked(this, op, mask)?;
309309
let res = match unprefixed_name {
@@ -327,7 +327,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
327327
| "vtestnzc.pd" | "vtestz.ps.256" | "vtestc.ps.256" | "vtestnzc.ps.256"
328328
| "vtestz.ps" | "vtestc.ps" | "vtestnzc.ps" => {
329329
let [op, mask] =
330-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
330+
this.check_shim(abi, Conv::C, link_name, args)?;
331331

332332
let (direct, negated) = test_high_bits_masked(this, op, mask)?;
333333
let res = match unprefixed_name {
@@ -349,7 +349,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
349349
// compiler, making these functions no-ops.
350350

351351
// The only thing that needs to be ensured is the correct calling convention.
352-
let [] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
352+
let [] = this.check_shim(abi, Conv::C, link_name, args)?;
353353
}
354354
_ => return interp_ok(EmulateItemResult::NotSupported),
355355
}

‎src/tools/miri/src/shims/x86/avx2.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use rustc_abi::ExternAbi;
21
use rustc_middle::mir;
32
use rustc_middle::ty::Ty;
43
use rustc_middle::ty::layout::LayoutOf as _;
54
use rustc_span::Symbol;
5+
use rustc_target::callconv::{Conv, FnAbi};
66

77
use super::{
88
ShiftOp, horizontal_bin_op, int_abs, mask_load, mask_store, mpsadbw, packssdw, packsswb,
@@ -15,7 +15,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1515
fn emulate_x86_avx2_intrinsic(
1616
&mut self,
1717
link_name: Symbol,
18-
abi: ExternAbi,
18+
abi: &FnAbi<'tcx, Ty<'tcx>>,
1919
args: &[OpTy<'tcx>],
2020
dest: &MPlaceTy<'tcx>,
2121
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -28,7 +28,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
2828
// Used to implement the _mm256_abs_epi{8,16,32} functions.
2929
// Calculates the absolute value of packed 8/16/32-bit integers.
3030
"pabs.b" | "pabs.w" | "pabs.d" => {
31-
let [op] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
31+
let [op] = this.check_shim(abi, Conv::C, link_name, args)?;
3232

3333
int_abs(this, op, dest)?;
3434
}
@@ -37,7 +37,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
3737
// integer values in `left` and `right`.
3838
"phadd.w" | "phadd.sw" | "phadd.d" | "phsub.w" | "phsub.sw" | "phsub.d" => {
3939
let [left, right] =
40-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
40+
this.check_shim(abi, Conv::C, link_name, args)?;
4141

4242
let (which, saturating) = match unprefixed_name {
4343
"phadd.w" | "phadd.d" => (mir::BinOp::Add, false),
@@ -58,7 +58,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
5858
| "gather.d.pd.256" | "gather.q.pd" | "gather.q.pd.256" | "gather.d.ps"
5959
| "gather.d.ps.256" | "gather.q.ps" | "gather.q.ps.256" => {
6060
let [src, slice, offsets, mask, scale] =
61-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
61+
this.check_shim(abi, Conv::C, link_name, args)?;
6262

6363
assert_eq!(dest.layout, src.layout);
6464

@@ -116,7 +116,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
116116
// intermediate 32-bit integers, and pack the results in `dest`.
117117
"pmadd.wd" => {
118118
let [left, right] =
119-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
119+
this.check_shim(abi, Conv::C, link_name, args)?;
120120

121121
let (left, left_len) = this.project_to_simd(left)?;
122122
let (right, right_len) = this.project_to_simd(right)?;
@@ -153,7 +153,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
153153
// produces the output at index `i`.
154154
"pmadd.ub.sw" => {
155155
let [left, right] =
156-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
156+
this.check_shim(abi, Conv::C, link_name, args)?;
157157

158158
let (left, left_len) = this.project_to_simd(left)?;
159159
let (right, right_len) = this.project_to_simd(right)?;
@@ -188,7 +188,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
188188
// loaded.
189189
"maskload.d" | "maskload.q" | "maskload.d.256" | "maskload.q.256" => {
190190
let [ptr, mask] =
191-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
191+
this.check_shim(abi, Conv::C, link_name, args)?;
192192

193193
mask_load(this, ptr, mask, dest)?;
194194
}
@@ -199,7 +199,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
199199
// Unlike SSE2's _mm_maskmoveu_si128, these are not non-temporal stores.
200200
"maskstore.d" | "maskstore.q" | "maskstore.d.256" | "maskstore.q.256" => {
201201
let [ptr, mask, value] =
202-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
202+
this.check_shim(abi, Conv::C, link_name, args)?;
203203

204204
mask_store(this, ptr, mask, value)?;
205205
}
@@ -211,7 +211,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
211211
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_mpsadbw_epu8
212212
"mpsadbw" => {
213213
let [left, right, imm] =
214-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
214+
this.check_shim(abi, Conv::C, link_name, args)?;
215215

216216
mpsadbw(this, left, right, imm, dest)?;
217217
}
@@ -223,7 +223,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
223223
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_mulhrs_epi16
224224
"pmul.hr.sw" => {
225225
let [left, right] =
226-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
226+
this.check_shim(abi, Conv::C, link_name, args)?;
227227

228228
pmulhrsw(this, left, right, dest)?;
229229
}
@@ -232,7 +232,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
232232
// vector with signed saturation.
233233
"packsswb" => {
234234
let [left, right] =
235-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
235+
this.check_shim(abi, Conv::C, link_name, args)?;
236236

237237
packsswb(this, left, right, dest)?;
238238
}
@@ -241,7 +241,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
241241
// vector with signed saturation.
242242
"packssdw" => {
243243
let [left, right] =
244-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
244+
this.check_shim(abi, Conv::C, link_name, args)?;
245245

246246
packssdw(this, left, right, dest)?;
247247
}
@@ -250,7 +250,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
250250
// unsigned integer vector with saturation.
251251
"packuswb" => {
252252
let [left, right] =
253-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
253+
this.check_shim(abi, Conv::C, link_name, args)?;
254254

255255
packuswb(this, left, right, dest)?;
256256
}
@@ -259,7 +259,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
259259
// the result to a 16-bit unsigned integer vector with saturation.
260260
"packusdw" => {
261261
let [left, right] =
262-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
262+
this.check_shim(abi, Conv::C, link_name, args)?;
263263

264264
packusdw(this, left, right, dest)?;
265265
}
@@ -269,7 +269,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
269269
// as indices.
270270
"permd" | "permps" => {
271271
let [left, right] =
272-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
272+
this.check_shim(abi, Conv::C, link_name, args)?;
273273

274274
let (left, left_len) = this.project_to_simd(left)?;
275275
let (right, right_len) = this.project_to_simd(right)?;
@@ -290,7 +290,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
290290
// Shuffles 128-bit blocks of `a` and `b` using `imm` as pattern.
291291
"vperm2i128" => {
292292
let [left, right, imm] =
293-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
293+
this.check_shim(abi, Conv::C, link_name, args)?;
294294

295295
assert_eq!(left.layout.size.bits(), 256);
296296
assert_eq!(right.layout.size.bits(), 256);
@@ -328,7 +328,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
328328
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm256_sad_epu8
329329
"psad.bw" => {
330330
let [left, right] =
331-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
331+
this.check_shim(abi, Conv::C, link_name, args)?;
332332

333333
let (left, left_len) = this.project_to_simd(left)?;
334334
let (right, right_len) = this.project_to_simd(right)?;
@@ -361,7 +361,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
361361
// Each 128-bit block is shuffled independently.
362362
"pshuf.b" => {
363363
let [left, right] =
364-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
364+
this.check_shim(abi, Conv::C, link_name, args)?;
365365

366366
let (left, left_len) = this.project_to_simd(left)?;
367367
let (right, right_len) = this.project_to_simd(right)?;
@@ -393,7 +393,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
393393
// Basically, we multiply `left` with `right.signum()`.
394394
"psign.b" | "psign.w" | "psign.d" => {
395395
let [left, right] =
396-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
396+
this.check_shim(abi, Conv::C, link_name, args)?;
397397

398398
psign(this, left, right, dest)?;
399399
}
@@ -408,7 +408,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
408408
"psll.w" | "psrl.w" | "psra.w" | "psll.d" | "psrl.d" | "psra.d" | "psll.q"
409409
| "psrl.q" => {
410410
let [left, right] =
411-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
411+
this.check_shim(abi, Conv::C, link_name, args)?;
412412

413413
let which = match unprefixed_name {
414414
"psll.w" | "psll.d" | "psll.q" => ShiftOp::Left,
@@ -424,7 +424,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
424424
"psllv.d" | "psllv.d.256" | "psllv.q" | "psllv.q.256" | "psrlv.d" | "psrlv.d.256"
425425
| "psrlv.q" | "psrlv.q.256" | "psrav.d" | "psrav.d.256" => {
426426
let [left, right] =
427-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
427+
this.check_shim(abi, Conv::C, link_name, args)?;
428428

429429
let which = match unprefixed_name {
430430
"psllv.d" | "psllv.d.256" | "psllv.q" | "psllv.q.256" => ShiftOp::Left,

‎src/tools/miri/src/shims/x86/bmi.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
use rustc_abi::ExternAbi;
21
use rustc_span::Symbol;
2+
use rustc_middle::ty::Ty;
3+
use rustc_target::callconv::{Conv, FnAbi};
34

45
use crate::*;
56

@@ -8,7 +9,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
89
fn emulate_x86_bmi_intrinsic(
910
&mut self,
1011
link_name: Symbol,
11-
abi: ExternAbi,
12+
abi: &FnAbi<'tcx, Ty<'tcx>>,
1213
args: &[OpTy<'tcx>],
1314
dest: &MPlaceTy<'tcx>,
1415
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -34,7 +35,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
3435
}
3536

3637
let [left, right] =
37-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
38+
this.check_shim(abi, Conv::C, link_name, args)?;
3839
let left = this.read_scalar(left)?;
3940
let right = this.read_scalar(right)?;
4041

‎src/tools/miri/src/shims/x86/gfni.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
use rustc_abi::ExternAbi;
21
use rustc_span::Symbol;
2+
use rustc_middle::ty::Ty;
3+
use rustc_target::callconv::{Conv, FnAbi};
34

45
use crate::*;
56

@@ -8,7 +9,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
89
fn emulate_x86_gfni_intrinsic(
910
&mut self,
1011
link_name: Symbol,
11-
abi: ExternAbi,
12+
abi: &FnAbi<'tcx, Ty<'tcx>>,
1213
args: &[OpTy<'tcx>],
1314
dest: &MPlaceTy<'tcx>,
1415
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -30,15 +31,15 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
3031
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=gf2p8affine_
3132
"vgf2p8affineqb.128" | "vgf2p8affineqb.256" | "vgf2p8affineqb.512" => {
3233
let [left, right, imm8] =
33-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
34+
this.check_shim(abi, Conv::C, link_name, args)?;
3435
affine_transform(this, left, right, imm8, dest, /* inverse */ false)?;
3536
}
3637
// Used to implement the `_mm{, 256, 512}_gf2p8affineinv_epi64_epi8` functions.
3738
// See `affine_transform` for details.
3839
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=gf2p8affineinv
3940
"vgf2p8affineinvqb.128" | "vgf2p8affineinvqb.256" | "vgf2p8affineinvqb.512" => {
4041
let [left, right, imm8] =
41-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
42+
this.check_shim(abi, Conv::C, link_name, args)?;
4243
affine_transform(this, left, right, imm8, dest, /* inverse */ true)?;
4344
}
4445
// Used to implement the `_mm{, 256, 512}_gf2p8mul_epi8` functions.
@@ -48,8 +49,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
4849
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=gf2p8mul
4950
"vgf2p8mulb.128" | "vgf2p8mulb.256" | "vgf2p8mulb.512" => {
5051
let [left, right] =
51-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
52-
52+
this.check_shim(abi, Conv::C, link_name, args)?;
5353
let (left, left_len) = this.project_to_simd(left)?;
5454
let (right, right_len) = this.project_to_simd(right)?;
5555
let (dest, dest_len) = this.project_to_simd(dest)?;

‎src/tools/miri/src/shims/x86/mod.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
use rustc_abi::{ExternAbi, Size};
1+
use rustc_abi::Size;
22
use rustc_apfloat::Float;
33
use rustc_apfloat::ieee::Single;
44
use rustc_middle::ty::Ty;
55
use rustc_middle::ty::layout::LayoutOf as _;
66
use rustc_middle::{mir, ty};
77
use rustc_span::Symbol;
8+
use rustc_target::callconv::{Conv, FnAbi};
89

910
use self::helpers::bool_to_simd_element;
1011
use crate::*;
@@ -27,7 +28,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
2728
fn emulate_x86_intrinsic(
2829
&mut self,
2930
link_name: Symbol,
30-
abi: ExternAbi,
31+
abi: &FnAbi<'tcx, Ty<'tcx>>,
3132
args: &[OpTy<'tcx>],
3233
dest: &MPlaceTy<'tcx>,
3334
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -45,8 +46,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
4546
return interp_ok(EmulateItemResult::NotSupported);
4647
}
4748

48-
let [cb_in, a, b] = this.check_shim(abi, ExternAbi::Unadjusted, link_name, args)?;
49-
49+
let [cb_in, a, b] = this.check_shim(abi, Conv::C, link_name, args)?;
5050
let op = if unprefixed_name.starts_with("add") {
5151
mir::BinOp::AddWithOverflow
5252
} else {
@@ -68,9 +68,8 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
6868
if is_u64 && this.tcx.sess.target.arch != "x86_64" {
6969
return interp_ok(EmulateItemResult::NotSupported);
7070
}
71-
7271
let [c_in, a, b, out] =
73-
this.check_shim(abi, ExternAbi::Unadjusted, link_name, args)?;
72+
this.check_shim(abi, Conv::C, link_name, args)?;
7473
let out = this.deref_pointer_as(
7574
out,
7675
if is_u64 { this.machine.layouts.u64 } else { this.machine.layouts.u32 },
@@ -87,7 +86,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
8786
// the instruction behaves like a no-op, so it is always safe to call the
8887
// intrinsic.
8988
"sse2.pause" => {
90-
let [] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
89+
let [] = this.check_shim(abi, Conv::C, link_name, args)?;
9190
// Only exhibit the spin-loop hint behavior when SSE2 is enabled.
9291
if this.tcx.sess.unstable_target_features.contains(&Symbol::intern("sse2")) {
9392
this.yield_active_thread();
@@ -107,7 +106,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
107106
}
108107

109108
let [left, right, imm] =
110-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
109+
this.check_shim(abi, Conv::C, link_name, args)?;
111110

112111
pclmulqdq(this, left, right, imm, dest, len)?;
113112
}

‎src/tools/miri/src/shims/x86/sha.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
//!
55
//! [RustCrypto's sha256 module]: https://github.com/RustCrypto/hashes/blob/6be8466247e936c415d8aafb848697f39894a386/sha2/src/sha256/soft.rs
66
7-
use rustc_abi::ExternAbi;
7+
use rustc_middle::ty::Ty;
88
use rustc_span::Symbol;
9+
use rustc_target::callconv::{Conv, FnAbi};
910

1011
use crate::*;
1112

@@ -14,7 +15,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1415
fn emulate_x86_sha_intrinsic(
1516
&mut self,
1617
link_name: Symbol,
17-
abi: ExternAbi,
18+
abi: &FnAbi<'tcx, Ty<'tcx>>,
1819
args: &[OpTy<'tcx>],
1920
dest: &MPlaceTy<'tcx>,
2021
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -52,7 +53,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
5253
// Used to implement the _mm_sha256rnds2_epu32 function.
5354
"256rnds2" => {
5455
let [a, b, k] =
55-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
56+
this.check_shim(abi, Conv::C, link_name, args)?;
5657

5758
let (a_reg, a_len) = this.project_to_simd(a)?;
5859
let (b_reg, b_len) = this.project_to_simd(b)?;
@@ -74,7 +75,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
7475
// Used to implement the _mm_sha256msg1_epu32 function.
7576
"256msg1" => {
7677
let [a, b] =
77-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
78+
this.check_shim(abi, Conv::C, link_name, args)?;
7879

7980
let (a_reg, a_len) = this.project_to_simd(a)?;
8081
let (b_reg, b_len) = this.project_to_simd(b)?;
@@ -93,7 +94,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
9394
// Used to implement the _mm_sha256msg2_epu32 function.
9495
"256msg2" => {
9596
let [a, b] =
96-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
97+
this.check_shim(abi, Conv::C, link_name, args)?;
9798

9899
let (a_reg, a_len) = this.project_to_simd(a)?;
99100
let (b_reg, b_len) = this.project_to_simd(b)?;

‎src/tools/miri/src/shims/x86/sse.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use rustc_abi::ExternAbi;
21
use rustc_apfloat::ieee::Single;
2+
use rustc_middle::ty::Ty;
33
use rustc_span::Symbol;
4+
use rustc_target::callconv::{Conv, FnAbi};
45

56
use super::{
67
FloatBinOp, FloatUnaryOp, bin_op_simd_float_all, bin_op_simd_float_first, unary_op_ps,
@@ -13,7 +14,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1314
fn emulate_x86_sse_intrinsic(
1415
&mut self,
1516
link_name: Symbol,
16-
abi: ExternAbi,
17+
abi: &FnAbi<'tcx, Ty<'tcx>>,
1718
args: &[OpTy<'tcx>],
1819
dest: &MPlaceTy<'tcx>,
1920
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -33,7 +34,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
3334
// `right` and copies the remaining components from `left`.
3435
"min.ss" | "max.ss" => {
3536
let [left, right] =
36-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
37+
this.check_shim(abi, Conv::C, link_name, args)?;
3738

3839
let which = match unprefixed_name {
3940
"min.ss" => FloatBinOp::Min,
@@ -50,7 +51,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
5051
// semantics.
5152
"min.ps" | "max.ps" => {
5253
let [left, right] =
53-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
54+
this.check_shim(abi, Conv::C, link_name, args)?;
5455

5556
let which = match unprefixed_name {
5657
"min.ps" => FloatBinOp::Min,
@@ -64,7 +65,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
6465
// Performs the operations on the first component of `op` and
6566
// copies the remaining components from `op`.
6667
"rcp.ss" | "rsqrt.ss" => {
67-
let [op] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
68+
let [op] = this.check_shim(abi, Conv::C, link_name, args)?;
6869

6970
let which = match unprefixed_name {
7071
"rcp.ss" => FloatUnaryOp::Rcp,
@@ -77,7 +78,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
7778
// Used to implement _mm_{sqrt,rcp,rsqrt}_ps functions.
7879
// Performs the operations on all components of `op`.
7980
"rcp.ps" | "rsqrt.ps" => {
80-
let [op] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
81+
let [op] = this.check_shim(abi, Conv::C, link_name, args)?;
8182

8283
let which = match unprefixed_name {
8384
"rcp.ps" => FloatUnaryOp::Rcp,
@@ -97,7 +98,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
9798
// with hard-coded operations.
9899
"cmp.ss" => {
99100
let [left, right, imm] =
100-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
101+
this.check_shim(abi, Conv::C, link_name, args)?;
101102

102103
let which =
103104
FloatBinOp::cmp_from_imm(this, this.read_scalar(imm)?.to_i8()?, link_name)?;
@@ -114,7 +115,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
114115
// with hard-coded operations.
115116
"cmp.ps" => {
116117
let [left, right, imm] =
117-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
118+
this.check_shim(abi, Conv::C, link_name, args)?;
118119

119120
let which =
120121
FloatBinOp::cmp_from_imm(this, this.read_scalar(imm)?.to_i8()?, link_name)?;
@@ -128,7 +129,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
128129
| "ucomieq.ss" | "ucomilt.ss" | "ucomile.ss" | "ucomigt.ss" | "ucomige.ss"
129130
| "ucomineq.ss" => {
130131
let [left, right] =
131-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
132+
this.check_shim(abi, Conv::C, link_name, args)?;
132133

133134
let (left, left_len) = this.project_to_simd(left)?;
134135
let (right, right_len) = this.project_to_simd(right)?;
@@ -156,7 +157,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
156157
// _mm_cvtss_si64 and _mm_cvttss_si64 functions.
157158
// Converts the first component of `op` from f32 to i32/i64.
158159
"cvtss2si" | "cvttss2si" | "cvtss2si64" | "cvttss2si64" => {
159-
let [op] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
160+
let [op] = this.check_shim(abi, Conv::C, link_name, args)?;
160161
let (op, _) = this.project_to_simd(op)?;
161162

162163
let op = this.read_immediate(&this.project_index(&op, 0)?)?;
@@ -185,7 +186,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
185186
// https://www.felixcloutier.com/x86/cvtsi2ss
186187
"cvtsi2ss" | "cvtsi642ss" => {
187188
let [left, right] =
188-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
189+
this.check_shim(abi, Conv::C, link_name, args)?;
189190

190191
let (left, left_len) = this.project_to_simd(left)?;
191192
let (dest, dest_len) = this.project_to_simd(dest)?;

‎src/tools/miri/src/shims/x86/sse2.rs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use rustc_abi::ExternAbi;
21
use rustc_apfloat::ieee::Double;
2+
use rustc_middle::ty::Ty;
33
use rustc_span::Symbol;
4+
use rustc_target::callconv::{Conv, FnAbi};
45

56
use super::{
67
FloatBinOp, ShiftOp, bin_op_simd_float_all, bin_op_simd_float_first, convert_float_to_int,
@@ -13,7 +14,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1314
fn emulate_x86_sse2_intrinsic(
1415
&mut self,
1516
link_name: Symbol,
16-
abi: ExternAbi,
17+
abi: &FnAbi<'tcx, Ty<'tcx>>,
1718
args: &[OpTy<'tcx>],
1819
dest: &MPlaceTy<'tcx>,
1920
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -40,7 +41,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
4041
// intermediate 32-bit integers, and pack the results in `dest`.
4142
"pmadd.wd" => {
4243
let [left, right] =
43-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
44+
this.check_shim(abi, Conv::C, link_name, args)?;
4445

4546
let (left, left_len) = this.project_to_simd(left)?;
4647
let (right, right_len) = this.project_to_simd(right)?;
@@ -79,7 +80,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
7980
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_sad_epu8
8081
"psad.bw" => {
8182
let [left, right] =
82-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
83+
this.check_shim(abi, Conv::C, link_name, args)?;
8384

8485
let (left, left_len) = this.project_to_simd(left)?;
8586
let (right, right_len) = this.project_to_simd(right)?;
@@ -118,7 +119,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
118119
"psll.w" | "psrl.w" | "psra.w" | "psll.d" | "psrl.d" | "psra.d" | "psll.q"
119120
| "psrl.q" => {
120121
let [left, right] =
121-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
122+
this.check_shim(abi, Conv::C, link_name, args)?;
122123

123124
let which = match unprefixed_name {
124125
"psll.w" | "psll.d" | "psll.q" => ShiftOp::Left,
@@ -133,7 +134,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
133134
// and _mm_cvttpd_epi32 functions.
134135
// Converts packed f32/f64 to packed i32.
135136
"cvtps2dq" | "cvttps2dq" | "cvtpd2dq" | "cvttpd2dq" => {
136-
let [op] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
137+
let [op] = this.check_shim(abi, Conv::C, link_name, args)?;
137138

138139
let (op_len, _) = op.layout.ty.simd_size_and_type(*this.tcx);
139140
let (dest_len, _) = dest.layout.ty.simd_size_and_type(*this.tcx);
@@ -171,7 +172,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
171172
// vector with signed saturation.
172173
"packsswb.128" => {
173174
let [left, right] =
174-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
175+
this.check_shim(abi, Conv::C, link_name, args)?;
175176

176177
packsswb(this, left, right, dest)?;
177178
}
@@ -180,7 +181,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
180181
// unsigned integer vector with saturation.
181182
"packuswb.128" => {
182183
let [left, right] =
183-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
184+
this.check_shim(abi, Conv::C, link_name, args)?;
184185

185186
packuswb(this, left, right, dest)?;
186187
}
@@ -189,7 +190,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
189190
// vector with signed saturation.
190191
"packssdw.128" => {
191192
let [left, right] =
192-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
193+
this.check_shim(abi, Conv::C, link_name, args)?;
193194

194195
packssdw(this, left, right, dest)?;
195196
}
@@ -200,7 +201,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
200201
// semantics.
201202
"min.sd" | "max.sd" => {
202203
let [left, right] =
203-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
204+
this.check_shim(abi, Conv::C, link_name, args)?;
204205

205206
let which = match unprefixed_name {
206207
"min.sd" => FloatBinOp::Min,
@@ -217,7 +218,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
217218
// semantics.
218219
"min.pd" | "max.pd" => {
219220
let [left, right] =
220-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
221+
this.check_shim(abi, Conv::C, link_name, args)?;
221222

222223
let which = match unprefixed_name {
223224
"min.pd" => FloatBinOp::Min,
@@ -237,7 +238,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
237238
// with hard-coded operations.
238239
"cmp.sd" => {
239240
let [left, right, imm] =
240-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
241+
this.check_shim(abi, Conv::C, link_name, args)?;
241242

242243
let which =
243244
FloatBinOp::cmp_from_imm(this, this.read_scalar(imm)?.to_i8()?, link_name)?;
@@ -254,7 +255,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
254255
// with hard-coded operations.
255256
"cmp.pd" => {
256257
let [left, right, imm] =
257-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
258+
this.check_shim(abi, Conv::C, link_name, args)?;
258259

259260
let which =
260261
FloatBinOp::cmp_from_imm(this, this.read_scalar(imm)?.to_i8()?, link_name)?;
@@ -268,7 +269,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
268269
| "ucomieq.sd" | "ucomilt.sd" | "ucomile.sd" | "ucomigt.sd" | "ucomige.sd"
269270
| "ucomineq.sd" => {
270271
let [left, right] =
271-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
272+
this.check_shim(abi, Conv::C, link_name, args)?;
272273

273274
let (left, left_len) = this.project_to_simd(left)?;
274275
let (right, right_len) = this.project_to_simd(right)?;
@@ -296,7 +297,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
296297
// _mm_cvtsd_si64 and _mm_cvttsd_si64 functions.
297298
// Converts the first component of `op` from f64 to i32/i64.
298299
"cvtsd2si" | "cvttsd2si" | "cvtsd2si64" | "cvttsd2si64" => {
299-
let [op] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
300+
let [op] = this.check_shim(abi, Conv::C, link_name, args)?;
300301
let (op, _) = this.project_to_simd(op)?;
301302

302303
let op = this.read_immediate(&this.project_index(&op, 0)?)?;
@@ -323,7 +324,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
323324
// the remaining elements from `left`
324325
"cvtsd2ss" | "cvtss2sd" => {
325326
let [left, right] =
326-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
327+
this.check_shim(abi, Conv::C, link_name, args)?;
327328

328329
let (left, left_len) = this.project_to_simd(left)?;
329330
let (right, _) = this.project_to_simd(right)?;

‎src/tools/miri/src/shims/x86/sse3.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use rustc_abi::ExternAbi;
21
use rustc_middle::mir;
2+
use rustc_middle::ty::Ty;
33
use rustc_span::Symbol;
4+
use rustc_target::callconv::{Conv, FnAbi};
45

56
use super::horizontal_bin_op;
67
use crate::*;
@@ -10,7 +11,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1011
fn emulate_x86_sse3_intrinsic(
1112
&mut self,
1213
link_name: Symbol,
13-
abi: ExternAbi,
14+
abi: &FnAbi<'tcx, Ty<'tcx>>,
1415
args: &[OpTy<'tcx>],
1516
dest: &MPlaceTy<'tcx>,
1617
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -25,7 +26,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
2526
// in `left` and `right`.
2627
"hadd.ps" | "hadd.pd" | "hsub.ps" | "hsub.pd" => {
2728
let [left, right] =
28-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
29+
this.check_shim(abi, Conv::C, link_name, args)?;
2930

3031
let which = match unprefixed_name {
3132
"hadd.ps" | "hadd.pd" => mir::BinOp::Add,
@@ -42,7 +43,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
4243
// unaligned read.
4344
"ldu.dq" => {
4445
let [src_ptr] =
45-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
46+
this.check_shim(abi, Conv::C, link_name, args)?;
4647
let src_ptr = this.read_pointer(src_ptr)?;
4748
let dest = dest.force_mplace(this)?;
4849

‎src/tools/miri/src/shims/x86/sse41.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
use rustc_abi::ExternAbi;
1+
use rustc_middle::ty::Ty;
22
use rustc_span::Symbol;
3+
use rustc_target::callconv::{Conv, FnAbi};
34

45
use super::{conditional_dot_product, mpsadbw, packusdw, round_all, round_first, test_bits_masked};
56
use crate::*;
@@ -9,7 +10,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
910
fn emulate_x86_sse41_intrinsic(
1011
&mut self,
1112
link_name: Symbol,
12-
abi: ExternAbi,
13+
abi: &FnAbi<'tcx, Ty<'tcx>>,
1314
args: &[OpTy<'tcx>],
1415
dest: &MPlaceTy<'tcx>,
1516
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -27,7 +28,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
2728
// `i` is zeroed.
2829
"insertps" => {
2930
let [left, right, imm] =
30-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
31+
this.check_shim(abi, Conv::C, link_name, args)?;
3132

3233
let (left, left_len) = this.project_to_simd(left)?;
3334
let (right, right_len) = this.project_to_simd(right)?;
@@ -63,7 +64,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
6364
// the result to a 16-bit unsigned integer vector with saturation.
6465
"packusdw" => {
6566
let [left, right] =
66-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
67+
this.check_shim(abi, Conv::C, link_name, args)?;
6768

6869
packusdw(this, left, right, dest)?;
6970
}
@@ -74,7 +75,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
7475
// 4 bits of `imm`.
7576
"dpps" | "dppd" => {
7677
let [left, right, imm] =
77-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
78+
this.check_shim(abi, Conv::C, link_name, args)?;
7879

7980
conditional_dot_product(this, left, right, imm, dest)?;
8081
}
@@ -83,15 +84,15 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
8384
// and copies the remaining elements from `left`.
8485
"round.ss" => {
8586
let [left, right, rounding] =
86-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
87+
this.check_shim(abi, Conv::C, link_name, args)?;
8788

8889
round_first::<rustc_apfloat::ieee::Single>(this, left, right, rounding, dest)?;
8990
}
9091
// Used to implement the _mm_floor_ps, _mm_ceil_ps and _mm_round_ps
9192
// functions. Rounds the elements of `op` according to `rounding`.
9293
"round.ps" => {
9394
let [op, rounding] =
94-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
95+
this.check_shim(abi, Conv::C, link_name, args)?;
9596

9697
round_all::<rustc_apfloat::ieee::Single>(this, op, rounding, dest)?;
9798
}
@@ -100,23 +101,23 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
100101
// and copies the remaining elements from `left`.
101102
"round.sd" => {
102103
let [left, right, rounding] =
103-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
104+
this.check_shim(abi, Conv::C, link_name, args)?;
104105

105106
round_first::<rustc_apfloat::ieee::Double>(this, left, right, rounding, dest)?;
106107
}
107108
// Used to implement the _mm_floor_pd, _mm_ceil_pd and _mm_round_pd
108109
// functions. Rounds the elements of `op` according to `rounding`.
109110
"round.pd" => {
110111
let [op, rounding] =
111-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
112+
this.check_shim(abi, Conv::C, link_name, args)?;
112113

113114
round_all::<rustc_apfloat::ieee::Double>(this, op, rounding, dest)?;
114115
}
115116
// Used to implement the _mm_minpos_epu16 function.
116117
// Find the minimum unsinged 16-bit integer in `op` and
117118
// returns its value and position.
118119
"phminposuw" => {
119-
let [op] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
120+
let [op] = this.check_shim(abi, Conv::C, link_name, args)?;
120121

121122
let (op, op_len) = this.project_to_simd(op)?;
122123
let (dest, dest_len) = this.project_to_simd(dest)?;
@@ -151,7 +152,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
151152
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mpsadbw_epu8
152153
"mpsadbw" => {
153154
let [left, right, imm] =
154-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
155+
this.check_shim(abi, Conv::C, link_name, args)?;
155156

156157
mpsadbw(this, left, right, imm, dest)?;
157158
}
@@ -161,7 +162,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
161162
// `(op & mask) != 0 && (op & mask) != mask`
162163
"ptestz" | "ptestc" | "ptestnzc" => {
163164
let [op, mask] =
164-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
165+
this.check_shim(abi, Conv::C, link_name, args)?;
165166

166167
let (all_zero, masked_set) = test_bits_masked(this, op, mask)?;
167168
let res = match unprefixed_name {

‎src/tools/miri/src/shims/x86/sse42.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
use rustc_abi::{ExternAbi, Size};
1+
use rustc_abi::Size;
22
use rustc_middle::mir;
33
use rustc_middle::ty::Ty;
44
use rustc_middle::ty::layout::LayoutOf as _;
55
use rustc_span::Symbol;
6+
use rustc_target::callconv::{Conv, FnAbi};
67

78
use crate::*;
89

@@ -200,7 +201,7 @@ fn deconstruct_args<'tcx>(
200201
unprefixed_name: &str,
201202
ecx: &mut MiriInterpCx<'tcx>,
202203
link_name: Symbol,
203-
abi: ExternAbi,
204+
abi: &FnAbi<'tcx, Ty<'tcx>>,
204205
args: &[OpTy<'tcx>],
205206
) -> InterpResult<'tcx, (OpTy<'tcx>, OpTy<'tcx>, Option<(u64, u64)>, u8)> {
206207
let array_layout_fn = |ecx: &mut MiriInterpCx<'tcx>, imm: u8| {
@@ -223,7 +224,7 @@ fn deconstruct_args<'tcx>(
223224

224225
if is_explicit {
225226
let [str1, len1, str2, len2, imm] =
226-
ecx.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
227+
ecx.check_shim(abi, Conv::C, link_name, args)?;
227228
let imm = ecx.read_scalar(imm)?.to_u8()?;
228229

229230
let default_len = default_len::<u32>(imm);
@@ -237,7 +238,7 @@ fn deconstruct_args<'tcx>(
237238
interp_ok((str1, str2, Some((len1, len2)), imm))
238239
} else {
239240
let [str1, str2, imm] =
240-
ecx.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
241+
ecx.check_shim(abi, Conv::C, link_name, args)?;
241242
let imm = ecx.read_scalar(imm)?.to_u8()?;
242243

243244
let array_layout = array_layout_fn(ecx, imm)?;
@@ -279,7 +280,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
279280
fn emulate_x86_sse42_intrinsic(
280281
&mut self,
281282
link_name: Symbol,
282-
abi: ExternAbi,
283+
abi: &FnAbi<'tcx, Ty<'tcx>>,
283284
args: &[OpTy<'tcx>],
284285
dest: &MPlaceTy<'tcx>,
285286
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -388,7 +389,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
388389
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#ig_expand=924,925
389390
"pcmpistriz128" | "pcmpistris128" => {
390391
let [str1, str2, imm] =
391-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
392+
this.check_shim(abi, Conv::C, link_name, args)?;
392393
let imm = this.read_scalar(imm)?.to_u8()?;
393394

394395
let str = if unprefixed_name == "pcmpistris128" { str1 } else { str2 };
@@ -409,7 +410,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
409410
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#ig_expand=1046,1047
410411
"pcmpestriz128" | "pcmpestris128" => {
411412
let [_, len1, _, len2, imm] =
412-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
413+
this.check_shim(abi, Conv::C, link_name, args)?;
413414
let len = if unprefixed_name == "pcmpestris128" { len1 } else { len2 };
414415
let len = this.read_scalar(len)?.to_i32()?;
415416
let imm = this.read_scalar(imm)?.to_u8()?;
@@ -437,7 +438,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
437438
}
438439

439440
let [left, right] =
440-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
441+
this.check_shim(abi, Conv::C, link_name, args)?;
441442
let left = this.read_scalar(left)?;
442443
let right = this.read_scalar(right)?;
443444

‎src/tools/miri/src/shims/x86/ssse3.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use rustc_abi::ExternAbi;
21
use rustc_middle::mir;
2+
use rustc_middle::ty::Ty;
33
use rustc_span::Symbol;
4+
use rustc_target::callconv::{Conv, FnAbi};
45

56
use super::{horizontal_bin_op, int_abs, pmulhrsw, psign};
67
use crate::*;
@@ -10,7 +11,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
1011
fn emulate_x86_ssse3_intrinsic(
1112
&mut self,
1213
link_name: Symbol,
13-
abi: ExternAbi,
14+
abi: &FnAbi<'tcx, Ty<'tcx>>,
1415
args: &[OpTy<'tcx>],
1516
dest: &MPlaceTy<'tcx>,
1617
) -> InterpResult<'tcx, EmulateItemResult> {
@@ -23,7 +24,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
2324
// Used to implement the _mm_abs_epi{8,16,32} functions.
2425
// Calculates the absolute value of packed 8/16/32-bit integers.
2526
"pabs.b.128" | "pabs.w.128" | "pabs.d.128" => {
26-
let [op] = this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
27+
let [op] = this.check_shim(abi, Conv::C, link_name, args)?;
2728

2829
int_abs(this, op, dest)?;
2930
}
@@ -32,7 +33,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
3233
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_shuffle_epi8
3334
"pshuf.b.128" => {
3435
let [left, right] =
35-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
36+
this.check_shim(abi, Conv::C, link_name, args)?;
3637

3738
let (left, left_len) = this.project_to_simd(left)?;
3839
let (right, right_len) = this.project_to_simd(right)?;
@@ -62,7 +63,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
6263
"phadd.w.128" | "phadd.sw.128" | "phadd.d.128" | "phsub.w.128" | "phsub.sw.128"
6364
| "phsub.d.128" => {
6465
let [left, right] =
65-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
66+
this.check_shim(abi, Conv::C, link_name, args)?;
6667

6768
let (which, saturating) = match unprefixed_name {
6869
"phadd.w.128" | "phadd.d.128" => (mir::BinOp::Add, false),
@@ -82,7 +83,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
8283
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_maddubs_epi16
8384
"pmadd.ub.sw.128" => {
8485
let [left, right] =
85-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
86+
this.check_shim(abi, Conv::C, link_name, args)?;
8687

8788
let (left, left_len) = this.project_to_simd(left)?;
8889
let (right, right_len) = this.project_to_simd(right)?;
@@ -118,7 +119,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
118119
// https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_mulhrs_epi16
119120
"pmul.hr.sw.128" => {
120121
let [left, right] =
121-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
122+
this.check_shim(abi, Conv::C, link_name, args)?;
122123

123124
pmulhrsw(this, left, right, dest)?;
124125
}
@@ -129,7 +130,7 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
129130
// Basically, we multiply `left` with `right.signum()`.
130131
"psign.b.128" | "psign.w.128" | "psign.d.128" => {
131132
let [left, right] =
132-
this.check_shim(abi, ExternAbi::C { unwind: false }, link_name, args)?;
133+
this.check_shim(abi, Conv::C, link_name, args)?;
133134

134135
psign(this, left, right, dest)?;
135136
}

0 commit comments

Comments
 (0)
Please sign in to comment.