llvm.org GIT mirror llvm / 38135af
Print the symbolic register name in a register allocator debug dump. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22002 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 15 years ago
4 changed file(s) with 36 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
2525 #include
2626
2727 namespace llvm {
28 class MRegisterInfo;
29
2830 /// LiveRange structure - This represents a simple register range in the
2931 /// program, with an inclusive start point and an exclusive end point.
3032 /// These ranges are rendered as [start,end).
174176 return beginNumber() < other.beginNumber();
175177 }
176178
179 void print(std::ostream &OS, const MRegisterInfo *MRI = 0) const;
177180 void dump() const;
178181
179182 private:
184187 LiveInterval& operator=(const LiveInterval& rhs); // DO NOT IMPLEMENT
185188 };
186189
187 std::ostream& operator<<(std::ostream& os, const LiveInterval& li);
190 inline std::ostream &operator<<(std::ostream &OS, const LiveInterval &LI) {
191 LI.print(OS);
192 return OS;
193 }
188194 }
189195
190196 #endif
1919
2020 #include "LiveInterval.h"
2121 #include "llvm/ADT/STLExtras.h"
22 #include "llvm/Target/MRegisterInfo.h"
2223 #include
2324 #include
2425 #include
350351 std::cerr << *this << "\n";
351352 }
352353
353
354 std::ostream& llvm::operator<<(std::ostream& os, const LiveInterval& li) {
355 os << "%reg" << li.reg << ',' << li.weight;
356 if (li.empty())
357 return os << "EMPTY";
358
359 os << " = ";
360 for (LiveInterval::Ranges::const_iterator i = li.ranges.begin(),
361 e = li.ranges.end(); i != e; ++i)
362 os << *i;
363 return os;
354 void LiveInterval::print(std::ostream &OS, const MRegisterInfo *MRI) const {
355 if (MRI && MRegisterInfo::isPhysicalRegister(reg))
356 OS << MRI->getName(reg);
357 else
358 OS << "%reg" << reg;
359
360 OS << ',' << weight;
361
362 if (empty())
363 OS << "EMPTY";
364 else {
365 OS << " = ";
366 for (LiveInterval::Ranges::const_iterator I = ranges.begin(),
367 E = ranges.end(); I != E; ++I)
368 OS << *I;
369 }
364370 }
365371
366372 void LiveInterval::dump() const {
2525 #include
2626
2727 namespace llvm {
28 class MRegisterInfo;
29
2830 /// LiveRange structure - This represents a simple register range in the
2931 /// program, with an inclusive start point and an exclusive end point.
3032 /// These ranges are rendered as [start,end).
174176 return beginNumber() < other.beginNumber();
175177 }
176178
179 void print(std::ostream &OS, const MRegisterInfo *MRI = 0) const;
177180 void dump() const;
178181
179182 private:
184187 LiveInterval& operator=(const LiveInterval& rhs); // DO NOT IMPLEMENT
185188 };
186189
187 std::ostream& operator<<(std::ostream& os, const LiveInterval& li);
190 inline std::ostream &operator<<(std::ostream &OS, const LiveInterval &LI) {
191 LI.print(OS);
192 return OS;
193 }
188194 }
189195
190196 #endif
141141
142142 numIntervals += getNumIntervals();
143143
144 #if 1
145 DEBUG(std::cerr << "********** INTERVALS **********\n");
146 DEBUG(for (iterator I = begin(), E = end(); I != E; ++I)
147 std::cerr << I->second << "\n");
148 #endif
144 DEBUG(std::cerr << "********** INTERVALS **********\n";
145 for (iterator I = begin(), E = end(); I != E; ++I) {
146 I->second.print(std::cerr, mri_);
147 std::cerr << "\n";
148 });
149149
150150 // join intervals if requested
151151 if (EnableJoining) joinIntervals();