#include "SILowerSGPRSpills.h"
#include "AMDGPU.h"
#include "GCNSubtarget.h"
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
#include "SIMachineFunctionInfo.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/RegisterScavenging.h"
#include "llvm/InitializePasses.h"
usingnamespacellvm;
#define DEBUG_TYPE …
MBBVector;
namespace {
static cl::opt<unsigned> MaxNumVGPRsForWwmAllocation(
"amdgpu-num-vgprs-for-wwm-alloc",
cl::desc("Max num VGPRs for whole-wave register allocation."),
cl::ReallyHidden, cl::init(10));
class SILowerSGPRSpills { … };
class SILowerSGPRSpillsLegacy : public MachineFunctionPass { … };
}
char SILowerSGPRSpillsLegacy::ID = …;
INITIALIZE_PASS_BEGIN(SILowerSGPRSpillsLegacy, DEBUG_TYPE,
"SI lower SGPR spill instructions", false, false)
INITIALIZE_PASS_DEPENDENCY(LiveIntervalsWrapperPass)
INITIALIZE_PASS_DEPENDENCY(VirtRegMap)
INITIALIZE_PASS_DEPENDENCY(MachineDominatorTreeWrapperPass)
INITIALIZE_PASS_END(SILowerSGPRSpillsLegacy, DEBUG_TYPE,
"SI lower SGPR spill instructions", false, false)
char &llvm::SILowerSGPRSpillsLegacyID = …;
static void insertCSRSaves(MachineBasicBlock &SaveBlock,
ArrayRef<CalleeSavedInfo> CSI, SlotIndexes *Indexes,
LiveIntervals *LIS) { … }
static void insertCSRRestores(MachineBasicBlock &RestoreBlock,
MutableArrayRef<CalleeSavedInfo> CSI,
SlotIndexes *Indexes, LiveIntervals *LIS) { … }
void SILowerSGPRSpills::calculateSaveRestoreBlocks(MachineFunction &MF) { … }
static void updateLiveness(MachineFunction &MF, ArrayRef<CalleeSavedInfo> CSI) { … }
bool SILowerSGPRSpills::spillCalleeSavedRegs(
MachineFunction &MF, SmallVectorImpl<int> &CalleeSavedFIs) { … }
void SILowerSGPRSpills::updateLaneVGPRDomInstr(
int FI, MachineBasicBlock *MBB, MachineBasicBlock::iterator InsertPt,
DenseMap<Register, MachineBasicBlock::iterator> &LaneVGPRDomInstr) { … }
void SILowerSGPRSpills::determineRegsForWWMAllocation(MachineFunction &MF,
BitVector &RegMask) { … }
bool SILowerSGPRSpillsLegacy::runOnMachineFunction(MachineFunction &MF) { … }
bool SILowerSGPRSpills::run(MachineFunction &MF) { … }
PreservedAnalyses
SILowerSGPRSpillsPass::run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM) { … }