Skip to content

Add the amdgpu-kernel ABI. #52032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/librustc/ich/impls_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ impl_stable_hash_for!(enum ::rustc_target::spec::abi::Abi {
PtxKernel,
Msp430Interrupt,
X86Interrupt,
AmdGpuKernel,
Rust,
C,
System,
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_codegen_llvm/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ impl<'a, 'tcx> FnTypeExt<'a, 'tcx> for FnType<'tcx, Ty<'tcx>> {
PtxKernel => Conv::PtxKernel,
Msp430Interrupt => Conv::Msp430Intr,
X86Interrupt => Conv::X86Intr,
AmdGpuKernel => Conv::AmdGpuKernel,

// These API constants ought to be more specific...
Cdecl => Conv::C,
Expand Down Expand Up @@ -608,6 +609,7 @@ impl<'a, 'tcx> FnTypeExt<'a, 'tcx> for FnType<'tcx, Ty<'tcx>> {
fn llvm_cconv(&self) -> llvm::CallConv {
match self.conv {
Conv::C => llvm::CCallConv,
Conv::AmdGpuKernel => llvm::AmdGpuKernel,
Conv::ArmAapcs => llvm::ArmAapcsCallConv,
Conv::Msp430Intr => llvm::Msp430Intr,
Conv::PtxKernel => llvm::PtxKernel,
Expand Down
1 change: 1 addition & 0 deletions src/librustc_llvm/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pub enum CallConv {
X86_64_Win64 = 79,
X86_VectorCall = 80,
X86_Intr = 83,
AmdGpuKernel = 91,
}

/// LLVMRustLinkage
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_target/abi/call/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,8 @@ pub enum Conv {

X86_64SysV,
X86_64Win64,

AmdGpuKernel,
}

/// Metadata describing how the arguments to a native function
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_target/spec/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub enum Abi {
PtxKernel,
Msp430Interrupt,
X86Interrupt,
AmdGpuKernel,

// Multiplatform / generic ABIs
Rust,
Expand Down Expand Up @@ -63,6 +64,7 @@ const AbiDatas: &'static [AbiData] = &[
AbiData {abi: Abi::PtxKernel, name: "ptx-kernel", generic: false },
AbiData {abi: Abi::Msp430Interrupt, name: "msp430-interrupt", generic: false },
AbiData {abi: Abi::X86Interrupt, name: "x86-interrupt", generic: false },
AbiData {abi: Abi::AmdGpuKernel, name: "amdgpu-kernel", generic: false },

// Cross-platform ABIs
AbiData {abi: Abi::Rust, name: "Rust", generic: true },
Expand Down
6 changes: 6 additions & 0 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@ declare_features! (

// #[alloc_error_handler]
(active, alloc_error_handler, "1.29.0", Some(51540), None),

(active, abi_amdgpu_kernel, "1.29.0", Some(51575), None),
);

declare_features! (
Expand Down Expand Up @@ -1439,6 +1441,10 @@ impl<'a> PostExpansionVisitor<'a> {
gate_feature_post!(&self, abi_x86_interrupt, span,
"x86-interrupt ABI is experimental and subject to change");
},
Abi::AmdGpuKernel => {
gate_feature_post!(&self, abi_amdgpu_kernel, span,
"amdgpu-kernel ABI is experimental and subject to change");
},
// Stable
Abi::Cdecl |
Abi::Stdcall |
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/codemap_tests/unicode.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error[E0703]: invalid ABI: found `路濫狼á́́`
LL | extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI
| ^^^^^^^^^ invalid ABI
|
= help: valid ABIs: cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted
= help: valid ABIs: cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, amdgpu-kernel, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted

error: aborting due to previous error

Expand Down
10 changes: 9 additions & 1 deletion src/test/ui/feature-gate-abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// ignore-tidy-linelength
// gate-test-intrinsics
// gate-test-platform_intrinsics
// gate-test-abi_vectorcall
// gate-test-abi_thiscall
// gate-test-abi_ptx
// gate-test-abi_x86_interrupt
// gate-test-abi_amdgpu_kernel

// Functions
extern "rust-intrinsic" fn f1() {} //~ ERROR intrinsics are subject to change
Expand All @@ -24,6 +25,7 @@ extern "msp430-interrupt" fn f5() {} //~ ERROR msp430-interrupt ABI is experimen
extern "ptx-kernel" fn f6() {} //~ ERROR PTX ABIs are experimental and subject to change
extern "x86-interrupt" fn f7() {} //~ ERROR x86-interrupt ABI is experimental
extern "thiscall" fn f8() {} //~ ERROR thiscall is experimental and subject to change
extern "amdgpu-kernel" fn f9() {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change

// Methods in trait definition
trait Tr {
Expand All @@ -35,6 +37,7 @@ trait Tr {
extern "ptx-kernel" fn m6(); //~ ERROR PTX ABIs are experimental and subject to change
extern "x86-interrupt" fn m7(); //~ ERROR x86-interrupt ABI is experimental
extern "thiscall" fn m8(); //~ ERROR thiscall is experimental and subject to change
extern "amdgpu-kernel" fn m9(); //~ ERROR amdgpu-kernel ABI is experimental and subject to change

extern "rust-intrinsic" fn dm1() {} //~ ERROR intrinsics are subject to change
extern "platform-intrinsic" fn dm2() {} //~ ERROR platform intrinsics are experimental
Expand All @@ -44,6 +47,7 @@ trait Tr {
extern "ptx-kernel" fn dm6() {} //~ ERROR PTX ABIs are experimental and subject to change
extern "x86-interrupt" fn dm7() {} //~ ERROR x86-interrupt ABI is experimental
extern "thiscall" fn dm8() {} //~ ERROR thiscall is experimental and subject to change
extern "amdgpu-kernel" fn dm9() {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change
}

struct S;
Expand All @@ -58,6 +62,7 @@ impl Tr for S {
extern "ptx-kernel" fn m6() {} //~ ERROR PTX ABIs are experimental and subject to change
extern "x86-interrupt" fn m7() {} //~ ERROR x86-interrupt ABI is experimental
extern "thiscall" fn m8() {} //~ ERROR thiscall is experimental and subject to change
extern "amdgpu-kernel" fn m9() {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change
}

// Methods in inherent impl
Expand All @@ -70,6 +75,7 @@ impl S {
extern "ptx-kernel" fn im6() {} //~ ERROR PTX ABIs are experimental and subject to change
extern "x86-interrupt" fn im7() {} //~ ERROR x86-interrupt ABI is experimental
extern "thiscall" fn im8() {} //~ ERROR thiscall is experimental and subject to change
extern "amdgpu-kernel" fn im9() {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change
}

// Function pointer types
Expand All @@ -81,6 +87,7 @@ type A5 = extern "msp430-interrupt" fn(); //~ ERROR msp430-interrupt ABI is expe
type A6 = extern "ptx-kernel" fn (); //~ ERROR PTX ABIs are experimental and subject to change
type A7 = extern "x86-interrupt" fn(); //~ ERROR x86-interrupt ABI is experimental
type A8 = extern "thiscall" fn(); //~ ERROR thiscall is experimental and subject to change
type A9 = extern "amdgpu-kernel" fn(); //~ ERROR amdgpu-kernel ABI is experimental and subject to change

// Foreign modules
extern "rust-intrinsic" {} //~ ERROR intrinsics are subject to change
Expand All @@ -91,5 +98,6 @@ extern "msp430-interrupt" {} //~ ERROR msp430-interrupt ABI is experimental
extern "ptx-kernel" {} //~ ERROR PTX ABIs are experimental and subject to change
extern "x86-interrupt" {} //~ ERROR x86-interrupt ABI is experimental
extern "thiscall" {} //~ ERROR thiscall is experimental and subject to change
extern "amdgpu-kernel" {} //~ ERROR amdgpu-kernel ABI is experimental and subject to change

fn main() {}
Loading