Remove caching of the subtarget for X86FrameLowering.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210290 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher 2014-06-05 22:00:31 +00:00
parent 6d18c24e99
commit d334d25a10
2 changed files with 9 additions and 6 deletions

View File

@ -411,6 +411,7 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF) const {
uint64_t MaxAlign = MFI->getMaxAlignment(); // Desired stack alignment. uint64_t MaxAlign = MFI->getMaxAlignment(); // Desired stack alignment.
uint64_t StackSize = MFI->getStackSize(); // Number of bytes to allocate. uint64_t StackSize = MFI->getStackSize(); // Number of bytes to allocate.
bool HasFP = hasFP(MF); bool HasFP = hasFP(MF);
const X86Subtarget &STI = MF.getTarget().getSubtarget<X86Subtarget>();
bool Is64Bit = STI.is64Bit(); bool Is64Bit = STI.is64Bit();
bool IsLP64 = STI.isTarget64BitLP64(); bool IsLP64 = STI.isTarget64BitLP64();
bool IsWin64 = STI.isTargetWin64(); bool IsWin64 = STI.isTargetWin64();
@ -728,6 +729,7 @@ void X86FrameLowering::emitEpilogue(MachineFunction &MF,
assert(MBBI != MBB.end() && "Returning block has no instructions"); assert(MBBI != MBB.end() && "Returning block has no instructions");
unsigned RetOpcode = MBBI->getOpcode(); unsigned RetOpcode = MBBI->getOpcode();
DebugLoc DL = MBBI->getDebugLoc(); DebugLoc DL = MBBI->getDebugLoc();
const X86Subtarget &STI = MF.getTarget().getSubtarget<X86Subtarget>();
bool Is64Bit = STI.is64Bit(); bool Is64Bit = STI.is64Bit();
bool IsLP64 = STI.isTarget64BitLP64(); bool IsLP64 = STI.isTarget64BitLP64();
bool UseLEA = STI.useLeaForSP(); bool UseLEA = STI.useLeaForSP();
@ -990,6 +992,7 @@ bool X86FrameLowering::spillCalleeSavedRegisters(MachineBasicBlock &MBB,
const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo(); const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo();
X86MachineFunctionInfo *X86FI = MF.getInfo<X86MachineFunctionInfo>(); X86MachineFunctionInfo *X86FI = MF.getInfo<X86MachineFunctionInfo>();
const X86Subtarget &STI = MF.getTarget().getSubtarget<X86Subtarget>();
// Push GPRs. It increases frame size. // Push GPRs. It increases frame size.
unsigned Opc = STI.is64Bit() ? X86::PUSH64r : X86::PUSH32r; unsigned Opc = STI.is64Bit() ? X86::PUSH64r : X86::PUSH32r;
@ -1039,6 +1042,7 @@ bool X86FrameLowering::restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
MachineFunction &MF = *MBB.getParent(); MachineFunction &MF = *MBB.getParent();
const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo(); const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo();
const X86Subtarget &STI = MF.getTarget().getSubtarget<X86Subtarget>();
// Reload XMMs from stack frame. // Reload XMMs from stack frame.
for (unsigned i = 0, e = CSI.size(); i != e; ++i) { for (unsigned i = 0, e = CSI.size(); i != e; ++i) {
@ -1167,6 +1171,7 @@ X86FrameLowering::adjustForSegmentedStacks(MachineFunction &MF) const {
MachineFrameInfo *MFI = MF.getFrameInfo(); MachineFrameInfo *MFI = MF.getFrameInfo();
const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo(); const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo();
uint64_t StackSize; uint64_t StackSize;
const X86Subtarget &STI = MF.getTarget().getSubtarget<X86Subtarget>();
bool Is64Bit = STI.is64Bit(); bool Is64Bit = STI.is64Bit();
unsigned TlsReg, TlsOffset; unsigned TlsReg, TlsOffset;
DebugLoc DL; DebugLoc DL;
@ -1378,6 +1383,7 @@ void X86FrameLowering::adjustForHiPEPrologue(MachineFunction &MF) const {
const unsigned SlotSize = const unsigned SlotSize =
static_cast<const X86RegisterInfo *>(MF.getTarget().getRegisterInfo()) static_cast<const X86RegisterInfo *>(MF.getTarget().getRegisterInfo())
->getSlotSize(); ->getSlotSize();
const X86Subtarget &STI = MF.getTarget().getSubtarget<X86Subtarget>();
const bool Is64Bit = STI.is64Bit(); const bool Is64Bit = STI.is64Bit();
DebugLoc DL; DebugLoc DL;
// HiPE-specific values // HiPE-specific values
@ -1513,6 +1519,7 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
bool reseveCallFrame = hasReservedCallFrame(MF); bool reseveCallFrame = hasReservedCallFrame(MF);
int Opcode = I->getOpcode(); int Opcode = I->getOpcode();
bool isDestroy = Opcode == TII.getCallFrameDestroyOpcode(); bool isDestroy = Opcode == TII.getCallFrameDestroyOpcode();
const X86Subtarget &STI = MF.getTarget().getSubtarget<X86Subtarget>();
bool IsLP64 = STI.isTarget64BitLP64(); bool IsLP64 = STI.isTarget64BitLP64();
DebugLoc DL = I->getDebugLoc(); DebugLoc DL = I->getDebugLoc();
uint64_t Amount = !reseveCallFrame ? I->getOperand(0).getImm() : 0; uint64_t Amount = !reseveCallFrame ? I->getOperand(0).getImm() : 0;

View File

@ -23,14 +23,10 @@ class MCSymbol;
class X86TargetMachine; class X86TargetMachine;
class X86FrameLowering : public TargetFrameLowering { class X86FrameLowering : public TargetFrameLowering {
const X86Subtarget &STI;
public: public:
explicit X86FrameLowering(const X86Subtarget &sti) explicit X86FrameLowering(const X86Subtarget &sti)
: TargetFrameLowering(StackGrowsDown, : TargetFrameLowering(StackGrowsDown, sti.getStackAlignment(),
sti.getStackAlignment(), (sti.is64Bit() ? -8 : -4)) {}
(sti.is64Bit() ? -8 : -4)),
STI(sti) {
}
void emitCalleeSavedFrameMoves(MachineBasicBlock &MBB, void emitCalleeSavedFrameMoves(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MBBI, DebugLoc DL, MachineBasicBlock::iterator MBBI, DebugLoc DL,