139 } |
139 } |
140 return neighbors(a); |
140 return neighbors(a); |
141 } |
141 } |
142 |
142 |
143 // Re-insert a yanked Node. |
143 // Re-insert a yanked Node. |
144 void PhaseIFG::re_insert( uint a ) { |
144 void PhaseIFG::re_insert(uint a) { |
145 assert( _is_square, "only on square" ); |
145 assert( _is_square, "only on square" ); |
146 assert( _yanked->test(a), "" ); |
146 assert( _yanked->test(a), "" ); |
147 (*_yanked) >>= a; |
147 _yanked->remove(a); |
148 |
148 |
149 IndexSetIterator elements(&_adjs[a]); |
149 IndexSetIterator elements(&_adjs[a]); |
150 uint datum; |
150 uint datum; |
151 while ((datum = elements.next()) != 0) { |
151 while ((datum = elements.next()) != 0) { |
152 _adjs[datum].insert(a); |
152 _adjs[datum].insert(a); |
196 void PhaseIFG::dump() const { |
196 void PhaseIFG::dump() const { |
197 tty->print_cr("-- Interference Graph --%s--", |
197 tty->print_cr("-- Interference Graph --%s--", |
198 _is_square ? "square" : "triangular" ); |
198 _is_square ? "square" : "triangular" ); |
199 if( _is_square ) { |
199 if( _is_square ) { |
200 for( uint i = 0; i < _maxlrg; i++ ) { |
200 for( uint i = 0; i < _maxlrg; i++ ) { |
201 tty->print( (*_yanked)[i] ? "XX " : " "); |
201 tty->print(_yanked->test(i) ? "XX " : " "); |
202 tty->print("L%d: { ",i); |
202 tty->print("L%d: { ",i); |
203 IndexSetIterator elements(&_adjs[i]); |
203 IndexSetIterator elements(&_adjs[i]); |
204 uint datum; |
204 uint datum; |
205 while ((datum = elements.next()) != 0) { |
205 while ((datum = elements.next()) != 0) { |
206 tty->print("L%d ", datum); |
206 tty->print("L%d ", datum); |
212 } |
212 } |
213 |
213 |
214 // Triangular |
214 // Triangular |
215 for( uint i = 0; i < _maxlrg; i++ ) { |
215 for( uint i = 0; i < _maxlrg; i++ ) { |
216 uint j; |
216 uint j; |
217 tty->print( (*_yanked)[i] ? "XX " : " "); |
217 tty->print(_yanked->test(i) ? "XX " : " "); |
218 tty->print("L%d: { ",i); |
218 tty->print("L%d: { ",i); |
219 for( j = _maxlrg; j > i; j-- ) |
219 for( j = _maxlrg; j > i; j-- ) |
220 if( test_edge(j - 1,i) ) { |
220 if( test_edge(j - 1,i) ) { |
221 tty->print("L%d ",j - 1); |
221 tty->print("L%d ",j - 1); |
222 } |
222 } |
247 } |
247 } |
248 |
248 |
249 void PhaseIFG::verify( const PhaseChaitin *pc ) const { |
249 void PhaseIFG::verify( const PhaseChaitin *pc ) const { |
250 // IFG is square, sorted and no need for Find |
250 // IFG is square, sorted and no need for Find |
251 for( uint i = 0; i < _maxlrg; i++ ) { |
251 for( uint i = 0; i < _maxlrg; i++ ) { |
252 assert(!((*_yanked)[i]) || !neighbor_cnt(i), "Is removed completely" ); |
252 assert(!_yanked->test(i) || !neighbor_cnt(i), "Is removed completely" ); |
253 IndexSet *set = &_adjs[i]; |
253 IndexSet *set = &_adjs[i]; |
254 IndexSetIterator elements(set); |
254 IndexSetIterator elements(set); |
255 uint idx; |
255 uint idx; |
256 uint last = 0; |
256 uint last = 0; |
257 while ((idx = elements.next()) != 0) { |
257 while ((idx = elements.next()) != 0) { |
258 assert(idx != i, "Must have empty diagonal"); |
258 assert(idx != i, "Must have empty diagonal"); |
259 assert(pc->_lrg_map.find_const(idx) == idx, "Must not need Find"); |
259 assert(pc->_lrg_map.find_const(idx) == idx, "Must not need Find"); |
260 assert(_adjs[idx].member(i), "IFG not square"); |
260 assert(_adjs[idx].member(i), "IFG not square"); |
261 assert(!(*_yanked)[idx], "No yanked neighbors"); |
261 assert(!_yanked->test(idx), "No yanked neighbors"); |
262 assert(last < idx, "not sorted increasing"); |
262 assert(last < idx, "not sorted increasing"); |
263 last = idx; |
263 last = idx; |
264 } |
264 } |
265 assert(!lrgs(i)._degree_valid || effective_degree(i) == lrgs(i).degree(), "degree is valid but wrong"); |
265 assert(!lrgs(i)._degree_valid || effective_degree(i) == lrgs(i).degree(), "degree is valid but wrong"); |
266 } |
266 } |