Skip to content

Commit

Permalink
AMDGPU: Also track whether SGPRs were spilled
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252145 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
arsenm committed Nov 5, 2015
1 parent 35a96b8 commit 26c7483
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/Target/AMDGPU/SIInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@ void SIInstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
int Opcode = -1;

if (RI.isSGPRClass(RC)) {
MFI->setHasSpilledSGPRs();

// We are only allowed to create one new instruction when spilling
// registers, so we need to use pseudo instruction for spilling
// SGPRs.
Expand Down
1 change: 1 addition & 0 deletions lib/Target/AMDGPU/SIMachineFunctionInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ void SIMachineFunctionInfo::anchor() {}
SIMachineFunctionInfo::SIMachineFunctionInfo(const MachineFunction &MF)
: AMDGPUMachineFunction(MF),
TIDReg(AMDGPU::NoRegister),
HasSpilledSGPRs(false),
HasSpilledVGPRs(false),
PSInputAddr(0),
NumUserSGPRs(0),
Expand Down
19 changes: 17 additions & 2 deletions lib/Target/AMDGPU/SIMachineFunctionInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class SIMachineFunctionInfo : public AMDGPUMachineFunction {
void anchor() override;

unsigned TIDReg;
bool HasSpilledSGPRs;
bool HasSpilledVGPRs;

public:
Expand All @@ -54,8 +55,22 @@ class SIMachineFunctionInfo : public AMDGPUMachineFunction {
bool hasCalculatedTID() const { return TIDReg != AMDGPU::NoRegister; };
unsigned getTIDReg() const { return TIDReg; };
void setTIDReg(unsigned Reg) { TIDReg = Reg; }
bool hasSpilledVGPRs() const { return HasSpilledVGPRs; }
void setHasSpilledVGPRs(bool Spill = true) { HasSpilledVGPRs = Spill; }

bool hasSpilledSGPRs() const {
return HasSpilledSGPRs;
}

void setHasSpilledSGPRs(bool Spill = true) {
HasSpilledSGPRs = Spill;
}

bool hasSpilledVGPRs() const {
return HasSpilledVGPRs;
}

void setHasSpilledVGPRs(bool Spill = true) {
HasSpilledVGPRs = Spill;
}

unsigned getMaximumWorkGroupSize(const MachineFunction &MF) const;
};
Expand Down

0 comments on commit 26c7483

Please sign in to comment.