[llvm] r229931 - Only use the initialized MCInstrInfo if it's been initialized already
Eric Christopher
echristo at gmail.com
Thu Feb 19 15:52:35 PST 2015
Author: echristo
Date: Thu Feb 19 17:52:35 2015
New Revision: 229931
URL: http://llvm.org/viewvc/llvm-project?rev=229931&view=rev
Log:
Only use the initialized MCInstrInfo if it's been initialized already
during SetupMachineFunction. This is also the single use of MII
and it'll be changing to TargetInstrInfo (which is MachineFunction
based) in the next commit here.
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=229931&r1=229930&r2=229931&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp Thu Feb 19 17:52:35 2015
@@ -148,8 +148,12 @@ void AsmPrinter::EmitInlineAsm(StringRef
// emitInlineAsmEnd().
MCSubtargetInfo STIOrig = *STI;
+ // We may 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.
std::unique_ptr<MCTargetAsmParser> TAP(TM.getTarget().createMCAsmParser(
- *STI, *Parser, *MII, TM.Options.MCOptions));
+ *STI, *Parser, MII ? *MII : *TM.getTarget().createMCInstrInfo(),
+ TM.Options.MCOptions));
if (!TAP)
report_fatal_error("Inline asm not supported by this streamer because"
" we don't have an asm parser for this target\n");
More information about the llvm-commits
mailing list