Mercurial > hg > graal-compiler
comparison src/share/vm/opto/ifg.cpp @ 14496:99fc8c086679
8032894: Remove dead code in Pressure::lower
Summary: Remove dead code in Pressure::lower
Reviewed-by: kvn, roland
author | adlertz |
---|---|
date | Tue, 25 Feb 2014 10:26:21 +0100 |
parents | c84312468f5c |
children | 1077c8270209 |
comparison
equal
deleted
inserted
replaced
14495:cd5d10655495 | 14496:99fc8c086679 |
---|---|
437 if (r.overlap(*Matcher::idealreg2regmask[Op_RegI])) { | 437 if (r.overlap(*Matcher::idealreg2regmask[Op_RegI])) { |
438 int_pressure.lower(lrg, location); | 438 int_pressure.lower(lrg, location); |
439 } | 439 } |
440 } | 440 } |
441 } | 441 } |
442 assert(int_pressure._current_pressure == count_int_pressure(liveout), "the int pressure is incorrect"); | 442 assert(int_pressure.current_pressure() == count_int_pressure(liveout), "the int pressure is incorrect"); |
443 assert(float_pressure._current_pressure == count_float_pressure(liveout), "the float pressure is incorrect"); | 443 assert(float_pressure.current_pressure() == count_float_pressure(liveout), "the float pressure is incorrect"); |
444 } | 444 } |
445 | 445 |
446 /* Go to the first non-phi index in a block */ | 446 /* Go to the first non-phi index in a block */ |
447 static uint first_nonphi_index(Block* b) { | 447 static uint first_nonphi_index(Block* b) { |
448 uint i; | 448 uint i; |
511 LRG& lrg = lrgs(lid); | 511 LRG& lrg = lrgs(lid); |
512 lrg._area += cost; | 512 lrg._area += cost; |
513 raise_pressure(b, lrg, int_pressure, float_pressure); | 513 raise_pressure(b, lrg, int_pressure, float_pressure); |
514 lid = elements.next(); | 514 lid = elements.next(); |
515 } | 515 } |
516 assert(int_pressure._current_pressure == count_int_pressure(liveout), "the int pressure is incorrect"); | 516 assert(int_pressure.current_pressure() == count_int_pressure(liveout), "the int pressure is incorrect"); |
517 assert(float_pressure._current_pressure == count_float_pressure(liveout), "the float pressure is incorrect"); | 517 assert(float_pressure.current_pressure() == count_float_pressure(liveout), "the float pressure is incorrect"); |
518 } | 518 } |
519 | 519 |
520 /* | 520 /* |
521 * Remove dead node if it's not used. | 521 * Remove dead node if it's not used. |
522 * We only remove projection nodes if the node "defining" the projection is | 522 * We only remove projection nodes if the node "defining" the projection is |
546 * block. If we find a low to high transition, we record it. | 546 * block. If we find a low to high transition, we record it. |
547 */ | 547 */ |
548 void PhaseChaitin::check_for_high_pressure_transition_at_fatproj(uint& block_reg_pressure, uint location, LRG& lrg, Pressure& pressure, const int op_regtype) { | 548 void PhaseChaitin::check_for_high_pressure_transition_at_fatproj(uint& block_reg_pressure, uint location, LRG& lrg, Pressure& pressure, const int op_regtype) { |
549 RegMask mask_tmp = lrg.mask(); | 549 RegMask mask_tmp = lrg.mask(); |
550 mask_tmp.AND(*Matcher::idealreg2regmask[op_regtype]); | 550 mask_tmp.AND(*Matcher::idealreg2regmask[op_regtype]); |
551 // this pressure is only valid at this instruction, i.e. we don't need to lower | 551 pressure.check_pressure_at_fatproj(location, mask_tmp); |
552 // the register pressure since the fat proj was never live before (going backwards) | |
553 uint new_pressure = pressure._current_pressure + mask_tmp.Size(); | |
554 if (new_pressure > pressure._final_pressure) { | |
555 pressure._final_pressure = new_pressure; | |
556 } | |
557 // if we were at a low pressure and now at the fat proj is at high pressure, record the fat proj location | |
558 // as coming from a low to high (to low again) | |
559 if (pressure._current_pressure <= pressure._high_pressure_limit && new_pressure > pressure._high_pressure_limit) { | |
560 pressure._high_pressure_index = location; | |
561 } | |
562 } | 552 } |
563 | 553 |
564 /* | 554 /* |
565 * Insure high score for immediate-use spill copies so they get a color. | 555 * Insure high score for immediate-use spill copies so they get a color. |
566 * All single-use MachSpillCopy(s) that immediately precede their | 556 * All single-use MachSpillCopy(s) that immediately precede their |
698 | 688 |
699 if (liveout->insert(lid)) { | 689 if (liveout->insert(lid)) { |
700 // Newly live things assumed live from here to top of block | 690 // Newly live things assumed live from here to top of block |
701 lrg._area += cost; | 691 lrg._area += cost; |
702 raise_pressure(b, lrg, int_pressure, float_pressure); | 692 raise_pressure(b, lrg, int_pressure, float_pressure); |
703 assert(int_pressure._current_pressure == count_int_pressure(liveout), "the int pressure is incorrect"); | 693 assert(int_pressure.current_pressure() == count_int_pressure(liveout), "the int pressure is incorrect"); |
704 assert(float_pressure._current_pressure == count_float_pressure(liveout), "the float pressure is incorrect"); | 694 assert(float_pressure.current_pressure() == count_float_pressure(liveout), "the float pressure is incorrect"); |
705 } | 695 } |
706 assert(!(lrg._area < 0.0), "negative spill area" ); | 696 assert(!(lrg._area < 0.0), "negative spill area" ); |
707 } | 697 } |
708 } | 698 } |
709 | 699 |
710 /* | 700 /* |
711 * If we run off the top of the block with high pressure just record that the | 701 * If we run off the top of the block with high pressure just record that the |
712 * whole block is high pressure. (Even though we might have a transition | 702 * whole block is high pressure. (Even though we might have a transition |
713 * lower down in the block) | 703 * later down in the block) |
714 */ | 704 */ |
715 void PhaseChaitin::check_for_high_pressure_block(Pressure& pressure) { | 705 void PhaseChaitin::check_for_high_pressure_block(Pressure& pressure) { |
716 // current pressure now means the pressure before the first instruction in the block | 706 // current pressure now means the pressure before the first instruction in the block |
717 // (since we have stepped through all instructions backwards) | 707 // (since we have stepped through all instructions backwards) |
718 if (pressure._current_pressure > pressure._high_pressure_limit) { | 708 if (pressure.current_pressure() > pressure.high_pressure_limit()) { |
719 pressure._high_pressure_index = 0; | 709 pressure.set_high_pressure_index_to_block_start(); |
720 } | 710 } |
721 } | 711 } |
722 | 712 |
723 /* | 713 /* |
724 * Compute high pressure indice; avoid landing in the middle of projnodes | 714 * Compute high pressure indice; avoid landing in the middle of projnodes |
725 * and set the high pressure index for the block | 715 * and set the high pressure index for the block |
726 */ | 716 */ |
727 void PhaseChaitin::adjust_high_pressure_index(Block* b, uint& block_hrp_index, Pressure& pressure) { | 717 void PhaseChaitin::adjust_high_pressure_index(Block* b, uint& block_hrp_index, Pressure& pressure) { |
728 uint i = pressure._high_pressure_index; | 718 uint i = pressure.high_pressure_index(); |
729 if (i < b->number_of_nodes() && i < b->end_idx() + 1) { | 719 if (i < b->number_of_nodes() && i < b->end_idx() + 1) { |
730 Node* cur = b->get_node(i); | 720 Node* cur = b->get_node(i); |
731 while (cur->is_Proj() || (cur->is_MachNullCheck()) || cur->is_Catch()) { | 721 while (cur->is_Proj() || (cur->is_MachNullCheck()) || cur->is_Catch()) { |
732 cur = b->get_node(--i); | 722 cur = b->get_node(--i); |
733 } | 723 } |
787 // removed from the DEF sight, so LOWER costs here. | 777 // removed from the DEF sight, so LOWER costs here. |
788 lrg._cost += n->rematerialize() ? 0 : block->_freq; | 778 lrg._cost += n->rematerialize() ? 0 : block->_freq; |
789 | 779 |
790 if (!liveout.member(lid) && n->Opcode() != Op_SafePoint) { | 780 if (!liveout.member(lid) && n->Opcode() != Op_SafePoint) { |
791 if (remove_node_if_not_used(block, location, n, lid, &liveout)) { | 781 if (remove_node_if_not_used(block, location, n, lid, &liveout)) { |
792 float_pressure._high_pressure_index--; | 782 float_pressure.lower_high_pressure_index(); |
793 int_pressure._high_pressure_index--; | 783 int_pressure.lower_high_pressure_index(); |
794 continue; | 784 continue; |
795 } | 785 } |
796 if (lrg._fat_proj) { | 786 if (lrg._fat_proj) { |
797 check_for_high_pressure_transition_at_fatproj(block->_reg_pressure, location, lrg, int_pressure, Op_RegI); | 787 check_for_high_pressure_transition_at_fatproj(block->_reg_pressure, location, lrg, int_pressure, Op_RegI); |
798 check_for_high_pressure_transition_at_fatproj(block->_freg_pressure, location, lrg, float_pressure, Op_RegD); | 788 check_for_high_pressure_transition_at_fatproj(block->_freg_pressure, location, lrg, float_pressure, Op_RegD); |
835 check_for_high_pressure_block(int_pressure); | 825 check_for_high_pressure_block(int_pressure); |
836 check_for_high_pressure_block(float_pressure); | 826 check_for_high_pressure_block(float_pressure); |
837 adjust_high_pressure_index(block, block->_ihrp_index, int_pressure); | 827 adjust_high_pressure_index(block, block->_ihrp_index, int_pressure); |
838 adjust_high_pressure_index(block, block->_fhrp_index, float_pressure); | 828 adjust_high_pressure_index(block, block->_fhrp_index, float_pressure); |
839 // set the final_pressure as the register pressure for the block | 829 // set the final_pressure as the register pressure for the block |
840 block->_reg_pressure = int_pressure._final_pressure; | 830 block->_reg_pressure = int_pressure.final_pressure(); |
841 block->_freg_pressure = float_pressure._final_pressure; | 831 block->_freg_pressure = float_pressure.final_pressure(); |
842 | 832 |
843 #ifndef PRODUCT | 833 #ifndef PRODUCT |
844 // Gather Register Pressure Statistics | 834 // Gather Register Pressure Statistics |
845 if (PrintOptoStatistics) { | 835 if (PrintOptoStatistics) { |
846 if (block->_reg_pressure > int_pressure._high_pressure_limit || block->_freg_pressure > float_pressure._high_pressure_limit) { | 836 if (block->_reg_pressure > int_pressure.high_pressure_limit() || block->_freg_pressure > float_pressure.high_pressure_limit()) { |
847 _high_pressure++; | 837 _high_pressure++; |
848 } else { | 838 } else { |
849 _low_pressure++; | 839 _low_pressure++; |
850 } | 840 } |
851 } | 841 } |