Skip to content

Commit 307a18d

Browse files
compiler: actually remove Conv now that it is irrelevant
1 parent 2351a3e commit 307a18d

File tree

3 files changed

+1
-163
lines changed

3 files changed

+1
-163
lines changed

compiler/rustc_smir/src/rustc_smir/convert/abi.rs

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use rustc_abi::{ArmCall, CanonAbi, InterruptKind, X86Call};
66
use rustc_middle::ty;
7-
use rustc_target::callconv::{self, Conv};
7+
use rustc_target::callconv;
88
use stable_mir::abi::{
99
AddressSpace, ArgAbi, CallConvention, FieldsShape, FloatLength, FnAbi, IntegerLength, Layout,
1010
LayoutShape, PassMode, Primitive, Scalar, TagEncoding, TyAndLayout, ValueAbi, VariantsShape,
@@ -93,35 +93,6 @@ impl<'tcx> Stable<'tcx> for callconv::ArgAbi<'tcx, ty::Ty<'tcx>> {
9393
}
9494
}
9595

96-
impl<'tcx> Stable<'tcx> for callconv::Conv {
97-
type T = CallConvention;
98-
99-
fn stable(&self, _tables: &mut Tables<'_>) -> Self::T {
100-
match self {
101-
Conv::C => CallConvention::C,
102-
Conv::Rust => CallConvention::Rust,
103-
Conv::Cold => CallConvention::Cold,
104-
Conv::PreserveMost => CallConvention::PreserveMost,
105-
Conv::PreserveAll => CallConvention::PreserveAll,
106-
Conv::ArmAapcs => CallConvention::ArmAapcs,
107-
Conv::CCmseNonSecureCall => CallConvention::CCmseNonSecureCall,
108-
Conv::CCmseNonSecureEntry => CallConvention::CCmseNonSecureEntry,
109-
Conv::Msp430Intr => CallConvention::Msp430Intr,
110-
Conv::X86Fastcall => CallConvention::X86Fastcall,
111-
Conv::X86Intr => CallConvention::X86Intr,
112-
Conv::X86Stdcall => CallConvention::X86Stdcall,
113-
Conv::X86ThisCall => CallConvention::X86ThisCall,
114-
Conv::X86VectorCall => CallConvention::X86VectorCall,
115-
Conv::X86_64SysV => CallConvention::X86_64SysV,
116-
Conv::X86_64Win64 => CallConvention::X86_64Win64,
117-
Conv::GpuKernel => CallConvention::GpuKernel,
118-
Conv::AvrInterrupt => CallConvention::AvrInterrupt,
119-
Conv::AvrNonBlockingInterrupt => CallConvention::AvrNonBlockingInterrupt,
120-
Conv::RiscvInterrupt { .. } => CallConvention::RiscvInterrupt,
121-
}
122-
}
123-
}
124-
12596
impl<'tcx> Stable<'tcx> for CanonAbi {
12697
type T = CallConvention;
12798

compiler/rustc_target/src/callconv/mod.rs

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::fmt::Display;
2-
use std::str::FromStr;
31
use std::{fmt, iter};
42

53
use rustc_abi::{
@@ -530,41 +528,6 @@ impl<'a, Ty> ArgAbi<'a, Ty> {
530528
}
531529
}
532530

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-
568531
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, HashStable_Generic)]
569532
pub enum RiscvInterruptKind {
570533
Machine,
@@ -863,70 +826,6 @@ impl<'a, Ty> FnAbi<'a, Ty> {
863826
}
864827
}
865828

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-
930829
// Some types are used a lot. Make sure they don't unintentionally get bigger.
931830
#[cfg(target_pointer_width = "64")]
932831
mod size_asserts {

compiler/rustc_target/src/json.rs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -92,38 +92,6 @@ impl<A: ToJson> ToJson for Option<A> {
9292
}
9393
}
9494

95-
impl ToJson for crate::callconv::Conv {
96-
fn to_json(&self) -> Json {
97-
let buf: String;
98-
let s = match self {
99-
Self::C => "C",
100-
Self::Rust => "Rust",
101-
Self::Cold => "Cold",
102-
Self::PreserveMost => "PreserveMost",
103-
Self::PreserveAll => "PreserveAll",
104-
Self::ArmAapcs => "ArmAapcs",
105-
Self::CCmseNonSecureCall => "CCmseNonSecureCall",
106-
Self::CCmseNonSecureEntry => "CCmseNonSecureEntry",
107-
Self::Msp430Intr => "Msp430Intr",
108-
Self::X86Fastcall => "X86Fastcall",
109-
Self::X86Intr => "X86Intr",
110-
Self::X86Stdcall => "X86Stdcall",
111-
Self::X86ThisCall => "X86ThisCall",
112-
Self::X86VectorCall => "X86VectorCall",
113-
Self::X86_64SysV => "X86_64SysV",
114-
Self::X86_64Win64 => "X86_64Win64",
115-
Self::GpuKernel => "GpuKernel",
116-
Self::AvrInterrupt => "AvrInterrupt",
117-
Self::AvrNonBlockingInterrupt => "AvrNonBlockingInterrupt",
118-
Self::RiscvInterrupt { kind } => {
119-
buf = format!("RiscvInterrupt({})", kind.as_str());
120-
&buf
121-
}
122-
};
123-
Json::String(s.to_owned())
124-
}
125-
}
126-
12795
impl ToJson for TargetMetadata {
12896
fn to_json(&self) -> Json {
12997
json!({

0 commit comments

Comments
 (0)