Add print/dump routines to LiveInterval::SubRange

llvm-svn: 275194
This commit is contained in:
Krzysztof Parzyszek 2016-07-12 17:37:44 +00:00
parent 9eb472ba4b
commit f5b9bb61f7
2 changed files with 27 additions and 10 deletions

View File

@ -613,6 +613,9 @@ namespace llvm {
BumpPtrAllocator &Allocator)
: LiveRange(Other, Allocator), Next(nullptr), LaneMask(LaneMask) {
}
void print(raw_ostream &OS) const;
void dump() const;
};
private:
@ -755,6 +758,12 @@ namespace llvm {
void freeSubRange(SubRange *S);
};
inline raw_ostream &operator<<(raw_ostream &OS,
const LiveInterval::SubRange &SR) {
SR.print(OS);
return OS;
}
inline raw_ostream &operator<<(raw_ostream &OS, const LiveInterval &LI) {
LI.print(OS);
return OS;

View File

@ -825,12 +825,12 @@ unsigned LiveInterval::getSize() const {
}
raw_ostream& llvm::operator<<(raw_ostream& os, const LiveRange::Segment &S) {
return os << '[' << S.start << ',' << S.end << ':' << S.valno->id << ")";
return os << '[' << S.start << ',' << S.end << ':' << S.valno->id << ')';
}
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void LiveRange::Segment::dump() const {
dbgs() << *this << "\n";
dbgs() << *this << '\n';
}
#endif
@ -851,10 +851,10 @@ void LiveRange::print(raw_ostream &OS) const {
for (const_vni_iterator i = vni_begin(), e = vni_end(); i != e;
++i, ++vnum) {
const VNInfo *vni = *i;
if (vnum) OS << " ";
OS << vnum << "@";
if (vnum) OS << ' ';
OS << vnum << '@';
if (vni->isUnused()) {
OS << "x";
OS << 'x';
} else {
OS << vni->def;
if (vni->isPHIDef())
@ -864,22 +864,30 @@ void LiveRange::print(raw_ostream &OS) const {
}
}
void LiveInterval::SubRange::print(raw_ostream &OS) const {
OS << " L" << PrintLaneMask(LaneMask) << ' '
<< static_cast<const LiveRange&>(*this);
}
void LiveInterval::print(raw_ostream &OS) const {
OS << PrintReg(reg) << ' ';
super::print(OS);
// Print subranges
for (const SubRange &SR : subranges()) {
OS << " L" << PrintLaneMask(SR.LaneMask) << ' ' << SR;
}
for (const SubRange &SR : subranges())
OS << SR;
}
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void LiveRange::dump() const {
dbgs() << *this << "\n";
dbgs() << *this << '\n';
}
LLVM_DUMP_METHOD void LiveInterval::SubRange::dump() const {
dbgs() << *this << '\n';
}
LLVM_DUMP_METHOD void LiveInterval::dump() const {
dbgs() << *this << "\n";
dbgs() << *this << '\n';
}
#endif