1
0
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:
Andrew Trick 2012-05-10 00:32:15 +00:00
parent 29d464dff0
commit ac3b83d82b

View File

@ -1053,17 +1053,21 @@ static void computeUberWeights(std::vector<UberRegSet> &UberSets,
static bool normalizeWeight(CodeGenRegister *Reg,
std::vector<UberRegSet> &UberSets,
std::vector<UberRegSet*> &RegSets,
std::set<unsigned> &NormalRegs,
CodeGenRegister::RegUnitList &NormalUnits,
CodeGenRegBank &RegBank) {
bool Changed = false;
if (!NormalRegs.insert(Reg->EnumValue).second)
return Changed;
const CodeGenRegister::SubRegMap &SRM = Reg->getSubRegs();
for (CodeGenRegister::SubRegMap::const_iterator SRI = SRM.begin(),
SRE = SRM.end(); SRI != SRE; ++SRI) {
if (SRI->second == Reg)
continue; // self-cycles happen
Changed |=
normalizeWeight(SRI->second, UberSets, RegSets, NormalUnits, RegBank);
Changed |= normalizeWeight(SRI->second, UberSets, RegSets,
NormalRegs, NormalUnits, RegBank);
}
// Postorder register normalization.
@ -1128,8 +1132,9 @@ void CodeGenRegBank::computeRegUnitWeights() {
Changed = false;
for (unsigned i = 0, e = Registers.size(); i != e; ++i) {
CodeGenRegister::RegUnitList NormalUnits;
Changed |=
normalizeWeight(Registers[i], UberSets, RegSets, NormalUnits, *this);
std::set<unsigned> NormalRegs;
Changed |= normalizeWeight(Registers[i], UberSets, RegSets,
NormalRegs, NormalUnits, *this);
}
}
}