[PATCH] D23443: (Trivial) TargetPassConfig: assert when TargetMachine has no MCAsmInfo
Alex Bradbury via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 12 03:30:35 PDT 2016
asb created this revision.
asb added reviewers: chandlerc, MatzeB.
asb added a subscriber: llvm-commits.
This is a pretty trivial, but I thought it was worth just checking that nobody feels it's completely the wrong thing to be doing.
The motivation is that when starting a new backend, you often start with a minimal stub, pretty much just FooTargetMachine and FooTargetInfo. Once that's built, you might naturally try `llc -march=foo myinput.ll` and it seems more developer-friendly if this ends up asserting due to the lack of MCAsmInfo with an informative message rather than just segfaulting.
https://reviews.llvm.org/D23443
Files:
lib/CodeGen/TargetPassConfig.cpp
Index: lib/CodeGen/TargetPassConfig.cpp
===================================================================
--- lib/CodeGen/TargetPassConfig.cpp
+++ lib/CodeGen/TargetPassConfig.cpp
@@ -474,7 +474,9 @@
/// Turn exception handling constructs into something the code generators can
/// handle.
void TargetPassConfig::addPassesToHandleExceptions() {
- switch (TM->getMCAsmInfo()->getExceptionHandlingType()) {
+ const MCAsmInfo *MCAI = TM->getMCAsmInfo();
+ assert(MCAI && "No MCAsmInfo");
+ switch (MCAI->getExceptionHandlingType()) {
case ExceptionHandling::SjLj:
// SjLj piggy-backs on dwarf for this bit. The cleanups done apply to both
// Dwarf EH prepare needs to be run after SjLj prepare. Otherwise,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23443.67813.patch
Type: text/x-patch
Size: 725 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160812/9471996e/attachment.bin>
More information about the llvm-commits
mailing list