[llvm] r230135 - Unconditionally create a new MCInstrInfo in the asm printer for
Eric Christopher
echristo at gmail.com
Sat Feb 21 01:09:15 PST 2015
Author: echristo
Date: Sat Feb 21 03:09:15 2015
New Revision: 230135
URL: http://llvm.org/viewvc/llvm-project?rev=230135&view=rev
Log:
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.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp?rev=230135&r1=230134&r2=230135&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp Sat Feb 21 03:09:15 2015
@@ -149,12 +149,11 @@ void AsmPrinter::EmitInlineAsm(StringRef
// 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)
More information about the llvm-commits
mailing list