[llvm] r289729 - [NVPTX] Support .maxnreg annotation.
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 14 14:32:50 PST 2016
Author: jlebar
Date: Wed Dec 14 16:32:50 2016
New Revision: 289729
URL: http://llvm.org/viewvc/llvm-project?rev=289729&view=rev
Log:
[NVPTX] Support .maxnreg annotation.
Reviewers: tra
Subscribers: llvm-commits, jholewinski
Differential Revision: https://reviews.llvm.org/D27638
Modified:
llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.cpp
llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.h
llvm/trunk/test/CodeGen/NVPTX/annotations.ll
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp?rev=289729&r1=289728&r2=289729&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp Wed Dec 14 16:32:50 2016
@@ -555,6 +555,10 @@ void NVPTXAsmPrinter::emitKernelFunction
unsigned mincta;
if (llvm::getMinCTASm(F, mincta))
O << ".minnctapersm " << mincta << "\n";
+
+ unsigned maxnreg;
+ if (llvm::getMaxNReg(F, maxnreg))
+ O << ".maxnreg " << maxnreg << "\n";
}
std::string
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.cpp?rev=289729&r1=289728&r2=289729&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.cpp Wed Dec 14 16:32:50 2016
@@ -266,6 +266,10 @@ bool getMinCTASm(const Function &F, unsi
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);
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.h?rev=289729&r1=289728&r2=289729&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.h (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.h Wed Dec 14 16:32:50 2016
@@ -57,6 +57,7 @@ bool getReqNTIDy(const Function &, unsig
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 &);
Modified: llvm/trunk/test/CodeGen/NVPTX/annotations.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/NVPTX/annotations.ll?rev=289729&r1=289728&r2=289729&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/NVPTX/annotations.ll (original)
+++ llvm/trunk/test/CodeGen/NVPTX/annotations.ll Wed Dec 14 16:32:50 2016
@@ -29,9 +29,16 @@ define void @kernel_func_minctasm(float*
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*
!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}
More information about the llvm-commits
mailing list