1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[regalloc] Add a couple of dump routines for ease of debugging [NFC]

This commit is contained in:
Philip Reames 2021-02-18 08:50:00 -08:00
parent f8c9bdda53
commit 8258d5a8dd
4 changed files with 43 additions and 0 deletions

View File

@ -377,3 +377,27 @@ SpillPlacement::finish() {
ActiveNodes = nullptr;
return Perfect;
}
void SpillPlacement::BlockConstraint::print(raw_ostream &OS) const {
auto toString = [](BorderConstraint C) -> StringRef {
switch(C) {
case DontCare: return "DontCare";
case PrefReg: return "PrefReg";
case PrefSpill: return "PrefSpill";
case PrefBoth: return "PrefBoth";
case MustSpill: return "MustSpill";
default:
llvm_unreachable("uncovered switch");
};
};
dbgs() << "{" << Number << ", "
<< toString(Entry) << ", "
<< toString(Exit) << ", "
<< (ChangesValue ? "changes" : "no change") << "}";
}
void SpillPlacement::BlockConstraint::dump() const {
print(dbgs());
dbgs() << "\n";
}

View File

@ -95,6 +95,9 @@ public:
/// the block has a non-PHI def. When this is false, a live-in value on
/// the stack can be live-out on the stack without inserting a spill.
bool ChangesValue;
void print(raw_ostream &OS) const;
void dump() const;
};
/// prepare - Reset state and prepare for a new spill placement computation.

View File

@ -1812,3 +1812,16 @@ void SplitEditor::splitRegOutBlock(const SplitAnalysis::BlockInfo &BI,
SlotIndex From = enterIntvBefore(std::min(Idx, BI.FirstInstr));
useIntv(From, Idx);
}
void SplitAnalysis::BlockInfo::print(raw_ostream &OS) const {
OS << "{" << printMBBReference(*MBB) << ", "
<< "uses " << FirstInstr << " to " << LastInstr << ", "
<< "1st def " << FirstDef << ", "
<< (LiveIn ? "live in" : "dead in") << ", "
<< (LiveOut ? "live out" : "dead out") << "}";
}
void SplitAnalysis::BlockInfo::dump() const {
print(dbgs());
dbgs() << "\n";
}

View File

@ -131,6 +131,9 @@ public:
bool isOneInstr() const {
return SlotIndex::isSameInstr(FirstInstr, LastInstr);
}
void print(raw_ostream &OS) const;
void dump() const;
};
private: