Skip to content

Commit 88441d1

Browse files
committed
[AMDGPU][MIR] Serialize NumPhysicalVGPRSpillLanes
1 parent bf01bb8 commit 88441d1

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -694,22 +694,22 @@ yaml::SIMachineFunctionInfo::SIMachineFunctionInfo(
694694
const llvm::MachineFunction &MF)
695695
: ExplicitKernArgSize(MFI.getExplicitKernArgSize()),
696696
MaxKernArgAlign(MFI.getMaxKernArgAlign()), LDSSize(MFI.getLDSSize()),
697-
GDSSize(MFI.getGDSSize()),
698-
DynLDSAlign(MFI.getDynLDSAlign()), IsEntryFunction(MFI.isEntryFunction()),
697+
GDSSize(MFI.getGDSSize()), DynLDSAlign(MFI.getDynLDSAlign()),
698+
IsEntryFunction(MFI.isEntryFunction()),
699699
NoSignedZerosFPMath(MFI.hasNoSignedZerosFPMath()),
700700
MemoryBound(MFI.isMemoryBound()), WaveLimiter(MFI.needsWaveLimiter()),
701701
HasSpilledSGPRs(MFI.hasSpilledSGPRs()),
702702
HasSpilledVGPRs(MFI.hasSpilledVGPRs()),
703703
HighBitsOf32BitAddress(MFI.get32BitAddressHighBits()),
704704
Occupancy(MFI.getOccupancy()),
705+
NumPhysicalVGPRSpillLanes(MFI.getNumPhysicalVGPRSpillLanes()),
705706
ScratchRSrcReg(regToString(MFI.getScratchRSrcReg(), TRI)),
706707
FrameOffsetReg(regToString(MFI.getFrameOffsetReg(), TRI)),
707708
StackPtrOffsetReg(regToString(MFI.getStackPtrOffsetReg(), TRI)),
708709
BytesInStackArgArea(MFI.getBytesInStackArgArea()),
709710
ReturnsVoid(MFI.returnsVoid()),
710711
ArgInfo(convertArgumentInfo(MFI.getArgInfo(), TRI)),
711-
PSInputAddr(MFI.getPSInputAddr()),
712-
PSInputEnable(MFI.getPSInputEnable()),
712+
PSInputAddr(MFI.getPSInputAddr()), PSInputEnable(MFI.getPSInputEnable()),
713713
Mode(MFI.getMode()) {
714714
for (Register Reg : MFI.getSGPRSpillPhysVGPRs())
715715
SpillPhysVGPRS.push_back(regToString(Reg, TRI));
@@ -754,6 +754,7 @@ bool SIMachineFunctionInfo::initializeBaseYamlFields(
754754
HasSpilledVGPRs = YamlMFI.HasSpilledVGPRs;
755755
BytesInStackArgArea = YamlMFI.BytesInStackArgArea;
756756
ReturnsVoid = YamlMFI.ReturnsVoid;
757+
NumPhysicalVGPRSpillLanes = YamlMFI.NumPhysicalVGPRSpillLanes;
757758

758759
if (YamlMFI.ScavengeFI) {
759760
auto FIOrErr = YamlMFI.ScavengeFI->getFI(MF.getFrameInfo());

llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ struct SIMachineFunctionInfo final : public yaml::MachineFunctionInfo {
275275
// TODO: 10 may be a better default since it's the maximum.
276276
unsigned Occupancy = 0;
277277

278+
unsigned NumPhysicalVGPRSpillLanes = 0;
278279
SmallVector<StringValue, 2> SpillPhysVGPRS;
279280
SmallVector<StringValue> WWMReservedRegs;
280281

@@ -337,6 +338,8 @@ template <> struct MappingTraits<SIMachineFunctionInfo> {
337338
YamlIO.mapOptional("highBitsOf32BitAddress",
338339
MFI.HighBitsOf32BitAddress, 0u);
339340
YamlIO.mapOptional("occupancy", MFI.Occupancy, 0);
341+
YamlIO.mapOptional("numPhysicalVGPRSpillLanes",
342+
MFI.NumPhysicalVGPRSpillLanes);
340343
YamlIO.mapOptional("spillPhysVGPRs", MFI.SpillPhysVGPRS);
341344
YamlIO.mapOptional("wwmReservedRegs", MFI.WWMReservedRegs);
342345
YamlIO.mapOptional("scavengeFI", MFI.ScavengeFI);
@@ -614,6 +617,10 @@ class SIMachineFunctionInfo final : public AMDGPUMachineFunction,
614617
ArrayRef<Register> getSGPRSpillVGPRs() const { return SpillVGPRs; }
615618
ArrayRef<Register> getSGPRSpillPhysVGPRs() const { return SpillPhysVGPRs; }
616619

620+
unsigned getNumPhysicalVGPRSpillLanes() const {
621+
return NumPhysicalVGPRSpillLanes;
622+
}
623+
617624
const WWMSpillsMap &getWWMSpills() const { return WWMSpills; }
618625
const ReservedRegSet &getWWMReservedRegs() const { return WWMReservedRegs; }
619626

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; RUN: llc -O0 -mtriple=amdgcn-amd-amdhsa --stop-after=prologepilog -o - %s | FileCheck %s
2+
3+
; Spill the PC SGPR30_31 and FP to physical VGPR
4+
5+
define void @test() #0 {
6+
; CHECK: machineFunctionInfo
7+
; CHECK: numPhysicalVGPRSpillLanes: 3
8+
entry:
9+
%call = call i32 @ext_func()
10+
ret void
11+
}
12+
13+
declare i32 @ext_func();
14+
15+
attributes #0 = { nounwind "amdgpu-num-vgpr"="41" "amdgpu-num-sgpr"="34" }

0 commit comments

Comments
 (0)