[PATCH] D16202: [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
Thu Jan 14 11:24:05 PST 2016


tra created this revision.
tra added reviewers: echristo, jholewinski.
tra added a subscriber: llvm-commits.
Herald added a subscriber: jholewinski.

http://reviews.llvm.org/D16202

Files:
  lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp
  test/CodeGen/NVPTX/global-visibility.ll

Index: test/CodeGen/NVPTX/global-visibility.ll
===================================================================
--- /dev/null
+++ test/CodeGen/NVPTX/global-visibility.ll
@@ -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
Index: lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp
===================================================================
--- lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp
+++ lib/Target/NVPTX/MCTargetDesc/NVPTXMCAsmInfo.cpp
@@ -41,6 +41,9 @@
   // 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 ";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16202.44910.patch
Type: text/x-patch
Size: 1166 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160114/ab8a2cb9/attachment.bin>


More information about the llvm-commits mailing list