forked from OSchip/llvm-project
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
This commit is contained in:
parent
cde54069f9
commit
3f05e1a19b
|
@ -149,12 +149,11 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, const MDNode *LocMDNode,
|
||||||
// emitInlineAsmEnd().
|
// emitInlineAsmEnd().
|
||||||
MCSubtargetInfo STIOrig = *STI;
|
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
|
// and not have a MachineFunction to initialize the TargetInstrInfo from and
|
||||||
// we only need MCInstrInfo for asm parsing.
|
// we only need MCInstrInfo for asm parsing. We create one unconditionally
|
||||||
const MCInstrInfo *MII =
|
// because it's not subtarget dependent.
|
||||||
MF ? static_cast<const MCInstrInfo *>(MF->getSubtarget().getInstrInfo())
|
std::unique_ptr<MCInstrInfo> MII(TM.getTarget().createMCInstrInfo());
|
||||||
: static_cast<const MCInstrInfo *>(TM.getTarget().createMCInstrInfo());
|
|
||||||
std::unique_ptr<MCTargetAsmParser> TAP(TM.getTarget().createMCAsmParser(
|
std::unique_ptr<MCTargetAsmParser> TAP(TM.getTarget().createMCAsmParser(
|
||||||
*STI, *Parser, *MII, TM.Options.MCOptions));
|
*STI, *Parser, *MII, TM.Options.MCOptions));
|
||||||
if (!TAP)
|
if (!TAP)
|
||||||
|
|
Loading…
Reference in New Issue