From b661ab1cbd20e18c478f84ee3c8464076d2eb38a 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229996 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86AsmPrinter.h | 1 + lib/Target/X86/X86MCInstLower.cpp | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Target/X86/X86AsmPrinter.h b/lib/Target/X86/X86AsmPrinter.h index 3a3cbadc365..d101b8ca0e4 100644 --- a/lib/Target/X86/X86AsmPrinter.h +++ b/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/lib/Target/X86/X86MCInstLower.cpp b/lib/Target/X86/X86MCInstLower.cpp index e7f5b784bcc..6af59d43531 100644 --- a/lib/Target/X86/X86MCInstLower.cpp +++ b/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); } }