Save the MachineFunction in startFunction so that we can use it for

lookups of the subtarget later.

llvm-svn: 229996
This commit is contained in:
Eric Christopher 2015-02-20 08:01:55 +00:00
parent 4369c9b42c
commit ad1ef04ab1
2 changed files with 6 additions and 4 deletions

View File

@ -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<MCCodeEmitter> CodeEmitter;
bool InShadow;

View File

@ -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<X86Subtarget>().is64Bit(), STI);
MF->getSubtarget<X86Subtarget>().is64Bit(), STI);
}
}