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 {
83
83
84
84
// / Mark this value as unused.
85
85
void markUnused () { def = SlotIndex (); }
86
+
87
+ LLVM_ABI void print (raw_ostream &OS) const ;
88
+ LLVM_ABI void dump () const ;
86
89
};
87
90
91
+ inline raw_ostream &operator <<(raw_ostream &OS, const VNInfo &VNI) {
92
+ VNI.print (OS);
93
+ return OS;
94
+ }
95
+
88
96
// / Result of a LiveRange query. This class hides the implementation details
89
97
// / of live ranges, and it should be used as the primary interface for
90
98
// / 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 {
996
996
}
997
997
#endif
998
998
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
+
999
1010
void LiveRange::print (raw_ostream &OS) const {
1000
1011
if (empty ())
1001
1012
OS << " EMPTY" ;
@@ -1013,15 +1024,10 @@ void LiveRange::print(raw_ostream &OS) const {
1013
1024
for (const_vni_iterator i = vni_begin (), e = vni_end (); i != e;
1014
1025
++i, ++vnum) {
1015
1026
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" );
1025
1031
}
1026
1032
}
1027
1033
}
@@ -1041,9 +1047,9 @@ void LiveInterval::print(raw_ostream &OS) const {
1041
1047
}
1042
1048
1043
1049
#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 ' ; }
1047
1053
1048
1054
LLVM_DUMP_METHOD void LiveInterval::SubRange::dump () const {
1049
1055
dbgs () << *this << ' \n ' ;
You can’t perform that action at this time.
0 commit comments