mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
Print the symbolic register name in a register allocator debug dump.
llvm-svn: 22002
This commit is contained in:
parent
1202c26d6e
commit
369427683d
@ -20,6 +20,7 @@
|
||||
|
||||
#include "LiveInterval.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/Target/MRegisterInfo.h"
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
@ -351,17 +352,22 @@ void LiveRange::dump() const {
|
||||
std::cerr << *this << "\n";
|
||||
}
|
||||
|
||||
void LiveInterval::print(std::ostream &OS, const MRegisterInfo *MRI) const {
|
||||
if (MRI && MRegisterInfo::isPhysicalRegister(reg))
|
||||
OS << MRI->getName(reg);
|
||||
else
|
||||
OS << "%reg" << reg;
|
||||
|
||||
std::ostream& llvm::operator<<(std::ostream& os, const LiveInterval& li) {
|
||||
os << "%reg" << li.reg << ',' << li.weight;
|
||||
if (li.empty())
|
||||
return os << "EMPTY";
|
||||
OS << ',' << weight;
|
||||
|
||||
os << " = ";
|
||||
for (LiveInterval::Ranges::const_iterator i = li.ranges.begin(),
|
||||
e = li.ranges.end(); i != e; ++i)
|
||||
os << *i;
|
||||
return os;
|
||||
if (empty())
|
||||
OS << "EMPTY";
|
||||
else {
|
||||
OS << " = ";
|
||||
for (LiveInterval::Ranges::const_iterator I = ranges.begin(),
|
||||
E = ranges.end(); I != E; ++I)
|
||||
OS << *I;
|
||||
}
|
||||
}
|
||||
|
||||
void LiveInterval::dump() const {
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include <cassert>
|
||||
|
||||
namespace llvm {
|
||||
class MRegisterInfo;
|
||||
|
||||
/// LiveRange structure - This represents a simple register range in the
|
||||
/// program, with an inclusive start point and an exclusive end point.
|
||||
/// These ranges are rendered as [start,end).
|
||||
@ -175,6 +177,7 @@ namespace llvm {
|
||||
return beginNumber() < other.beginNumber();
|
||||
}
|
||||
|
||||
void print(std::ostream &OS, const MRegisterInfo *MRI = 0) const;
|
||||
void dump() const;
|
||||
|
||||
private:
|
||||
@ -185,7 +188,10 @@ namespace llvm {
|
||||
LiveInterval& operator=(const LiveInterval& rhs); // DO NOT IMPLEMENT
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const LiveInterval& li);
|
||||
inline std::ostream &operator<<(std::ostream &OS, const LiveInterval &LI) {
|
||||
LI.print(OS);
|
||||
return OS;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -142,11 +142,11 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
|
||||
|
||||
numIntervals += getNumIntervals();
|
||||
|
||||
#if 1
|
||||
DEBUG(std::cerr << "********** INTERVALS **********\n");
|
||||
DEBUG(for (iterator I = begin(), E = end(); I != E; ++I)
|
||||
std::cerr << I->second << "\n");
|
||||
#endif
|
||||
DEBUG(std::cerr << "********** INTERVALS **********\n";
|
||||
for (iterator I = begin(), E = end(); I != E; ++I) {
|
||||
I->second.print(std::cerr, mri_);
|
||||
std::cerr << "\n";
|
||||
});
|
||||
|
||||
// join intervals if requested
|
||||
if (EnableJoining) joinIntervals();
|
||||
|
Loading…
Reference in New Issue
Block a user