mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Fix TableGen's RegPressureSet weight normalization to handle subreg DAGS.
I initially assumed that the subreg graph was a tree. That may not be true. llvm-svn: 156524
This commit is contained in:
parent
29d464dff0
commit
ac3b83d82b
@ -1053,17 +1053,21 @@ static void computeUberWeights(std::vector<UberRegSet> &UberSets,
|
|||||||
static bool normalizeWeight(CodeGenRegister *Reg,
|
static bool normalizeWeight(CodeGenRegister *Reg,
|
||||||
std::vector<UberRegSet> &UberSets,
|
std::vector<UberRegSet> &UberSets,
|
||||||
std::vector<UberRegSet*> &RegSets,
|
std::vector<UberRegSet*> &RegSets,
|
||||||
|
std::set<unsigned> &NormalRegs,
|
||||||
CodeGenRegister::RegUnitList &NormalUnits,
|
CodeGenRegister::RegUnitList &NormalUnits,
|
||||||
CodeGenRegBank &RegBank) {
|
CodeGenRegBank &RegBank) {
|
||||||
bool Changed = false;
|
bool Changed = false;
|
||||||
|
if (!NormalRegs.insert(Reg->EnumValue).second)
|
||||||
|
return Changed;
|
||||||
|
|
||||||
const CodeGenRegister::SubRegMap &SRM = Reg->getSubRegs();
|
const CodeGenRegister::SubRegMap &SRM = Reg->getSubRegs();
|
||||||
for (CodeGenRegister::SubRegMap::const_iterator SRI = SRM.begin(),
|
for (CodeGenRegister::SubRegMap::const_iterator SRI = SRM.begin(),
|
||||||
SRE = SRM.end(); SRI != SRE; ++SRI) {
|
SRE = SRM.end(); SRI != SRE; ++SRI) {
|
||||||
if (SRI->second == Reg)
|
if (SRI->second == Reg)
|
||||||
continue; // self-cycles happen
|
continue; // self-cycles happen
|
||||||
|
|
||||||
Changed |=
|
Changed |= normalizeWeight(SRI->second, UberSets, RegSets,
|
||||||
normalizeWeight(SRI->second, UberSets, RegSets, NormalUnits, RegBank);
|
NormalRegs, NormalUnits, RegBank);
|
||||||
}
|
}
|
||||||
// Postorder register normalization.
|
// Postorder register normalization.
|
||||||
|
|
||||||
@ -1128,8 +1132,9 @@ void CodeGenRegBank::computeRegUnitWeights() {
|
|||||||
Changed = false;
|
Changed = false;
|
||||||
for (unsigned i = 0, e = Registers.size(); i != e; ++i) {
|
for (unsigned i = 0, e = Registers.size(); i != e; ++i) {
|
||||||
CodeGenRegister::RegUnitList NormalUnits;
|
CodeGenRegister::RegUnitList NormalUnits;
|
||||||
Changed |=
|
std::set<unsigned> NormalRegs;
|
||||||
normalizeWeight(Registers[i], UberSets, RegSets, NormalUnits, *this);
|
Changed |= normalizeWeight(Registers[i], UberSets, RegSets,
|
||||||
|
NormalRegs, NormalUnits, *this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user