Expose isXxxConstant() functions from SelectionDAGNodes.h (NFC)
[oota-llvm.git] / lib / Target / AMDGPU / SIFrameLowering.cpp
1 //===----------------------- SIFrameLowering.cpp --------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //==-----------------------------------------------------------------------===//
9
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"
15
16 using namespace llvm;
17
18 void SIFrameLowering::processFunctionBeforeFrameFinalized(
19   MachineFunction &MF,
20   RegScavenger *RS) const {
21   MachineFrameInfo *MFI = MF.getFrameInfo();
22   bool MayNeedScavengingEmergencySlot = MFI->hasStackObjects();
23
24   assert((RS || !MayNeedScavengingEmergencySlot) &&
25          "RegScavenger required if spilling");
26
27   if (MayNeedScavengingEmergencySlot) {
28     int ScavengeFI = MFI->CreateSpillStackObject(
29       AMDGPU::SGPR_32RegClass.getSize(),
30       AMDGPU::SGPR_32RegClass.getAlignment());
31     RS->addScavengingFrameIndex(ScavengeFI);
32   }
33 }