From ad1ef04ab160848f6e204ad03e35a8a22367befc Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Fri, 20 Feb 2015 08:01:55 +0000 Subject: [PATCH] Save the MachineFunction in startFunction so that we can use it for lookups of the subtarget later. llvm-svn: 229996 --- llvm/lib/Target/X86/X86AsmPrinter.h | 1 + llvm/lib/Target/X86/X86MCInstLower.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Target/X86/X86AsmPrinter.h b/llvm/lib/Target/X86/X86AsmPrinter.h index 3a3cbadc365d..d101b8ca0e4f 100644 --- a/llvm/lib/Target/X86/X86AsmPrinter.h +++ b/llvm/lib/Target/X86/X86AsmPrinter.h @@ -57,6 +57,7 @@ class LLVM_LIBRARY_VISIBILITY X86AsmPrinter : public AsmPrinter { void emitShadowPadding(MCStreamer &OutStreamer, const MCSubtargetInfo &STI); private: TargetMachine &TM; + const MachineFunction *MF; std::unique_ptr CodeEmitter; bool InShadow; diff --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp index e7f5b784bcc4..6af59d43531b 100644 --- a/llvm/lib/Target/X86/X86MCInstLower.cpp +++ b/llvm/lib/Target/X86/X86MCInstLower.cpp @@ -74,10 +74,11 @@ namespace llvm { X86AsmPrinter::StackMapShadowTracker::~StackMapShadowTracker() {} void - X86AsmPrinter::StackMapShadowTracker::startFunction(MachineFunction &MF) { + X86AsmPrinter::StackMapShadowTracker::startFunction(MachineFunction &F) { + MF = &F; CodeEmitter.reset(TM.getTarget().createMCCodeEmitter( - *MF.getSubtarget().getInstrInfo(), *MF.getSubtarget().getRegisterInfo(), - MF.getSubtarget(), MF.getContext())); + *MF->getSubtarget().getInstrInfo(), *MF->getSubtarget().getRegisterInfo(), + MF->getSubtarget(), MF->getContext())); } void X86AsmPrinter::StackMapShadowTracker::count(MCInst &Inst, @@ -99,7 +100,7 @@ namespace llvm { if (InShadow && CurrentShadowSize < RequiredShadowSize) { InShadow = false; EmitNops(OutStreamer, RequiredShadowSize - CurrentShadowSize, - TM.getSubtarget().is64Bit(), STI); + MF->getSubtarget().is64Bit(), STI); } }