[PATCH] D136982: AArch64: Register null MCTargetStreamer

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 28 15:35:25 PDT 2022


arsenm updated this revision to Diff 471675.
arsenm added a comment.

Test


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136982/new/

https://reviews.llvm.org/D136982

Files:
  llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
  llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
  llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.cpp
  llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h
  llvm/test/CodeGen/AArch64/null-mctargetstreamer.ll


Index: llvm/test/CodeGen/AArch64/null-mctargetstreamer.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/null-mctargetstreamer.ll
@@ -0,0 +1,6 @@
+; RUN: llc -mtriple=aarch64-unknown-unknown -filetype=null < %s
+
+define dso_local aarch64_vector_pcs void @foo() {
+  ret void
+}
+
Index: llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h
===================================================================
--- llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h
+++ llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.h
@@ -154,6 +154,8 @@
 MCTargetStreamer *
 createAArch64ObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI);
 
+MCTargetStreamer *createAArch64NullTargetStreamer(MCStreamer &S);
+
 } // end namespace llvm
 
 #endif
Index: llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.cpp
===================================================================
--- llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.cpp
+++ llvm/lib/Target/AArch64/MCTargetDesc/AArch64TargetStreamer.cpp
@@ -119,3 +119,7 @@
     return new AArch64TargetWinCOFFStreamer(S);
   return nullptr;
 }
+
+MCTargetStreamer *llvm::createAArch64NullTargetStreamer(MCStreamer &S) {
+  return new AArch64TargetStreamer(S);
+}
Index: llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
===================================================================
--- llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
+++ llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp
@@ -495,6 +495,10 @@
     // Register the asm streamer.
     TargetRegistry::RegisterAsmTargetStreamer(*T,
                                               createAArch64AsmTargetStreamer);
+    // Register the null streamer.
+    TargetRegistry::RegisterNullTargetStreamer(*T,
+                                               createAArch64NullTargetStreamer);
+
     // Register the MCInstPrinter.
     TargetRegistry::RegisterMCInstPrinter(*T, createAArch64MCInstPrinter);
   }
Index: llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
+++ llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
@@ -248,9 +248,9 @@
     return;
 
   // Emit a .note.gnu.property section with the flags.
-  if (auto *TS = static_cast<AArch64TargetStreamer *>(
-          OutStreamer->getTargetStreamer()))
-    TS->emitNoteSection(Flags);
+  auto *TS =
+      static_cast<AArch64TargetStreamer *>(OutStreamer->getTargetStreamer());
+  TS->emitNoteSection(Flags);
 }
 
 void AArch64AsmPrinter::emitFunctionHeaderComment() {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136982.471675.patch
Type: text/x-patch
Size: 2692 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221028/044ea53a/attachment.bin>


More information about the llvm-commits mailing list