comparison src/share/vm/opto/phaseX.cpp @ 12167:650868c062a9

8023691: Create interface for nodes in class Block Summary: Create public methods for accessing the nodes in a block Reviewed-by: kvn, roland
author adlertz
date Mon, 26 Aug 2013 12:50:23 +0200
parents adb9a7d94cb5
children b2ee5dc63353
comparison
equal deleted inserted replaced
12161:e1fbb86b47e4 12167:650868c062a9
1646 for (uint block_number = 1; block_number < _cfg.number_of_blocks(); ++block_number) { 1646 for (uint block_number = 1; block_number < _cfg.number_of_blocks(); ++block_number) {
1647 Block* block = _cfg.get_block(block_number); 1647 Block* block = _cfg.get_block(block_number);
1648 bool block_not_printed = true; 1648 bool block_not_printed = true;
1649 1649
1650 // and each instruction within a block 1650 // and each instruction within a block
1651 uint end_index = block->_nodes.size(); 1651 uint end_index = block->number_of_nodes();
1652 // block->end_idx() not valid after PhaseRegAlloc 1652 // block->end_idx() not valid after PhaseRegAlloc
1653 for( uint instruction_index = 1; instruction_index < end_index; ++instruction_index ) { 1653 for( uint instruction_index = 1; instruction_index < end_index; ++instruction_index ) {
1654 Node *n = block->_nodes.at(instruction_index); 1654 Node *n = block->get_node(instruction_index);
1655 if( n->is_Mach() ) { 1655 if( n->is_Mach() ) {
1656 MachNode *m = n->as_Mach(); 1656 MachNode *m = n->as_Mach();
1657 int deleted_count = 0; 1657 int deleted_count = 0;
1658 // check for peephole opportunities 1658 // check for peephole opportunities
1659 MachNode *m2 = m->peephole( block, instruction_index, _regalloc, deleted_count, C ); 1659 MachNode *m2 = m->peephole( block, instruction_index, _regalloc, deleted_count, C );
1671 block->dump(); 1671 block->dump();
1672 block_not_printed = false; 1672 block_not_printed = false;
1673 } 1673 }
1674 // Print instructions being deleted 1674 // Print instructions being deleted
1675 for( int i = (deleted_count - 1); i >= 0; --i ) { 1675 for( int i = (deleted_count - 1); i >= 0; --i ) {
1676 block->_nodes.at(instruction_index-i)->as_Mach()->format(_regalloc); tty->cr(); 1676 block->get_node(instruction_index-i)->as_Mach()->format(_regalloc); tty->cr();
1677 } 1677 }
1678 tty->print_cr("replaced with"); 1678 tty->print_cr("replaced with");
1679 // Print new instruction 1679 // Print new instruction
1680 m2->format(_regalloc); 1680 m2->format(_regalloc);
1681 tty->print("\n\n"); 1681 tty->print("\n\n");
1685 // (old nodes still exist and may have edges pointing to them 1685 // (old nodes still exist and may have edges pointing to them
1686 // as register allocation info is stored in the allocator using 1686 // as register allocation info is stored in the allocator using
1687 // the node index to live range mappings.) 1687 // the node index to live range mappings.)
1688 uint safe_instruction_index = (instruction_index - deleted_count); 1688 uint safe_instruction_index = (instruction_index - deleted_count);
1689 for( ; (instruction_index > safe_instruction_index); --instruction_index ) { 1689 for( ; (instruction_index > safe_instruction_index); --instruction_index ) {
1690 block->_nodes.remove( instruction_index ); 1690 block->remove_node( instruction_index );
1691 } 1691 }
1692 // install new node after safe_instruction_index 1692 // install new node after safe_instruction_index
1693 block->_nodes.insert( safe_instruction_index + 1, m2 ); 1693 block->insert_node(m2, safe_instruction_index + 1);
1694 end_index = block->_nodes.size() - 1; // Recompute new block size 1694 end_index = block->number_of_nodes() - 1; // Recompute new block size
1695 NOT_PRODUCT( inc_peepholes(); ) 1695 NOT_PRODUCT( inc_peepholes(); )
1696 } 1696 }
1697 } 1697 }
1698 } 1698 }
1699 } 1699 }