1 //===----------------------- SIFrameLowering.cpp --------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //==-----------------------------------------------------------------------===//
10 #include "SIFrameLowering.h"
11 #include "SIRegisterInfo.h"
12 #include "llvm/CodeGen/MachineFrameInfo.h"
13 #include "llvm/CodeGen/MachineFunction.h"
14 #include "llvm/CodeGen/RegisterScavenging.h"
18 void SIFrameLowering::processFunctionBeforeFrameFinalized(
20 RegScavenger *RS) const {
21 MachineFrameInfo *MFI = MF.getFrameInfo();
22 bool MayNeedScavengingEmergencySlot = MFI->hasStackObjects();
24 assert((RS || !MayNeedScavengingEmergencySlot) &&
25 "RegScavenger required if spilling");
27 if (MayNeedScavengingEmergencySlot) {
28 int ScavengeFI = MFI->CreateSpillStackObject(
29 AMDGPU::SGPR_32RegClass.getSize(),
30 AMDGPU::SGPR_32RegClass.getAlignment());
31 RS->addScavengingFrameIndex(ScavengeFI);