[llvm] r275194 - Add print/dump routines to LiveInterval::SubRange
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 12 10:37:44 PDT 2016
Author: kparzysz
Date: Tue Jul 12 12:37:44 2016
New Revision: 275194
URL: http://llvm.org/viewvc/llvm-project?rev=275194&view=rev
Log:
Add print/dump routines to LiveInterval::SubRange
Modified:
llvm/trunk/include/llvm/CodeGen/LiveInterval.h
llvm/trunk/lib/CodeGen/LiveInterval.cpp
Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=275194&r1=275193&r2=275194&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Tue Jul 12 12:37:44 2016
@@ -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;
Modified: llvm/trunk/lib/CodeGen/LiveInterval.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveInterval.cpp?rev=275194&r1=275193&r2=275194&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveInterval.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveInterval.cpp Tue Jul 12 12:37:44 2016
@@ -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) c
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) c
}
}
+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
More information about the llvm-commits
mailing list