600 |
600 |
601 void PhaseConservativeCoalesce::update_ifg(uint lr1, uint lr2, IndexSet *n_lr1, IndexSet *n_lr2) { |
601 void PhaseConservativeCoalesce::update_ifg(uint lr1, uint lr2, IndexSet *n_lr1, IndexSet *n_lr2) { |
602 // Some original neighbors of lr1 might have gone away |
602 // Some original neighbors of lr1 might have gone away |
603 // because the constrained register mask prevented them. |
603 // because the constrained register mask prevented them. |
604 // Remove lr1 from such neighbors. |
604 // Remove lr1 from such neighbors. |
605 IndexSetIterator one(n_lr1); |
605 uint neighbor = 0; |
606 uint neighbor; |
|
607 LRG &lrg1 = lrgs(lr1); |
606 LRG &lrg1 = lrgs(lr1); |
608 while ((neighbor = one.next()) != 0) |
607 if (!n_lr1->is_empty()) { |
609 if( !_ulr.member(neighbor) ) |
608 IndexSetIterator one(n_lr1); |
610 if( _phc._ifg->neighbors(neighbor)->remove(lr1) ) |
609 while ((neighbor = one.next()) != 0) { |
611 lrgs(neighbor).inc_degree( -lrg1.compute_degree(lrgs(neighbor)) ); |
610 if (!_ulr.member(neighbor)) { |
|
611 if (_phc._ifg->neighbors(neighbor)->remove(lr1)) { |
|
612 lrgs(neighbor).inc_degree(-lrg1.compute_degree(lrgs(neighbor))); |
|
613 } |
|
614 } |
|
615 } |
|
616 } |
612 |
617 |
613 |
618 |
614 // lr2 is now called (coalesced into) lr1. |
619 // lr2 is now called (coalesced into) lr1. |
615 // Remove lr2 from the IFG. |
620 // Remove lr2 from the IFG. |
616 IndexSetIterator two(n_lr2); |
|
617 LRG &lrg2 = lrgs(lr2); |
621 LRG &lrg2 = lrgs(lr2); |
618 while ((neighbor = two.next()) != 0) |
622 if (!n_lr2->is_empty()) { |
619 if( _phc._ifg->neighbors(neighbor)->remove(lr2) ) |
623 IndexSetIterator two(n_lr2); |
620 lrgs(neighbor).inc_degree( -lrg2.compute_degree(lrgs(neighbor)) ); |
624 while ((neighbor = two.next()) != 0) { |
|
625 if (_phc._ifg->neighbors(neighbor)->remove(lr2)) { |
|
626 lrgs(neighbor).inc_degree(-lrg2.compute_degree(lrgs(neighbor))); |
|
627 } |
|
628 } |
|
629 } |
621 |
630 |
622 // Some neighbors of intermediate copies now interfere with the |
631 // Some neighbors of intermediate copies now interfere with the |
623 // combined live range. |
632 // combined live range. |
624 IndexSetIterator three(&_ulr); |
633 if (!_ulr.is_empty()) { |
625 while ((neighbor = three.next()) != 0) |
634 IndexSetIterator three(&_ulr); |
626 if( _phc._ifg->neighbors(neighbor)->insert(lr1) ) |
635 while ((neighbor = three.next()) != 0) { |
627 lrgs(neighbor).inc_degree( lrg1.compute_degree(lrgs(neighbor)) ); |
636 if (_phc._ifg->neighbors(neighbor)->insert(lr1)) { |
|
637 lrgs(neighbor).inc_degree(lrg1.compute_degree(lrgs(neighbor))); |
|
638 } |
|
639 } |
|
640 } |
628 } |
641 } |
629 |
642 |
630 static void record_bias( const PhaseIFG *ifg, int lr1, int lr2 ) { |
643 static void record_bias( const PhaseIFG *ifg, int lr1, int lr2 ) { |
631 // Tag copy bias here |
644 // Tag copy bias here |
632 if( !ifg->lrgs(lr1)._copy_bias ) |
645 if( !ifg->lrgs(lr1)._copy_bias ) |