@@ -2037,6 +2037,7 @@ bool X86InstrInfo::spillCalleeSavedRegisters(MachineBasicBlock &MBB,
2037
2037
if (MI != MBB.end ()) DL = MI->getDebugLoc ();
2038
2038
2039
2039
bool is64Bit = TM.getSubtarget <X86Subtarget>().is64Bit ();
2040
+ bool isWin64 = TM.getSubtarget <X86Subtarget>().isTargetWin64 ();
2040
2041
unsigned SlotSize = is64Bit ? 8 : 4 ;
2041
2042
2042
2043
MachineFunction &MF = *MBB.getParent ();
@@ -2053,7 +2054,7 @@ bool X86InstrInfo::spillCalleeSavedRegisters(MachineBasicBlock &MBB,
2053
2054
if (Reg == FPReg)
2054
2055
// X86RegisterInfo::emitPrologue will handle spilling of frame register.
2055
2056
continue ;
2056
- if (RegClass != &X86::VR128RegClass) {
2057
+ if (RegClass != &X86::VR128RegClass && !isWin64 ) {
2057
2058
CalleeFrameSize += SlotSize;
2058
2059
BuildMI (MBB, MI, DL, get (Opc)).addReg (Reg, RegState::Kill);
2059
2060
} else {
@@ -2077,14 +2078,15 @@ bool X86InstrInfo::restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
2077
2078
MachineFunction &MF = *MBB.getParent ();
2078
2079
unsigned FPReg = RI.getFrameRegister (MF);
2079
2080
bool is64Bit = TM.getSubtarget <X86Subtarget>().is64Bit ();
2081
+ bool isWin64 = TM.getSubtarget <X86Subtarget>().isTargetWin64 ();
2080
2082
unsigned Opc = is64Bit ? X86::POP64r : X86::POP32r;
2081
2083
for (unsigned i = 0 , e = CSI.size (); i != e; ++i) {
2082
2084
unsigned Reg = CSI[i].getReg ();
2083
2085
if (Reg == FPReg)
2084
2086
// X86RegisterInfo::emitEpilogue will handle restoring of frame register.
2085
2087
continue ;
2086
2088
const TargetRegisterClass *RegClass = CSI[i].getRegClass ();
2087
- if (RegClass != &X86::VR128RegClass) {
2089
+ if (RegClass != &X86::VR128RegClass && !isWin64 ) {
2088
2090
BuildMI (MBB, MI, DL, get (Opc), Reg);
2089
2091
} else {
2090
2092
loadRegFromStackSlot (MBB, MI, Reg, CSI[i].getFrameIdx (), RegClass);
0 commit comments