-bool
-SystemZRegisterInfo::saveScavengerRegister(MachineBasicBlock &MBB,
- MachineBasicBlock::iterator SaveMBBI,
- MachineBasicBlock::iterator &UseMBBI,
- const TargetRegisterClass *RC,
- unsigned Reg) const {
- MachineFunction &MF = *MBB.getParent();
- const SystemZInstrInfo &TII =
- *static_cast<const SystemZInstrInfo*>(TM.getInstrInfo());
- const SystemZFrameLowering *TFI =
- static_cast<const SystemZFrameLowering *>(TM.getFrameLowering());
- unsigned Base = getFrameRegister(MF);
- uint64_t Offset = TFI->getEmergencySpillSlotOffset(MF);
- DebugLoc DL;
-
- unsigned LoadOpcode, StoreOpcode;
- TII.getLoadStoreOpcodes(RC, LoadOpcode, StoreOpcode);
-
- // The offset must always be in range of a 12-bit unsigned displacement.
- BuildMI(MBB, SaveMBBI, DL, TII.get(StoreOpcode))
- .addReg(Reg, RegState::Kill).addReg(Base).addImm(Offset).addReg(0);
- BuildMI(MBB, UseMBBI, DL, TII.get(LoadOpcode), Reg)
- .addReg(Base).addImm(Offset).addReg(0);
- return true;
-}
-