File tree Expand file tree Collapse file tree 2 files changed +26
-12
lines changed Expand file tree Collapse file tree 2 files changed +26
-12
lines changed Original file line number Diff line number Diff line change @@ -83,8 +83,16 @@ namespace llvm {
8383
8484 // / Mark this value as unused.
8585 void markUnused () { def = SlotIndex (); }
86+
87+ LLVM_ABI void print (raw_ostream &OS) const ;
88+ LLVM_ABI void dump () const ;
8689 };
8790
91+ inline raw_ostream &operator <<(raw_ostream &OS, const VNInfo &VNI) {
92+ VNI.print (OS);
93+ return OS;
94+ }
95+
8896 // / Result of a LiveRange query. This class hides the implementation details
8997 // / of live ranges, and it should be used as the primary interface for
9098 // / examining live ranges around instructions.
Original file line number Diff line number Diff line change @@ -996,6 +996,17 @@ LLVM_DUMP_METHOD void LiveRange::Segment::dump() const {
996996}
997997#endif
998998
999+ void VNInfo::print (raw_ostream &OS) const {
1000+ OS << id << ' @' ;
1001+ if (isUnused ()) {
1002+ OS << ' x' ;
1003+ } else {
1004+ OS << def;
1005+ if (isPHIDef ())
1006+ OS << " -phi" ;
1007+ }
1008+ }
1009+
9991010void LiveRange::print (raw_ostream &OS) const {
10001011 if (empty ())
10011012 OS << " EMPTY" ;
@@ -1013,15 +1024,10 @@ void LiveRange::print(raw_ostream &OS) const {
10131024 for (const_vni_iterator i = vni_begin (), e = vni_end (); i != e;
10141025 ++i, ++vnum) {
10151026 const VNInfo *vni = *i;
1016- if (vnum) OS << ' ' ;
1017- OS << vnum << ' @' ;
1018- if (vni->isUnused ()) {
1019- OS << ' x' ;
1020- } else {
1021- OS << vni->def ;
1022- if (vni->isPHIDef ())
1023- OS << " -phi" ;
1024- }
1027+ if (vnum)
1028+ OS << ' ' ;
1029+ OS << *vni;
1030+ assert (vnum == vni->id && " Bad VNInfo" );
10251031 }
10261032 }
10271033}
@@ -1041,9 +1047,9 @@ void LiveInterval::print(raw_ostream &OS) const {
10411047}
10421048
10431049#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1044- LLVM_DUMP_METHOD void LiveRange ::dump () const {
1045- dbgs () << * this << ' \n ' ;
1046- }
1050+ LLVM_DUMP_METHOD void VNInfo ::dump () const { dbgs () << * this << ' \n ' ; }
1051+
1052+ LLVM_DUMP_METHOD void LiveRange::dump () const { dbgs () << * this << ' \n ' ; }
10471053
10481054LLVM_DUMP_METHOD void LiveInterval::SubRange::dump () const {
10491055 dbgs () << *this << ' \n ' ;
You can’t perform that action at this time.
0 commit comments