diff options
author | Eric Christopher <echristo@gmail.com> | 2015-02-19 21:24:23 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2015-02-19 21:24:23 +0000 |
commit | 457864178fa4fc6b8a1f7bb1099cfd98751823bd (patch) | |
tree | b23c0a494a5152441bffb34f9643cd695b3de20b /llvm/lib/CodeGen | |
parent | 4343922ddef51199854243d3beded0443fcd3a3e (diff) | |
download | bcm5719-llvm-457864178fa4fc6b8a1f7bb1099cfd98751823bd.tar.gz bcm5719-llvm-457864178fa4fc6b8a1f7bb1099cfd98751823bd.zip |
Remove a call to TargetMachine::getSubtarget from the inline
asm support in the asm printer. If we can get a subtarget from
the machine function then we should do so, otherwise we can
go ahead and create a default one since we're at the module
level.
llvm-svn: 229916
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp index 4dd41ca678e..a8b00561fe7 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp @@ -92,7 +92,17 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, const MDNode *LocMDNode, !OutStreamer.isIntegratedAssemblerRequired()) { emitInlineAsmStart(); OutStreamer.EmitRawText(Str); - emitInlineAsmEnd(TM.getSubtarget<MCSubtargetInfo>(), nullptr); + // If we have a machine function then grab the MCSubtarget off of that, + // otherwise we're at the module level and want to construct one from + // the default CPU and target triple. + if (MF) { + emitInlineAsmEnd(MF->getSubtarget<MCSubtargetInfo>(), nullptr); + } else { + std::unique_ptr<MCSubtargetInfo> STI(TM.getTarget().createMCSubtargetInfo( + TM.getTargetTriple(), TM.getTargetCPU(), + TM.getTargetFeatureString())); + emitInlineAsmEnd(*STI, nullptr); + } return; } |