remove compiler support for extern "rust-intrinsic"
blocks
This commit is contained in:
parent
175dcc7773
commit
5eb535c568
23 changed files with 79 additions and 147 deletions
|
@ -1,6 +1,6 @@
|
|||
use rustc_abi::{
|
||||
BackendRepr, ExternAbi, FieldsShape, HasDataLayout, Primitive, Reg, RegKind, Size,
|
||||
TyAbiInterface, TyAndLayout, Variants,
|
||||
BackendRepr, FieldsShape, HasDataLayout, Primitive, Reg, RegKind, Size, TyAbiInterface,
|
||||
TyAndLayout, Variants,
|
||||
};
|
||||
|
||||
use crate::callconv::{ArgAbi, ArgExtension, CastTarget, FnAbi, PassMode, Uniform};
|
||||
|
@ -364,15 +364,11 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn compute_rust_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, abi: ExternAbi)
|
||||
pub(crate) fn compute_rust_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
|
||||
where
|
||||
Ty: TyAbiInterface<'a, C> + Copy,
|
||||
C: HasDataLayout + HasTargetSpec,
|
||||
{
|
||||
if abi == ExternAbi::RustIntrinsic {
|
||||
return;
|
||||
}
|
||||
|
||||
let grlen = cx.data_layout().pointer_size.bits();
|
||||
|
||||
for arg in fn_abi.args.iter_mut() {
|
||||
|
|
|
@ -717,16 +717,16 @@ impl<'a, Ty> FnAbi<'a, Ty> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn adjust_for_rust_abi<C>(&mut self, cx: &C, abi: ExternAbi)
|
||||
pub fn adjust_for_rust_abi<C>(&mut self, cx: &C)
|
||||
where
|
||||
Ty: TyAbiInterface<'a, C> + Copy,
|
||||
C: HasDataLayout + HasTargetSpec,
|
||||
{
|
||||
let spec = cx.target_spec();
|
||||
match &*spec.arch {
|
||||
"x86" => x86::compute_rust_abi_info(cx, self, abi),
|
||||
"riscv32" | "riscv64" => riscv::compute_rust_abi_info(cx, self, abi),
|
||||
"loongarch64" => loongarch::compute_rust_abi_info(cx, self, abi),
|
||||
"x86" => x86::compute_rust_abi_info(cx, self),
|
||||
"riscv32" | "riscv64" => riscv::compute_rust_abi_info(cx, self),
|
||||
"loongarch64" => loongarch::compute_rust_abi_info(cx, self),
|
||||
"aarch64" => aarch64::compute_rust_abi_info(cx, self),
|
||||
_ => {}
|
||||
};
|
||||
|
@ -850,10 +850,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
|
|||
//
|
||||
// Note that the intrinsic ABI is exempt here as those are not
|
||||
// real functions anyway, and the backend expects very specific types.
|
||||
if abi != ExternAbi::RustIntrinsic
|
||||
&& spec.simd_types_indirect
|
||||
&& !can_pass_simd_directly(arg)
|
||||
{
|
||||
if spec.simd_types_indirect && !can_pass_simd_directly(arg) {
|
||||
arg.make_indirect();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
// https://github.com/llvm/llvm-project/blob/8e780252a7284be45cf1ba224cabd884847e8e92/clang/lib/CodeGen/TargetInfo.cpp#L9311-L9773
|
||||
|
||||
use rustc_abi::{
|
||||
BackendRepr, ExternAbi, FieldsShape, HasDataLayout, Primitive, Reg, RegKind, Size,
|
||||
TyAbiInterface, TyAndLayout, Variants,
|
||||
BackendRepr, FieldsShape, HasDataLayout, Primitive, Reg, RegKind, Size, TyAbiInterface,
|
||||
TyAndLayout, Variants,
|
||||
};
|
||||
|
||||
use crate::callconv::{ArgAbi, ArgExtension, CastTarget, FnAbi, PassMode, Uniform};
|
||||
|
@ -370,15 +370,11 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn compute_rust_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, abi: ExternAbi)
|
||||
pub(crate) fn compute_rust_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
|
||||
where
|
||||
Ty: TyAbiInterface<'a, C> + Copy,
|
||||
C: HasDataLayout + HasTargetSpec,
|
||||
{
|
||||
if abi == ExternAbi::RustIntrinsic {
|
||||
return;
|
||||
}
|
||||
|
||||
let xlen = cx.data_layout().pointer_size.bits();
|
||||
|
||||
for arg in fn_abi.args.iter_mut() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use rustc_abi::{
|
||||
AddressSpace, Align, BackendRepr, ExternAbi, HasDataLayout, Primitive, Reg, RegKind,
|
||||
TyAbiInterface, TyAndLayout,
|
||||
AddressSpace, Align, BackendRepr, HasDataLayout, Primitive, Reg, RegKind, TyAbiInterface,
|
||||
TyAndLayout,
|
||||
};
|
||||
|
||||
use crate::callconv::{ArgAttribute, FnAbi, PassMode};
|
||||
|
@ -193,7 +193,7 @@ pub(crate) fn fill_inregs<'a, Ty, C>(
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn compute_rust_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, abi: ExternAbi)
|
||||
pub(crate) fn compute_rust_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
|
||||
where
|
||||
Ty: TyAbiInterface<'a, C> + Copy,
|
||||
C: HasDataLayout + HasTargetSpec,
|
||||
|
@ -201,10 +201,7 @@ where
|
|||
// Avoid returning floats in x87 registers on x86 as loading and storing from x87
|
||||
// registers will quiet signalling NaNs. Also avoid using SSE registers since they
|
||||
// are not always available (depending on target features).
|
||||
if !fn_abi.ret.is_ignore()
|
||||
// Intrinsics themselves are not "real" functions, so theres no need to change their ABIs.
|
||||
&& abi != ExternAbi::RustIntrinsic
|
||||
{
|
||||
if !fn_abi.ret.is_ignore() {
|
||||
let has_float = match fn_abi.ret.layout.backend_repr {
|
||||
BackendRepr::Scalar(s) => matches!(s.primitive(), Primitive::Float(_)),
|
||||
BackendRepr::ScalarPair(s1, s2) => {
|
||||
|
|
|
@ -2962,14 +2962,9 @@ impl Target {
|
|||
pub fn is_abi_supported(&self, abi: ExternAbi) -> bool {
|
||||
use ExternAbi::*;
|
||||
match abi {
|
||||
Rust
|
||||
| C { .. }
|
||||
| System { .. }
|
||||
| RustIntrinsic
|
||||
| RustCall
|
||||
| Unadjusted
|
||||
| Cdecl { .. }
|
||||
| RustCold => true,
|
||||
Rust | C { .. } | System { .. } | RustCall | Unadjusted | Cdecl { .. } | RustCold => {
|
||||
true
|
||||
}
|
||||
EfiApi => {
|
||||
["arm", "aarch64", "riscv32", "riscv64", "x86", "x86_64"].contains(&&self.arch[..])
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue