mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 15:39:06 +00:00
AMDGPU: Restore using MRI to find highest used regs
If there are no calls, this is a faster path than searching the entire program for calls. This was supposed to be left in r309781. Fixes unused variable warning. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309832 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
810c1b6a3c
commit
981b5410cc
@ -500,7 +500,7 @@ AMDGPUAsmPrinter::SIFunctionResourceInfo AMDGPUAsmPrinter::analyzeResourceUsage(
|
||||
|
||||
// If there are no calls, MachineRegisterInfo can tell us the used register
|
||||
// count easily.
|
||||
|
||||
if (!FrameInfo.hasCalls()) {
|
||||
MCPhysReg HighestVGPRReg = AMDGPU::NoRegister;
|
||||
for (MCPhysReg Reg : reverse(AMDGPU::VGPR_32RegClass.getRegisters())) {
|
||||
if (MRI.isPhysRegUsed(Reg)) {
|
||||
@ -509,6 +509,24 @@ AMDGPUAsmPrinter::SIFunctionResourceInfo AMDGPUAsmPrinter::analyzeResourceUsage(
|
||||
}
|
||||
}
|
||||
|
||||
MCPhysReg HighestSGPRReg = AMDGPU::NoRegister;
|
||||
for (MCPhysReg Reg : reverse(AMDGPU::SGPR_32RegClass.getRegisters())) {
|
||||
if (MRI.isPhysRegUsed(Reg)) {
|
||||
HighestSGPRReg = Reg;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// We found the maximum register index. They start at 0, so add one to get the
|
||||
// number of registers.
|
||||
Info.NumVGPR = HighestVGPRReg == AMDGPU::NoRegister ? 0 :
|
||||
TRI.getHWRegIndex(HighestVGPRReg) + 1;
|
||||
Info.NumExplicitSGPR = HighestSGPRReg == AMDGPU::NoRegister ? 0 :
|
||||
TRI.getHWRegIndex(HighestSGPRReg) + 1;
|
||||
|
||||
return Info;
|
||||
}
|
||||
|
||||
int32_t MaxVGPR = -1;
|
||||
int32_t MaxSGPR = -1;
|
||||
uint32_t CalleeFrameSize = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user