diff options
author | Eric Christopher <echristo@gmail.com> | 2015-02-19 23:52:35 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2015-02-19 23:52:35 +0000 |
commit | 2105ae98f6c84a133e5298cea4e53bd9bebb6ca2 (patch) | |
tree | d3593f67123335e07a1ba1587b3cfac83c596184 /llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp | |
parent | 72379706ea74e0c837d2fe931925ac56c7b890e0 (diff) | |
download | bcm5719-llvm-2105ae98f6c84a133e5298cea4e53bd9bebb6ca2.tar.gz bcm5719-llvm-2105ae98f6c84a133e5298cea4e53bd9bebb6ca2.zip |
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.
llvm-svn: 229931
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp index a2e5460a6c6..57f05be35c9 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp @@ -148,8 +148,12 @@ 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 + // 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"); |