Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
25 changes: 17 additions & 8 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 @@ -1014,14 +1025,8 @@ void LiveRange::print(raw_ostream &OS) const {
++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";
}
OS << *vni;
assert(vnum == vni->id && "Bad VNInfo");
}
}
}
Expand All @@ -1041,6 +1046,10 @@ void LiveInterval::print(raw_ostream &OS) const {
}

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

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