Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions llvm/include/llvm/CodeGen/LiveInterval.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,16 @@ namespace llvm {

/// Mark this value as unused.
void markUnused() { def = SlotIndex(); }

LLVM_ABI void print(raw_ostream &OS) const;
LLVM_ABI void dump() const;
};

inline raw_ostream &operator<<(raw_ostream &OS, const VNInfo &VNI) {
VNI.print(OS);
return OS;
}

/// Result of a LiveRange query. This class hides the implementation details
/// of live ranges, and it should be used as the primary interface for
/// examining live ranges around instructions.
Expand Down
30 changes: 18 additions & 12 deletions llvm/lib/CodeGen/LiveInterval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,17 @@ LLVM_DUMP_METHOD void LiveRange::Segment::dump() const {
}
#endif

void VNInfo::print(raw_ostream &OS) const {
OS << id << '@';
if (isUnused()) {
OS << 'x';
} else {
OS << def;
if (isPHIDef())
OS << "-phi";
}
}

void LiveRange::print(raw_ostream &OS) const {
if (empty())
OS << "EMPTY";
Expand All @@ -1013,15 +1024,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 (vni->isUnused()) {
OS << 'x';
} else {
OS << vni->def;
if (vni->isPHIDef())
OS << "-phi";
}
if (vnum)
OS << ' ';
OS << *vni;
assert(vnum == vni->id && "Bad VNInfo");
}
}
}
Expand All @@ -1041,9 +1047,9 @@ void LiveInterval::print(raw_ostream &OS) const {
}

#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void LiveRange::dump() const {
dbgs() << *this << '\n';
}
LLVM_DUMP_METHOD void VNInfo::dump() const { dbgs() << *this << '\n'; }

LLVM_DUMP_METHOD void LiveRange::dump() const { dbgs() << *this << '\n'; }

LLVM_DUMP_METHOD void LiveInterval::SubRange::dump() const {
dbgs() << *this << '\n';
Expand Down
Loading