[llvm] 4b91f96 - [AIX][AsmPrinter] Print Global Variable in comments

Jinsong Ji via llvm-commits llvm-commits at lists.llvm.org
Sat May 15 20:25:36 PDT 2021


Author: Jinsong Ji
Date: 2021-05-16T03:04:46Z
New Revision: 4b91f96a3e291db1ea6360c9a842ecbc6ee89d67

URL: https://github.com/llvm/llvm-project/commit/4b91f96a3e291db1ea6360c9a842ecbc6ee89d67
DIFF: https://github.com/llvm/llvm-project/commit/4b91f96a3e291db1ea6360c9a842ecbc6ee89d67.diff

LOG: [AIX][AsmPrinter] Print Global Variable in comments

The default AsmPrinter print GV in comments,
AIX should do so too.

This also fix LLVM :: CodeGen/Generic/inline-asm-mem-clobber.ll.

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D102534

Added: 
    

Modified: 
    llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 9ddc60b5152c3..d71b1187e5348 100644
--- a/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -2183,6 +2183,15 @@ void PPCAIXAsmPrinter::emitGlobalVariableHelper(const GlobalVariable *GV) {
     report_fatal_error("Encountered a global variable kind that is "
                        "not supported yet.");
 
+  // Print GV in verbose mode
+  if (isVerbose()) {
+    if (GV->hasInitializer()) {
+      GV->printAsOperand(OutStreamer->GetCommentOS(),
+                         /*PrintType=*/false, GV->getParent());
+      OutStreamer->GetCommentOS() << '\n';
+    }
+  }
+
   MCSectionXCOFF *Csect = cast<MCSectionXCOFF>(
       getObjFileLowering().SectionForGlobal(GV, GVKind, TM));
 


        


More information about the llvm-commits mailing list