compiler: Revert -Zregparm handling for extern Rust

This commit is contained in:
Jubilee Young 2024-10-18 11:54:07 -07:00
parent d6f5b437e5
commit b9c96780b4
4 changed files with 0 additions and 85 deletions

View File

@ -720,28 +720,6 @@ pub fn adjust_for_foreign_abi<C>(
Ok(()) Ok(())
} }
pub fn fill_inregs_for_rust_abi<C>(&mut self, cx: &C)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasTargetSpec + HasX86AbiOpt,
{
let spec = cx.target_spec();
match &spec.arch[..] {
"x86" => {
x86::fill_inregs(
cx,
self,
x86::X86Options {
flavor: x86::Flavor::General,
regparm: cx.x86_abi_opt().regparm,
},
true,
);
}
_ => {}
}
}
} }
impl FromStr for Conv { impl FromStr for Conv {

View File

@ -797,9 +797,6 @@ fn unadjust<'tcx>(arg: &mut ArgAbi<'tcx, Ty<'tcx>>) {
for (arg_idx, arg) in fn_abi.args.iter_mut().enumerate() { for (arg_idx, arg) in fn_abi.args.iter_mut().enumerate() {
fixup(arg, Some(arg_idx)); fixup(arg, Some(arg_idx));
} }
if tcx.sess.target.arch == "x86" {
fn_abi.fill_inregs_for_rust_abi(cx);
}
} else { } else {
fn_abi fn_abi
.adjust_for_foreign_abi(cx, abi) .adjust_for_foreign_abi(cx, abi)

View File

@ -1,53 +0,0 @@
// Checks how `regparm` flag works with Rust calling convention with array types.
// When there is a small array type in signature (casted to combined int type),
// inregs will not be set. PassMode::Cast is unsupported.
// x86 only.
//@ compile-flags: --target i686-unknown-linux-gnu -O -C no-prepopulate-passes
//@ needs-llvm-components: x86
//@ revisions:regparm0 regparm1 regparm2 regparm3
//@[regparm0] compile-flags: -Zregparm=0
//@[regparm1] compile-flags: -Zregparm=1
//@[regparm2] compile-flags: -Zregparm=2
//@[regparm3] compile-flags: -Zregparm=3
#![crate_type = "lib"]
#![no_core]
#![feature(no_core, lang_items)]
#[lang = "sized"]
trait Sized {}
#[lang = "copy"]
trait Copy {}
pub mod tests {
// CHECK: @f1(i16 %0, i32 noundef %_2, i32 noundef %_3)
#[no_mangle]
pub extern "Rust" fn f1(_: [u8; 2], _: i32, _: i32) {}
// CHECK: @f2(i24 %0, i32 noundef %_2, i32 noundef %_3)
#[no_mangle]
pub extern "Rust" fn f2(_: [u8; 3], _: i32, _: i32) {}
// regparm0: @f3(ptr {{.*}} %_1, i32 noundef %_2, i32 noundef %_3)
// regparm1: @f3(ptr {{.*}} %_1, i32 inreg noundef %_2, i32 noundef %_3)
// regparm2: @f3(ptr {{.*}} %_1, i32 inreg noundef %_2, i32 inreg noundef %_3)
// regparm3: @f3(ptr {{.*}} %_1, i32 inreg noundef %_2, i32 inreg noundef %_3)
#[no_mangle]
pub extern "Rust" fn f3(_: [u8; 7], _: i32, _: i32) {}
// regparm0: @f4(ptr {{.*}} %_1, i32 noundef %_2, i32 noundef %_3)
// regparm1: @f4(ptr {{.*}} %_1, i32 inreg noundef %_2, i32 noundef %_3)
// regparm2: @f4(ptr {{.*}} %_1, i32 inreg noundef %_2, i32 inreg noundef %_3)
// regparm3: @f4(ptr {{.*}} %_1, i32 inreg noundef %_2, i32 inreg noundef %_3)
#[no_mangle]
pub extern "Rust" fn f4(_: [u8; 11], _: i32, _: i32) {}
// regparm0: @f5(ptr {{.*}} %_1, i32 noundef %_2, i32 noundef %_3)
// regparm1: @f5(ptr {{.*}} %_1, i32 inreg noundef %_2, i32 noundef %_3)
// regparm2: @f5(ptr {{.*}} %_1, i32 inreg noundef %_2, i32 inreg noundef %_3)
// regparm3: @f5(ptr {{.*}} %_1, i32 inreg noundef %_2, i32 inreg noundef %_3)
#[no_mangle]
pub extern "Rust" fn f5(_: [u8; 33], _: i32, _: i32) {}
}

View File

@ -25,13 +25,6 @@ pub mod tests {
#[no_mangle] #[no_mangle]
pub extern "fastcall" fn f1(_: i32, _: i32, _: i32) {} pub extern "fastcall" fn f1(_: i32, _: i32, _: i32) {}
// regparm0: @f2(i32 noundef %_1, i32 noundef %_2, i32 noundef %_3)
// regparm1: @f2(i32 inreg noundef %_1, i32 noundef %_2, i32 noundef %_3)
// regparm2: @f2(i32 inreg noundef %_1, i32 inreg noundef %_2, i32 noundef %_3)
// regparm3: @f2(i32 inreg noundef %_1, i32 inreg noundef %_2, i32 inreg noundef %_3)
#[no_mangle]
pub extern "Rust" fn f2(_: i32, _: i32, _: i32) {}
// regparm0: @f3(i32 noundef %_1, i32 noundef %_2, i32 noundef %_3) // regparm0: @f3(i32 noundef %_1, i32 noundef %_2, i32 noundef %_3)
// regparm1: @f3(i32 inreg noundef %_1, i32 noundef %_2, i32 noundef %_3) // regparm1: @f3(i32 inreg noundef %_1, i32 noundef %_2, i32 noundef %_3)
// regparm2: @f3(i32 inreg noundef %_1, i32 inreg noundef %_2, i32 noundef %_3) // regparm2: @f3(i32 inreg noundef %_1, i32 inreg noundef %_2, i32 noundef %_3)