Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h
Show First 20 Lines • Show All 473 Lines • ▼ Show 20 Lines | public: | ||||
}; | }; | ||||
struct VGPRSpillToAGPR { | struct VGPRSpillToAGPR { | ||||
SmallVector<MCPhysReg, 32> Lanes; | SmallVector<MCPhysReg, 32> Lanes; | ||||
bool FullyAllocated = false; | bool FullyAllocated = false; | ||||
bool IsDead = false; | bool IsDead = false; | ||||
}; | }; | ||||
// Track VGPRs reserved for WWM. | |||||
SmallSetVector<Register, 8> WWMReservedRegs; | |||||
/// Track stack slots used for save/restore of reserved WWM VGPRs in the | |||||
/// prolog/epilog. | |||||
/// FIXME: This is temporary state only needed in PrologEpilogInserter, and | |||||
/// doesn't really belong here. It does not require serialization | |||||
SmallVector<int, 8> WWMReservedFrameIndexes; | |||||
void allocateWWMReservedSpillSlots(MachineFrameInfo &MFI, | |||||
const SIRegisterInfo &TRI); | |||||
auto wwmAllocation() const { | |||||
assert(WWMReservedRegs.size() == WWMReservedFrameIndexes.size()); | |||||
return zip(WWMReservedRegs, WWMReservedFrameIndexes); | |||||
} | |||||
private: | private: | ||||
// Track VGPR + wave index for each subregister of the SGPR spilled to | // Track VGPR + wave index for each subregister of the SGPR spilled to | ||||
// frameindex key. | // frameindex key. | ||||
DenseMap<int, std::vector<SpilledReg>> SGPRToVGPRSpills; | DenseMap<int, std::vector<SpilledReg>> SGPRToVGPRSpills; | ||||
unsigned NumVGPRSpillLanes = 0; | unsigned NumVGPRSpillLanes = 0; | ||||
SmallVector<Register, 2> SpillVGPRs; | SmallVector<Register, 2> SpillVGPRs; | ||||
using LaneVGPRsMap = MapVector<Register, Optional<int>>; | using LaneVGPRsMap = MapVector<Register, Optional<int>>; | ||||
LaneVGPRsMap LaneVGPRs; | LaneVGPRsMap LaneVGPRs; | ||||
using ReservedRegSet = SmallSetVector<Register, 8>; | |||||
// Track VGPRs reserved for WWM. | |||||
ReservedRegSet WWMReservedRegs; | |||||
DenseMap<int, VGPRSpillToAGPR> VGPRToAGPRSpills; | DenseMap<int, VGPRSpillToAGPR> VGPRToAGPRSpills; | ||||
arsenm: I'm confused by the relationship between "WWMReservedRegs" and WWMVGPRs. | |||||
// AGPRs used for VGPR spills. | // AGPRs used for VGPR spills. | ||||
SmallVector<MCPhysReg, 32> SpillAGPR; | SmallVector<MCPhysReg, 32> SpillAGPR; | ||||
// VGPRs used for AGPR spills. | // VGPRs used for AGPR spills. | ||||
SmallVector<MCPhysReg, 32> SpillVGPR; | SmallVector<MCPhysReg, 32> SpillVGPR; | ||||
// Emergency stack slot. Sometimes, we create this before finalizing the stack | // Emergency stack slot. Sometimes, we create this before finalizing the stack | ||||
Show All 28 Lines | |||||
public: | public: | ||||
SIMachineFunctionInfo(const MachineFunction &MF); | SIMachineFunctionInfo(const MachineFunction &MF); | ||||
bool initializeBaseYamlFields(const yaml::SIMachineFunctionInfo &YamlMFI, | bool initializeBaseYamlFields(const yaml::SIMachineFunctionInfo &YamlMFI, | ||||
const MachineFunction &MF, | const MachineFunction &MF, | ||||
PerFunctionMIParsingState &PFS, | PerFunctionMIParsingState &PFS, | ||||
SMDiagnostic &Error, SMRange &SourceRange); | SMDiagnostic &Error, SMRange &SourceRange); | ||||
void reserveWWMRegister(Register Reg) { | void reserveWWMRegister(Register Reg) { WWMReservedRegs.insert(Reg); } | ||||
WWMReservedRegs.insert(Reg); | |||||
} | |||||
ArrayRef<SpilledReg> getSGPRToVGPRSpills(int FrameIndex) const { | ArrayRef<SpilledReg> getSGPRToVGPRSpills(int FrameIndex) const { | ||||
auto I = SGPRToVGPRSpills.find(FrameIndex); | auto I = SGPRToVGPRSpills.find(FrameIndex); | ||||
return (I == SGPRToVGPRSpills.end()) ? | return (I == SGPRToVGPRSpills.end()) ? | ||||
ArrayRef<SpilledReg>() : makeArrayRef(I->second); | ArrayRef<SpilledReg>() : makeArrayRef(I->second); | ||||
} | } | ||||
ArrayRef<Register> getSGPRSpillVGPRs() const { return SpillVGPRs; } | ArrayRef<Register> getSGPRSpillVGPRs() const { return SpillVGPRs; } | ||||
const LaneVGPRsMap &getLaneVGPRs() const { return LaneVGPRs; } | const LaneVGPRsMap &getLaneVGPRs() const { return LaneVGPRs; } | ||||
const ReservedRegSet &getWWMReservedRegs() const { return WWMReservedRegs; } | |||||
void addToLaneVGPRs(MachineFunction &MF, Register VGPR, uint64_t Size = 4, | void addToLaneVGPRs(MachineFunction &MF, Register VGPR, uint64_t Size = 4, | ||||
Align Alignment = Align(4)); | Align Alignment = Align(4)); | ||||
ArrayRef<MCPhysReg> getAGPRSpillVGPRs() const { | ArrayRef<MCPhysReg> getAGPRSpillVGPRs() const { | ||||
return SpillAGPR; | return SpillAGPR; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 425 Lines • Show Last 20 Lines |
I'm confused by the relationship between "WWMReservedRegs" and WWMVGPRs.