diff options
| author | Yaxun Liu <Yaxun.Liu@amd.com> | 2018-04-20 17:01:03 +0000 |
|---|---|---|
| committer | Yaxun Liu <Yaxun.Liu@amd.com> | 2018-04-20 17:01:03 +0000 |
| commit | 4306f2086fe838591f2d1fe041ef73b643aa99ee (patch) | |
| tree | ddedd75da98d4b292b315f7fdfc818077d9b5f9c /clang/lib/CodeGen/TargetInfo.cpp | |
| parent | e268304122d827396979c61251f2862148ad01c8 (diff) | |
| download | bcm5719-llvm-4306f2086fe838591f2d1fe041ef73b643aa99ee.tar.gz bcm5719-llvm-4306f2086fe838591f2d1fe041ef73b643aa99ee.zip | |
[CUDA] Set LLVM calling convention for CUDA kernel
Some targets need special LLVM calling convention for CUDA kernel.
This patch does that through a TargetCodeGenInfo hook.
It only affects amdgcn target.
Patch by Greg Rodgers.
Revised and lit tests added by Yaxun Liu.
Differential Revision: https://reviews.llvm.org/D45223
llvm-svn: 330447
Diffstat (limited to 'clang/lib/CodeGen/TargetInfo.cpp')
| -rw-r--r-- | clang/lib/CodeGen/TargetInfo.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 5e842fabbf8..99e4b0de3e9 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -7637,6 +7637,7 @@ public: llvm::Function *BlockInvokeFunc, llvm::Value *BlockLiteral) const override; bool shouldEmitStaticExternCAliases() const override; + void setCUDAKernelCallingConvention(llvm::Function *F) const override; }; } @@ -7772,6 +7773,11 @@ bool AMDGPUTargetCodeGenInfo::shouldEmitStaticExternCAliases() const { return false; } +void AMDGPUTargetCodeGenInfo::setCUDAKernelCallingConvention( + llvm::Function *F) const { + F->setCallingConv(llvm::CallingConv::AMDGPU_KERNEL); +} + //===----------------------------------------------------------------------===// // SPARC v8 ABI Implementation. // Based on the SPARC Compliance Definition version 2.4.1. |

