[PATCH] D136982: AArch64: Register null MCTargetStreamer
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 28 14:04:53 PDT 2022
arsenm created this revision.
arsenm added reviewers: paquette, aemerson, t.p.northover, MaskRay.
Herald added subscribers: StephenFan, hiraditya, kristof.beyls.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.
Fixes crashes with clang -emit-codegen-only
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
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.471647.patch
Type: text/x-patch
Size: 2346 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221028/b8e61bed/attachment.bin>
More information about the llvm-commits
mailing list