|
1 | | -use std::fmt::Display; |
2 | | -use std::str::FromStr; |
3 | 1 | use std::{fmt, iter}; |
4 | 2 |
|
5 | 3 | use rustc_abi::{ |
@@ -530,41 +528,6 @@ impl<'a, Ty> ArgAbi<'a, Ty> { |
530 | 528 | } |
531 | 529 | } |
532 | 530 |
|
533 | | -#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)] |
534 | | -pub enum Conv { |
535 | | - // General language calling conventions, for which every target |
536 | | - // should have its own backend (e.g. LLVM) support. |
537 | | - C, |
538 | | - Rust, |
539 | | - |
540 | | - Cold, |
541 | | - PreserveMost, |
542 | | - PreserveAll, |
543 | | - |
544 | | - // Target-specific calling conventions. |
545 | | - ArmAapcs, |
546 | | - CCmseNonSecureCall, |
547 | | - CCmseNonSecureEntry, |
548 | | - |
549 | | - Msp430Intr, |
550 | | - |
551 | | - GpuKernel, |
552 | | - |
553 | | - X86Fastcall, |
554 | | - X86Intr, |
555 | | - X86Stdcall, |
556 | | - X86ThisCall, |
557 | | - X86VectorCall, |
558 | | - |
559 | | - X86_64SysV, |
560 | | - X86_64Win64, |
561 | | - |
562 | | - AvrInterrupt, |
563 | | - AvrNonBlockingInterrupt, |
564 | | - |
565 | | - RiscvInterrupt { kind: RiscvInterruptKind }, |
566 | | -} |
567 | | - |
568 | 531 | #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)] |
569 | 532 | pub enum RiscvInterruptKind { |
570 | 533 | Machine, |
@@ -863,70 +826,6 @@ impl<'a, Ty> FnAbi<'a, Ty> { |
863 | 826 | } |
864 | 827 | } |
865 | 828 |
|
866 | | -impl FromStr for Conv { |
867 | | - type Err = String; |
868 | | - |
869 | | - fn from_str(s: &str) -> Result<Self, Self::Err> { |
870 | | - match s { |
871 | | - "C" => Ok(Conv::C), |
872 | | - "Rust" => Ok(Conv::Rust), |
873 | | - "RustCold" => Ok(Conv::Rust), |
874 | | - "ArmAapcs" => Ok(Conv::ArmAapcs), |
875 | | - "CCmseNonSecureCall" => Ok(Conv::CCmseNonSecureCall), |
876 | | - "CCmseNonSecureEntry" => Ok(Conv::CCmseNonSecureEntry), |
877 | | - "Msp430Intr" => Ok(Conv::Msp430Intr), |
878 | | - "X86Fastcall" => Ok(Conv::X86Fastcall), |
879 | | - "X86Intr" => Ok(Conv::X86Intr), |
880 | | - "X86Stdcall" => Ok(Conv::X86Stdcall), |
881 | | - "X86ThisCall" => Ok(Conv::X86ThisCall), |
882 | | - "X86VectorCall" => Ok(Conv::X86VectorCall), |
883 | | - "X86_64SysV" => Ok(Conv::X86_64SysV), |
884 | | - "X86_64Win64" => Ok(Conv::X86_64Win64), |
885 | | - "GpuKernel" => Ok(Conv::GpuKernel), |
886 | | - "AvrInterrupt" => Ok(Conv::AvrInterrupt), |
887 | | - "AvrNonBlockingInterrupt" => Ok(Conv::AvrNonBlockingInterrupt), |
888 | | - "RiscvInterrupt(machine)" => { |
889 | | - Ok(Conv::RiscvInterrupt { kind: RiscvInterruptKind::Machine }) |
890 | | - } |
891 | | - "RiscvInterrupt(supervisor)" => { |
892 | | - Ok(Conv::RiscvInterrupt { kind: RiscvInterruptKind::Supervisor }) |
893 | | - } |
894 | | - _ => Err(format!("'{s}' is not a valid value for entry function call convention.")), |
895 | | - } |
896 | | - } |
897 | | -} |
898 | | - |
899 | | -fn conv_to_externabi(conv: &Conv) -> ExternAbi { |
900 | | - match conv { |
901 | | - Conv::C => ExternAbi::C { unwind: false }, |
902 | | - Conv::Rust => ExternAbi::Rust, |
903 | | - Conv::PreserveMost => ExternAbi::RustCold, |
904 | | - Conv::ArmAapcs => ExternAbi::Aapcs { unwind: false }, |
905 | | - Conv::CCmseNonSecureCall => ExternAbi::CCmseNonSecureCall, |
906 | | - Conv::CCmseNonSecureEntry => ExternAbi::CCmseNonSecureEntry, |
907 | | - Conv::Msp430Intr => ExternAbi::Msp430Interrupt, |
908 | | - Conv::GpuKernel => ExternAbi::GpuKernel, |
909 | | - Conv::X86Fastcall => ExternAbi::Fastcall { unwind: false }, |
910 | | - Conv::X86Intr => ExternAbi::X86Interrupt, |
911 | | - Conv::X86Stdcall => ExternAbi::Stdcall { unwind: false }, |
912 | | - Conv::X86ThisCall => ExternAbi::Thiscall { unwind: false }, |
913 | | - Conv::X86VectorCall => ExternAbi::Vectorcall { unwind: false }, |
914 | | - Conv::X86_64SysV => ExternAbi::SysV64 { unwind: false }, |
915 | | - Conv::X86_64Win64 => ExternAbi::Win64 { unwind: false }, |
916 | | - Conv::AvrInterrupt => ExternAbi::AvrInterrupt, |
917 | | - Conv::AvrNonBlockingInterrupt => ExternAbi::AvrNonBlockingInterrupt, |
918 | | - Conv::RiscvInterrupt { kind: RiscvInterruptKind::Machine } => ExternAbi::RiscvInterruptM, |
919 | | - Conv::RiscvInterrupt { kind: RiscvInterruptKind::Supervisor } => ExternAbi::RiscvInterruptS, |
920 | | - Conv::Cold | Conv::PreserveAll => unreachable!(), |
921 | | - } |
922 | | -} |
923 | | - |
924 | | -impl Display for Conv { |
925 | | - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
926 | | - write!(f, "{}", conv_to_externabi(self)) |
927 | | - } |
928 | | -} |
929 | | - |
930 | 829 | // Some types are used a lot. Make sure they don't unintentionally get bigger. |
931 | 830 | #[cfg(target_pointer_width = "64")] |
932 | 831 | mod size_asserts { |
|
0 commit comments