[PATCH] D120493: [NVPTX][AsmPrinter] Emit .attribute(.managed) for global variable declarations
Kristina Bessonova via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 24 08:36:56 PST 2022
krisb created this revision.
krisb added reviewers: tra, jholewinski.
Herald added subscribers: asavonic, hiraditya.
krisb requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Declaration and definition attributes must match,
otherwise it may cause issues on linking.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D120493
Files:
llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
llvm/test/CodeGen/NVPTX/managed.ll
Index: llvm/test/CodeGen/NVPTX/managed.ll
===================================================================
--- llvm/test/CodeGen/NVPTX/managed.ll
+++ llvm/test/CodeGen/NVPTX/managed.ll
@@ -6,6 +6,11 @@
; CHECK: .visible .global .attribute(.managed) .align 4 .u32 managed_g;
@managed_g = addrspace(1) global i32 zeroinitializer
+; CHECK: .extern .global .align 4 .u32 decl_g;
+ at decl_g = external addrspace(1) global i32, align 4
+; CHECK: .extern .global .attribute(.managed) .align 8 .b32 managed_decl_g;
+ at managed_decl_g = external addrspace(1) global i32*, align 8
-!nvvm.annotations = !{!0}
+!nvvm.annotations = !{!0, !1}
!0 = !{i32 addrspace(1)* @managed_g, !"managed", i32 1}
+!1 = !{i32* addrspace(1)* @managed_decl_g, !"managed", i32 1}
Index: llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
===================================================================
--- llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -1290,6 +1290,8 @@
O << ".";
emitPTXAddressSpace(GVar->getType()->getAddressSpace(), O);
+ if (isManaged(*GVar))
+ O << " .attribute(.managed)";
if (MaybeAlign A = GVar->getAlign())
O << " .align " << A->value();
else
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120493.411144.patch
Type: text/x-patch
Size: 1207 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220224/3e27c011/attachment-0001.bin>
More information about the llvm-commits
mailing list