Skip to content

Commit

Permalink
Have getRegPressureSetLimit take a MachineFunction so that a
Browse files Browse the repository at this point in the history
we can inspect the subtarget and function when computing values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231951 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
echristo committed Mar 11, 2015
1 parent 9c2d178 commit 138fe78
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion include/llvm/Target/TargetRegisterInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,8 @@ class TargetRegisterInfo : public MCRegisterInfo {

/// Get the register unit pressure limit for this dimension.
/// This limit must be adjusted dynamically for reserved registers.
virtual unsigned getRegPressureSetLimit(unsigned Idx) const = 0;
virtual unsigned getRegPressureSetLimit(const MachineFunction &MF,
unsigned Idx) const = 0;

/// Get the dimensions of register pressure impacted by this register class.
/// Returns a -1 terminated array of pressure set IDs.
Expand Down
4 changes: 2 additions & 2 deletions lib/CodeGen/RegisterClassInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,6 @@ unsigned RegisterClassInfo::computePSetLimit(unsigned Idx) const {
}
compute(RC);
unsigned NReserved = RC->getNumRegs() - getNumAllocatableRegs(RC);
return TRI->getRegPressureSetLimit(Idx)
- TRI->getRegClassWeight(RC).RegWeight * NReserved;
return TRI->getRegPressureSetLimit(*MF, Idx) -
TRI->getRegClassWeight(RC).RegWeight * NReserved;
}
3 changes: 2 additions & 1 deletion lib/Target/R600/SIRegisterInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ BitVector SIRegisterInfo::getReservedRegs(const MachineFunction &MF) const {
return Reserved;
}

unsigned SIRegisterInfo::getRegPressureSetLimit(unsigned Idx) const {
unsigned SIRegisterInfo::getRegPressureSetLimit(const MachineFunction &MF,
unsigned Idx) const {

// FIXME: We should adjust the max number of waves based on LDS size.
unsigned SGPRLimit = getNumSGPRsAllowed(ST.getGeneration(),
Expand Down
3 changes: 2 additions & 1 deletion lib/Target/R600/SIRegisterInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ struct SIRegisterInfo : public AMDGPURegisterInfo {

BitVector getReservedRegs(const MachineFunction &MF) const override;

unsigned getRegPressureSetLimit(unsigned Idx) const override;
unsigned getRegPressureSetLimit(const MachineFunction &MF,
unsigned Idx) const override;

bool requiresRegisterScavenging(const MachineFunction &Fn) const override;

Expand Down
5 changes: 3 additions & 2 deletions utils/TableGen/RegisterInfoEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ EmitRegUnitPressure(raw_ostream &OS, const CodeGenRegBank &RegBank,
OS << "// Get the register unit pressure limit for this dimension.\n"
<< "// This limit must be adjusted dynamically for reserved registers.\n"
<< "unsigned " << ClassName << "::\n"
<< "getRegPressureSetLimit(unsigned Idx) const {\n"
<< "getRegPressureSetLimit(const MachineFunction &MF, unsigned Idx) const {\n"
<< " static const " << getMinimalTypeForRange(MaxRegUnitWeight)
<< " PressureLimitTable[] = {\n";
for (unsigned i = 0; i < NumSets; ++i ) {
Expand Down Expand Up @@ -1088,7 +1088,8 @@ RegisterInfoEmitter::runTargetHeader(raw_ostream &OS, CodeGenTarget &Target,
<< " unsigned getRegUnitWeight(unsigned RegUnit) const override;\n"
<< " unsigned getNumRegPressureSets() const override;\n"
<< " const char *getRegPressureSetName(unsigned Idx) const override;\n"
<< " unsigned getRegPressureSetLimit(unsigned Idx) const override;\n"
<< " unsigned getRegPressureSetLimit(const MachineFunction &MF, unsigned "
"Idx) const override;\n"
<< " const int *getRegClassPressureSets("
<< "const TargetRegisterClass *RC) const override;\n"
<< " const int *getRegUnitPressureSets("
Expand Down

0 comments on commit 138fe78

Please sign in to comment.