summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_codegen_cranelift/src/abi
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /compiler/rustc_codegen_cranelift/src/abi
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/abi')
-rw-r--r--compiler/rustc_codegen_cranelift/src/abi/comments.rs9
-rw-r--r--compiler/rustc_codegen_cranelift/src/abi/mod.rs29
2 files changed, 19 insertions, 19 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/abi/comments.rs b/compiler/rustc_codegen_cranelift/src/abi/comments.rs
index 364503fd3..ade6968de 100644
--- a/compiler/rustc_codegen_cranelift/src/abi/comments.rs
+++ b/compiler/rustc_codegen_cranelift/src/abi/comments.rs
@@ -80,14 +80,7 @@ pub(super) fn add_local_place_comments<'tcx>(
return;
}
let TyAndLayout { ty, layout } = place.layout();
- let rustc_target::abi::LayoutS {
- size,
- align,
- abi: _,
- variants: _,
- fields: _,
- largest_niche: _,
- } = layout.0.0;
+ let rustc_target::abi::LayoutS { size, align, .. } = layout.0.0;
let (kind, extra) = place.debug_comment();
diff --git a/compiler/rustc_codegen_cranelift/src/abi/mod.rs b/compiler/rustc_codegen_cranelift/src/abi/mod.rs
index 199fa6861..b7f56a298 100644
--- a/compiler/rustc_codegen_cranelift/src/abi/mod.rs
+++ b/compiler/rustc_codegen_cranelift/src/abi/mod.rs
@@ -48,7 +48,9 @@ pub(crate) fn conv_to_call_conv(sess: &Session, c: Conv, default_call_conv: Call
default_call_conv
}
- Conv::X86Intr => sess.fatal("x86-interrupt call conv not yet implemented"),
+ Conv::X86Intr | Conv::RiscvInterrupt { .. } => {
+ sess.fatal(format!("interrupt call conv {c:?} not yet implemented"))
+ }
Conv::ArmAapcs => sess.fatal("aapcs call conv not yet implemented"),
Conv::CCmseNonSecureCall => {
@@ -70,7 +72,7 @@ pub(crate) fn get_function_sig<'tcx>(
default_call_conv: CallConv,
inst: Instance<'tcx>,
) -> Signature {
- assert!(!inst.substs.has_infer());
+ assert!(!inst.args.has_infer());
clif_sig_from_fn_abi(
tcx,
default_call_conv,
@@ -377,16 +379,16 @@ pub(crate) fn codegen_terminator_call<'tcx>(
let ret_place = codegen_place(fx, destination);
// Handle special calls like intrinsics and empty drop glue.
- let instance = if let ty::FnDef(def_id, substs) = *func.layout().ty.kind() {
+ let instance = if let ty::FnDef(def_id, fn_args) = *func.layout().ty.kind() {
let instance =
- ty::Instance::expect_resolve(fx.tcx, ty::ParamEnv::reveal_all(), def_id, substs)
+ ty::Instance::expect_resolve(fx.tcx, ty::ParamEnv::reveal_all(), def_id, fn_args)
.polymorphize(fx.tcx);
if fx.tcx.symbol_name(instance).name.starts_with("llvm.") {
crate::intrinsics::codegen_llvm_intrinsic_call(
fx,
&fx.tcx.symbol_name(instance).name,
- substs,
+ fn_args,
args,
ret_place,
target,
@@ -445,9 +447,14 @@ pub(crate) fn codegen_terminator_call<'tcx>(
// Unpack arguments tuple for closures
let mut args = if fn_sig.abi() == Abi::RustCall {
- assert_eq!(args.len(), 2, "rust-call abi requires two arguments");
- let self_arg = codegen_call_argument_operand(fx, &args[0]);
- let pack_arg = codegen_call_argument_operand(fx, &args[1]);
+ let (self_arg, pack_arg) = match args {
+ [pack_arg] => (None, codegen_call_argument_operand(fx, pack_arg)),
+ [self_arg, pack_arg] => (
+ Some(codegen_call_argument_operand(fx, self_arg)),
+ codegen_call_argument_operand(fx, pack_arg),
+ ),
+ _ => panic!("rust-call abi requires one or two arguments"),
+ };
let tupled_arguments = match pack_arg.value.layout().ty.kind() {
ty::Tuple(ref tupled_arguments) => tupled_arguments,
@@ -455,7 +462,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
};
let mut args = Vec::with_capacity(1 + tupled_arguments.len());
- args.push(self_arg);
+ args.extend(self_arg);
for i in 0..tupled_arguments.len() {
args.push(CallArgument {
value: pack_arg.value.value_field(fx, FieldIdx::new(i)),
@@ -611,7 +618,7 @@ pub(crate) fn codegen_drop<'tcx>(
// `Instance::resolve_drop_in_place`?
let virtual_drop = Instance {
def: ty::InstanceDef::Virtual(drop_instance.def_id(), 0),
- substs: drop_instance.substs,
+ args: drop_instance.args,
};
let fn_abi =
RevealAllLayoutCx(fx.tcx).fn_abi_of_instance(virtual_drop, ty::List::empty());
@@ -648,7 +655,7 @@ pub(crate) fn codegen_drop<'tcx>(
let virtual_drop = Instance {
def: ty::InstanceDef::Virtual(drop_instance.def_id(), 0),
- substs: drop_instance.substs,
+ args: drop_instance.args,
};
let fn_abi =
RevealAllLayoutCx(fx.tcx).fn_abi_of_instance(virtual_drop, ty::List::empty());