summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2015-02-21 09:09:15 +0000
committerEric Christopher <echristo@gmail.com>2015-02-21 09:09:15 +0000
commit3f05e1a19bc9f588272ab1847a5093e4162f3f5e (patch)
treeb1bf0397e18300c5707bfa7cfbb94dddfdc1416f /llvm
parentcde54069f912b266d998a4679a5235834ceefdac (diff)
downloadbcm5719-llvm-3f05e1a19bc9f588272ab1847a5093e4162f3f5e.tar.gz
bcm5719-llvm-3f05e1a19bc9f588272ab1847a5093e4162f3f5e.zip
Unconditionally create a new MCInstrInfo in the asm printer for
asm parsing since it's not subtarget dependent and we can't depend upon the one hanging off the MachineFunction's subtarget still being around. llvm-svn: 230135
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
index c95777e40d1..e6e7c973c18 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -149,12 +149,11 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, const MDNode *LocMDNode,
// emitInlineAsmEnd().
MCSubtargetInfo STIOrig = *STI;
- // We may create a new MCInstrInfo here since we might be at the module level
+ // We create a new MCInstrInfo here since we might be at the module level
// and not have a MachineFunction to initialize the TargetInstrInfo from and
- // we only need MCInstrInfo for asm parsing.
- const MCInstrInfo *MII =
- MF ? static_cast<const MCInstrInfo *>(MF->getSubtarget().getInstrInfo())
- : static_cast<const MCInstrInfo *>(TM.getTarget().createMCInstrInfo());
+ // we only need MCInstrInfo for asm parsing. We create one unconditionally
+ // because it's not subtarget dependent.
+ std::unique_ptr<MCInstrInfo> MII(TM.getTarget().createMCInstrInfo());
std::unique_ptr<MCTargetAsmParser> TAP(TM.getTarget().createMCAsmParser(
*STI, *Parser, *MII, TM.Options.MCOptions));
if (!TAP)
OpenPOWER on IntegriCloud