Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 7dce0b3

Browse files
committed
Revive amdgpu-kernel calling convention
It was reverted in commit f6b21e9 due to inactivity in the amdgpu target. Rename the original enum value from `AmdGpuKernel` to `AmdgpuKernel`, which is more consistent with `amdgpu-kernel`.
1 parent bf6f8a4 commit 7dce0b3

File tree

23 files changed

+266
-62
lines changed

23 files changed

+266
-62
lines changed

compiler/rustc_abi/src/extern_abi/mod.rs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pub enum ExternAbi {
4545
PtxKernel,
4646
Msp430Interrupt,
4747
X86Interrupt,
48+
AmdgpuKernel,
4849
EfiApi,
4950
AvrInterrupt,
5051
AvrNonBlockingInterrupt,
@@ -122,6 +123,7 @@ const AbiDatas: &[AbiData] = &[
122123
AbiData { abi: Abi::PtxKernel, name: "ptx-kernel" },
123124
AbiData { abi: Abi::Msp430Interrupt, name: "msp430-interrupt" },
124125
AbiData { abi: Abi::X86Interrupt, name: "x86-interrupt" },
126+
AbiData { abi: Abi::AmdgpuKernel, name: "amdgpu-kernel" },
125127
AbiData { abi: Abi::EfiApi, name: "efiapi" },
126128
AbiData { abi: Abi::AvrInterrupt, name: "avr-interrupt" },
127129
AbiData { abi: Abi::AvrNonBlockingInterrupt, name: "avr-non-blocking-interrupt" },
@@ -235,6 +237,10 @@ pub fn is_stable(name: &str) -> Result<(), AbiDisabled> {
235237
feature: sym::abi_x86_interrupt,
236238
explain: "x86-interrupt ABI is experimental and subject to change",
237239
}),
240+
"amdgpu-kernel" => Err(AbiDisabled::Unstable {
241+
feature: sym::abi_amdgpu_kernel,
242+
explain: "amdgpu-kernel ABI is experimental and subject to change",
243+
}),
238244
"avr-interrupt" | "avr-non-blocking-interrupt" => Err(AbiDisabled::Unstable {
239245
feature: sym::abi_avr_interrupt,
240246
explain: "avr-interrupt and avr-non-blocking-interrupt ABIs are experimental and subject to change",
@@ -289,20 +295,21 @@ impl Abi {
289295
PtxKernel => 19,
290296
Msp430Interrupt => 20,
291297
X86Interrupt => 21,
292-
EfiApi => 22,
293-
AvrInterrupt => 23,
294-
AvrNonBlockingInterrupt => 24,
295-
CCmseNonSecureCall => 25,
296-
CCmseNonSecureEntry => 26,
298+
AmdgpuKernel => 22,
299+
EfiApi => 23,
300+
AvrInterrupt => 24,
301+
AvrNonBlockingInterrupt => 25,
302+
CCmseNonSecureCall => 26,
303+
CCmseNonSecureEntry => 27,
297304
// Cross-platform ABIs
298-
System { unwind: false } => 27,
299-
System { unwind: true } => 28,
300-
RustIntrinsic => 29,
301-
RustCall => 30,
302-
Unadjusted => 31,
303-
RustCold => 32,
304-
RiscvInterruptM => 33,
305-
RiscvInterruptS => 34,
305+
System { unwind: false } => 28,
306+
System { unwind: true } => 29,
307+
RustIntrinsic => 30,
308+
RustCall => 31,
309+
Unadjusted => 32,
310+
RustCold => 33,
311+
RiscvInterruptM => 34,
312+
RiscvInterruptS => 35,
306313
};
307314
debug_assert!(
308315
AbiDatas

compiler/rustc_codegen_cranelift/src/abi/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,11 @@ pub(crate) fn conv_to_call_conv(sess: &Session, c: Conv, default_call_conv: Call
6565
sess.dcx().fatal("C-cmse-nonsecure-entry call conv is not yet implemented");
6666
}
6767

68-
Conv::Msp430Intr | Conv::PtxKernel | Conv::AvrInterrupt | Conv::AvrNonBlockingInterrupt => {
68+
Conv::Msp430Intr
69+
| Conv::PtxKernel
70+
| Conv::AmdgpuKernel
71+
| Conv::AvrInterrupt
72+
| Conv::AvrNonBlockingInterrupt => {
6973
unreachable!("tried to use {c:?} call conv which only exists on an unsupported target");
7074
}
7175
}

compiler/rustc_codegen_llvm/src/abi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ impl From<Conv> for llvm::CallConv {
666666
Conv::Cold => llvm::ColdCallConv,
667667
Conv::PreserveMost => llvm::PreserveMost,
668668
Conv::PreserveAll => llvm::PreserveAll,
669+
Conv::AmdgpuKernel => llvm::AmdgpuKernel,
669670
Conv::AvrInterrupt => llvm::AvrInterrupt,
670671
Conv::AvrNonBlockingInterrupt => llvm::AvrNonBlockingInterrupt,
671672
Conv::ArmAapcs => llvm::ArmAapcsCallConv,

compiler/rustc_codegen_llvm/src/llvm/ffi.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ pub enum CallConv {
120120
X86_Intr = 83,
121121
AvrNonBlockingInterrupt = 84,
122122
AvrInterrupt = 85,
123+
AmdgpuKernel = 91,
123124
}
124125

125126
/// Must match the layout of `LLVMLinkage`.

compiler/rustc_feature/src/removed.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ declare_features! (
3939
// (But not all features below do this properly; many indicate the
4040
// version they got originally added in.)
4141

42-
/// Allows using the `amdgpu-kernel` ABI.
43-
(removed, abi_amdgpu_kernel, "1.77.0", Some(51575), None),
4442
(removed, advanced_slice_patterns, "1.0.0", Some(62254),
4543
Some("merged into `#![feature(slice_patterns)]`")),
4644
(removed, allocator, "1.0.0", None, None),

compiler/rustc_feature/src/unstable.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,8 @@ declare_features! (
355355
// feature-group-start: actual feature gates
356356
// -------------------------------------------------------------------------
357357

358+
/// Allows `extern "amdgpu-kernel" fn()`.
359+
(unstable, abi_amdgpu_kernel, "CURRENT_RUSTC_VERSION", Some(135024)),
358360
/// Allows `extern "avr-interrupt" fn()` and `extern "avr-non-blocking-interrupt" fn()`.
359361
(unstable, abi_avr_interrupt, "1.45.0", Some(69664)),
360362
/// Allows `extern "C-cmse-nonsecure-call" fn()`.

compiler/rustc_middle/src/ty/layout.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,7 @@ pub fn fn_can_unwind(tcx: TyCtxt<'_>, fn_def_id: Option<DefId>, abi: ExternAbi)
12401240
PtxKernel
12411241
| Msp430Interrupt
12421242
| X86Interrupt
1243+
| AmdgpuKernel
12431244
| EfiApi
12441245
| AvrInterrupt
12451246
| AvrNonBlockingInterrupt

compiler/rustc_smir/src/rustc_internal/internal.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ impl RustcInternal for Abi {
472472
Abi::PtxKernel => rustc_abi::ExternAbi::PtxKernel,
473473
Abi::Msp430Interrupt => rustc_abi::ExternAbi::Msp430Interrupt,
474474
Abi::X86Interrupt => rustc_abi::ExternAbi::X86Interrupt,
475+
Abi::AmdgpuKernel => rustc_abi::ExternAbi::AmdgpuKernel,
475476
Abi::EfiApi => rustc_abi::ExternAbi::EfiApi,
476477
Abi::AvrInterrupt => rustc_abi::ExternAbi::AvrInterrupt,
477478
Abi::AvrNonBlockingInterrupt => rustc_abi::ExternAbi::AvrNonBlockingInterrupt,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ impl<'tcx> Stable<'tcx> for callconv::Conv {
113113
Conv::X86VectorCall => CallConvention::X86VectorCall,
114114
Conv::X86_64SysV => CallConvention::X86_64SysV,
115115
Conv::X86_64Win64 => CallConvention::X86_64Win64,
116+
Conv::AmdgpuKernel => CallConvention::AmdgpuKernel,
116117
Conv::AvrInterrupt => CallConvention::AvrInterrupt,
117118
Conv::AvrNonBlockingInterrupt => CallConvention::AvrNonBlockingInterrupt,
118119
Conv::RiscvInterrupt { .. } => CallConvention::RiscvInterrupt,

compiler/rustc_smir/src/rustc_smir/convert/ty.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,7 @@ impl<'tcx> Stable<'tcx> for rustc_abi::ExternAbi {
911911
ExternAbi::Win64 { unwind } => Abi::Win64 { unwind },
912912
ExternAbi::SysV64 { unwind } => Abi::SysV64 { unwind },
913913
ExternAbi::PtxKernel => Abi::PtxKernel,
914+
ExternAbi::AmdgpuKernel => Abi::AmdgpuKernel,
914915
ExternAbi::Msp430Interrupt => Abi::Msp430Interrupt,
915916
ExternAbi::X86Interrupt => Abi::X86Interrupt,
916917
ExternAbi::EfiApi => Abi::EfiApi,

0 commit comments

Comments
 (0)