[llvm] r257961 - [NVPTX] Do not emit .hidden or .protected directives as they are not allowed by PTX.

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 15:57:53 PST 2016


Author: tra
Date: Fri Jan 15 17:57:53 2016
New Revision: 257961

URL: http://llvm.org/viewvc/llvm-project?rev=257961&view=rev
Log:
[NVPTX] Do not emit .hidden or .protected directives as they are not allowed by PTX.

Added:
    llvm/trunk/test/CodeGen/NVPTX/global-visibility.ll
Modified:
    llvm/trunk/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp

Modified: llvm/trunk/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp?rev=257961&r1=257960&r2=257961&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp Fri Jan 15 17:57:53 2016
@@ -41,6 +41,9 @@ NVPTXMCAsmInfo::NVPTXMCAsmInfo(const Tri
   // PTX does not allow .align on functions.
   HasFunctionAlignment = false;
   HasDotTypeDotSizeDirective = false;
+  // PTX does not allow .hidden or .protected
+  HiddenDeclarationVisibilityAttr = HiddenVisibilityAttr = MCSA_Invalid;
+  ProtectedVisibilityAttr = MCSA_Invalid;
 
   Data8bitsDirective = " .b8 ";
   Data16bitsDirective = " .b16 ";

Added: llvm/trunk/test/CodeGen/NVPTX/global-visibility.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/NVPTX/global-visibility.ll?rev=257961&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/NVPTX/global-visibility.ll (added)
+++ llvm/trunk/test/CodeGen/NVPTX/global-visibility.ll Fri Jan 15 17:57:53 2016
@@ -0,0 +1,16 @@
+; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s
+
+; PTX does not support .hidden or .protected.
+; Make sure we do not emit them.
+
+define hidden void @f_hidden() {
+       ret void
+}
+; CHECK-NOT: .hidden
+; CHECK: .visible .func f_hidden
+
+define protected void @f_protected() {
+       ret void
+}
+; CHECK-NOT: .protected
+; CHECK: .visible .func f_protected




More information about the llvm-commits mailing list