diff options
| author | Justin Lebar <jlebar@google.com> | 2016-12-14 22:32:50 +0000 |
|---|---|---|
| committer | Justin Lebar <jlebar@google.com> | 2016-12-14 22:32:50 +0000 |
| commit | 19bf9d2b6d9f87eb9726fd7fe7c66d7986333621 (patch) | |
| tree | 3c1dc57fe2a1138539a756bbcff62cca1ee1e97b /llvm | |
| parent | e6867085fa6c26926e02191bae76b2a5fc202c3f (diff) | |
| download | bcm5719-llvm-19bf9d2b6d9f87eb9726fd7fe7c66d7986333621.tar.gz bcm5719-llvm-19bf9d2b6d9f87eb9726fd7fe7c66d7986333621.zip | |
[NVPTX] Support .maxnreg annotation.
Reviewers: tra
Subscribers: llvm-commits, jholewinski
Differential Revision: https://reviews.llvm.org/D27638
llvm-svn: 289729
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/Target/NVPTX/NVPTXUtilities.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/Target/NVPTX/NVPTXUtilities.h | 1 | ||||
| -rw-r--r-- | llvm/test/CodeGen/NVPTX/annotations.ll | 16 |
4 files changed, 22 insertions, 3 deletions
diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp index 9d21629016a..04c8d5c0443 100644 --- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp @@ -555,6 +555,10 @@ void NVPTXAsmPrinter::emitKernelFunctionDirectives(const Function &F, unsigned mincta; if (llvm::getMinCTASm(F, mincta)) O << ".minnctapersm " << mincta << "\n"; + + unsigned maxnreg; + if (llvm::getMaxNReg(F, maxnreg)) + O << ".maxnreg " << maxnreg << "\n"; } std::string diff --git a/llvm/lib/Target/NVPTX/NVPTXUtilities.cpp b/llvm/lib/Target/NVPTX/NVPTXUtilities.cpp index e1264d0defb..ba5c054b09c 100644 --- a/llvm/lib/Target/NVPTX/NVPTXUtilities.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXUtilities.cpp @@ -266,6 +266,10 @@ bool getMinCTASm(const Function &F, unsigned &x) { return findOneNVVMAnnotation(&F, "minctasm", x); } +bool getMaxNReg(const Function &F, unsigned &x) { + return findOneNVVMAnnotation(&F, "maxnreg", x); +} + bool isKernelFunction(const Function &F) { unsigned x = 0; bool retval = findOneNVVMAnnotation(&F, "kernel", x); diff --git a/llvm/lib/Target/NVPTX/NVPTXUtilities.h b/llvm/lib/Target/NVPTX/NVPTXUtilities.h index 2e641e8937e..0b189cde920 100644 --- a/llvm/lib/Target/NVPTX/NVPTXUtilities.h +++ b/llvm/lib/Target/NVPTX/NVPTXUtilities.h @@ -57,6 +57,7 @@ bool getReqNTIDy(const Function &, unsigned &); bool getReqNTIDz(const Function &, unsigned &); bool getMinCTASm(const Function &, unsigned &); +bool getMaxNReg(const Function &, unsigned &); bool isKernelFunction(const Function &); bool getAlign(const Function &, unsigned index, unsigned &); diff --git a/llvm/test/CodeGen/NVPTX/annotations.ll b/llvm/test/CodeGen/NVPTX/annotations.ll index 2341377d75a..010b9f537f1 100644 --- a/llvm/test/CodeGen/NVPTX/annotations.ll +++ b/llvm/test/CodeGen/NVPTX/annotations.ll @@ -29,9 +29,16 @@ define void @kernel_func_minctasm(float* %a) { ret void } +; CHECK-LABEL: .entry kernel_func_maxnreg +define void @kernel_func_maxnreg() { +; CHECK: .maxnreg 1234 +; CHECK: ret + ret void +} -!nvvm.annotations = !{!1, !2, !3, !4, !5, !6, !7, !8} + +!nvvm.annotations = !{!1, !2, !3, !4, !5, !6, !7, !8, !9, !10} !1 = !{void (float*)* @kernel_func_maxntid, !"kernel", i32 1} !2 = !{void (float*)* @kernel_func_maxntid, !"maxntidx", i32 10, !"maxntidy", i32 20, !"maxntidz", i32 30} @@ -42,5 +49,8 @@ define void @kernel_func_minctasm(float* %a) { !5 = !{void (float*)* @kernel_func_minctasm, !"kernel", i32 1} !6 = !{void (float*)* @kernel_func_minctasm, !"minctasm", i32 42} -!7 = !{i64 addrspace(1)* @texture, !"texture", i32 1} -!8 = !{i64 addrspace(1)* @surface, !"surface", i32 1} +!7 = !{void ()* @kernel_func_maxnreg, !"kernel", i32 1} +!8 = !{void ()* @kernel_func_maxnreg, !"maxnreg", i32 1234} + +!9 = !{i64 addrspace(1)* @texture, !"texture", i32 1} +!10 = !{i64 addrspace(1)* @surface, !"surface", i32 1} |

