summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2015-02-20 06:35:21 +0000
committerEric Christopher <echristo@gmail.com>2015-02-20 06:35:21 +0000
commit97ea7622b5001e08c76f35b2d9ca7cde5d520f94 (patch)
tree27d6263956431c5eaed0ca5f1ea76ba1ff3da30b /llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
parent9a3644c4725fcd72b8100f77d75365f4b3711067 (diff)
downloadbcm5719-llvm-97ea7622b5001e08c76f35b2d9ca7cde5d520f94.tar.gz
bcm5719-llvm-97ea7622b5001e08c76f35b2d9ca7cde5d520f94.zip
Remove the MCInstrInfo cached variable as it was only used in a
single place and replace calls to getSubtargetImpl with calls to get the subtarget from the MachineFunction where valid. llvm-svn: 229971
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
index d24a2a23d46..2ece39a73f6 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -32,6 +32,7 @@
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h"
@@ -151,10 +152,13 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, const MDNode *LocMDNode,
// 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.
+ const MCInstrInfo *MII = MF
+ ? MII = static_cast<const MCInstrInfo *>(
+ MF->getSubtarget().getInstrInfo())
+ : MII = static_cast<const MCInstrInfo *>(
+ TM.getTarget().createMCInstrInfo());
std::unique_ptr<MCTargetAsmParser> TAP(TM.getTarget().createMCAsmParser(
- *STI, *Parser, MII ? *MII : *static_cast<const MCInstrInfo *>(
- TM.getTarget().createMCInstrInfo()),
- TM.Options.MCOptions));
+ *STI, *Parser, *MII, 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