compiler: actually remove Conv now that it is irrelevant
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
use std::fmt::Display;
|
||||
use std::str::FromStr;
|
||||
use std::{fmt, iter};
|
||||
|
||||
use rustc_abi::{
|
||||
@@ -530,41 +528,6 @@ impl<'a, Ty> ArgAbi<'a, Ty> {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
|
||||
pub enum Conv {
|
||||
// General language calling conventions, for which every target
|
||||
// should have its own backend (e.g. LLVM) support.
|
||||
C,
|
||||
Rust,
|
||||
|
||||
Cold,
|
||||
PreserveMost,
|
||||
PreserveAll,
|
||||
|
||||
// Target-specific calling conventions.
|
||||
ArmAapcs,
|
||||
CCmseNonSecureCall,
|
||||
CCmseNonSecureEntry,
|
||||
|
||||
Msp430Intr,
|
||||
|
||||
GpuKernel,
|
||||
|
||||
X86Fastcall,
|
||||
X86Intr,
|
||||
X86Stdcall,
|
||||
X86ThisCall,
|
||||
X86VectorCall,
|
||||
|
||||
X86_64SysV,
|
||||
X86_64Win64,
|
||||
|
||||
AvrInterrupt,
|
||||
AvrNonBlockingInterrupt,
|
||||
|
||||
RiscvInterrupt { kind: RiscvInterruptKind },
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
|
||||
pub enum RiscvInterruptKind {
|
||||
Machine,
|
||||
@@ -863,70 +826,6 @@ impl<'a, Ty> FnAbi<'a, Ty> {
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Conv {
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s {
|
||||
"C" => Ok(Conv::C),
|
||||
"Rust" => Ok(Conv::Rust),
|
||||
"RustCold" => Ok(Conv::Rust),
|
||||
"ArmAapcs" => Ok(Conv::ArmAapcs),
|
||||
"CCmseNonSecureCall" => Ok(Conv::CCmseNonSecureCall),
|
||||
"CCmseNonSecureEntry" => Ok(Conv::CCmseNonSecureEntry),
|
||||
"Msp430Intr" => Ok(Conv::Msp430Intr),
|
||||
"X86Fastcall" => Ok(Conv::X86Fastcall),
|
||||
"X86Intr" => Ok(Conv::X86Intr),
|
||||
"X86Stdcall" => Ok(Conv::X86Stdcall),
|
||||
"X86ThisCall" => Ok(Conv::X86ThisCall),
|
||||
"X86VectorCall" => Ok(Conv::X86VectorCall),
|
||||
"X86_64SysV" => Ok(Conv::X86_64SysV),
|
||||
"X86_64Win64" => Ok(Conv::X86_64Win64),
|
||||
"GpuKernel" => Ok(Conv::GpuKernel),
|
||||
"AvrInterrupt" => Ok(Conv::AvrInterrupt),
|
||||
"AvrNonBlockingInterrupt" => Ok(Conv::AvrNonBlockingInterrupt),
|
||||
"RiscvInterrupt(machine)" => {
|
||||
Ok(Conv::RiscvInterrupt { kind: RiscvInterruptKind::Machine })
|
||||
}
|
||||
"RiscvInterrupt(supervisor)" => {
|
||||
Ok(Conv::RiscvInterrupt { kind: RiscvInterruptKind::Supervisor })
|
||||
}
|
||||
_ => Err(format!("'{s}' is not a valid value for entry function call convention.")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn conv_to_externabi(conv: &Conv) -> ExternAbi {
|
||||
match conv {
|
||||
Conv::C => ExternAbi::C { unwind: false },
|
||||
Conv::Rust => ExternAbi::Rust,
|
||||
Conv::PreserveMost => ExternAbi::RustCold,
|
||||
Conv::ArmAapcs => ExternAbi::Aapcs { unwind: false },
|
||||
Conv::CCmseNonSecureCall => ExternAbi::CCmseNonSecureCall,
|
||||
Conv::CCmseNonSecureEntry => ExternAbi::CCmseNonSecureEntry,
|
||||
Conv::Msp430Intr => ExternAbi::Msp430Interrupt,
|
||||
Conv::GpuKernel => ExternAbi::GpuKernel,
|
||||
Conv::X86Fastcall => ExternAbi::Fastcall { unwind: false },
|
||||
Conv::X86Intr => ExternAbi::X86Interrupt,
|
||||
Conv::X86Stdcall => ExternAbi::Stdcall { unwind: false },
|
||||
Conv::X86ThisCall => ExternAbi::Thiscall { unwind: false },
|
||||
Conv::X86VectorCall => ExternAbi::Vectorcall { unwind: false },
|
||||
Conv::X86_64SysV => ExternAbi::SysV64 { unwind: false },
|
||||
Conv::X86_64Win64 => ExternAbi::Win64 { unwind: false },
|
||||
Conv::AvrInterrupt => ExternAbi::AvrInterrupt,
|
||||
Conv::AvrNonBlockingInterrupt => ExternAbi::AvrNonBlockingInterrupt,
|
||||
Conv::RiscvInterrupt { kind: RiscvInterruptKind::Machine } => ExternAbi::RiscvInterruptM,
|
||||
Conv::RiscvInterrupt { kind: RiscvInterruptKind::Supervisor } => ExternAbi::RiscvInterruptS,
|
||||
Conv::Cold | Conv::PreserveAll => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for Conv {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", conv_to_externabi(self))
|
||||
}
|
||||
}
|
||||
|
||||
// Some types are used a lot. Make sure they don't unintentionally get bigger.
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
mod size_asserts {
|
||||
|
||||
@@ -92,38 +92,6 @@ impl<A: ToJson> ToJson for Option<A> {
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJson for crate::callconv::Conv {
|
||||
fn to_json(&self) -> Json {
|
||||
let buf: String;
|
||||
let s = match self {
|
||||
Self::C => "C",
|
||||
Self::Rust => "Rust",
|
||||
Self::Cold => "Cold",
|
||||
Self::PreserveMost => "PreserveMost",
|
||||
Self::PreserveAll => "PreserveAll",
|
||||
Self::ArmAapcs => "ArmAapcs",
|
||||
Self::CCmseNonSecureCall => "CCmseNonSecureCall",
|
||||
Self::CCmseNonSecureEntry => "CCmseNonSecureEntry",
|
||||
Self::Msp430Intr => "Msp430Intr",
|
||||
Self::X86Fastcall => "X86Fastcall",
|
||||
Self::X86Intr => "X86Intr",
|
||||
Self::X86Stdcall => "X86Stdcall",
|
||||
Self::X86ThisCall => "X86ThisCall",
|
||||
Self::X86VectorCall => "X86VectorCall",
|
||||
Self::X86_64SysV => "X86_64SysV",
|
||||
Self::X86_64Win64 => "X86_64Win64",
|
||||
Self::GpuKernel => "GpuKernel",
|
||||
Self::AvrInterrupt => "AvrInterrupt",
|
||||
Self::AvrNonBlockingInterrupt => "AvrNonBlockingInterrupt",
|
||||
Self::RiscvInterrupt { kind } => {
|
||||
buf = format!("RiscvInterrupt({})", kind.as_str());
|
||||
&buf
|
||||
}
|
||||
};
|
||||
Json::String(s.to_owned())
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJson for TargetMetadata {
|
||||
fn to_json(&self) -> Json {
|
||||
json!({
|
||||
|
||||
Reference in New Issue
Block a user