[PATCH] D27638: [NVPTX] Support .maxnreg annotation.

Justin Lebar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 14:43:15 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL289729: [NVPTX] Support .maxnreg annotation. (authored by jlebar).

Changed prior to commit:
  https://reviews.llvm.org/D27638?vs=80968&id=81480#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D27638

Files:
  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


Index: llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
===================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -555,6 +555,10 @@
   unsigned mincta;
   if (llvm::getMinCTASm(F, mincta))
     O << ".minnctapersm " << mincta << "\n";
+
+  unsigned maxnreg;
+  if (llvm::getMaxNReg(F, maxnreg))
+    O << ".maxnreg " << maxnreg << "\n";
 }
 
 std::string
Index: llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.h
===================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.h
+++ llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.h
@@ -57,6 +57,7 @@
 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 &);
Index: llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.cpp
===================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.cpp
+++ llvm/trunk/lib/Target/NVPTX/NVPTXUtilities.cpp
@@ -266,6 +266,10 @@
   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);
Index: llvm/trunk/test/CodeGen/NVPTX/annotations.ll
===================================================================
--- llvm/trunk/test/CodeGen/NVPTX/annotations.ll
+++ llvm/trunk/test/CodeGen/NVPTX/annotations.ll
@@ -29,9 +29,16 @@
   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 @@
 !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}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27638.81480.patch
Type: text/x-patch
Size: 2668 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161214/2719555b/attachment.bin>


More information about the llvm-commits mailing list