summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2015-02-19 23:52:35 +0000
committerEric Christopher <echristo@gmail.com>2015-02-19 23:52:35 +0000
commit2105ae98f6c84a133e5298cea4e53bd9bebb6ca2 (patch)
treed3593f67123335e07a1ba1587b3cfac83c596184 /llvm
parent72379706ea74e0c837d2fe931925ac56c7b890e0 (diff)
downloadbcm5719-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')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp6
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");
OpenPOWER on IntegriCloud