1415 1416 //------------------------------remove_dead_region----------------------------- 1417 bool Node::remove_dead_region(PhaseGVN *phase, bool can_reshape) { 1418 Node *n = in(0); 1419 if( !n ) return false; 1420 // Lost control into this guy? I.e., it became unreachable? 1421 // Aggressively kill all unreachable code. 1422 if (can_reshape && n->is_top()) { 1423 kill_dead_code(this, phase->is_IterGVN()); 1424 return false; // Node is dead. 1425 } 1426 1427 if( n->is_Region() && n->as_Region()->is_copy() ) { 1428 Node *m = n->nonnull_req(); 1429 set_req(0, m); 1430 return true; 1431 } 1432 return false; 1433 } 1434 1435 //------------------------------Ideal_DU_postCCP------------------------------- 1436 // Idealize graph, using DU info. Must clone result into new-space 1437 Node *Node::Ideal_DU_postCCP( PhaseCCP * ) { 1438 return NULL; // Default to no change 1439 } 1440 1441 //------------------------------hash------------------------------------------- 1442 // Hash function over Nodes. 1443 uint Node::hash() const { 1444 uint sum = 0; 1445 for( uint i=0; i<_cnt; i++ ) // Add in all inputs 1446 sum = (sum<<1)-(uintptr_t)in(i); // Ignore embedded NULLs 1447 return (sum>>2) + _cnt + Opcode(); 1448 } 1449 1450 //------------------------------cmp-------------------------------------------- 1451 // Compare special parts of simple Nodes 1452 uint Node::cmp( const Node &n ) const { 1453 return 1; // Must be same 1454 } 1455 1456 //------------------------------rematerialize----------------------------------- 1457 // Should we clone rather than spill this instruction? 1458 bool Node::rematerialize() const { 1459 if ( is_Mach() ) 1460 return this->as_Mach()->rematerialize(); 2107 } 2108 } 2109 } 2110 } 2111 return NULL; 2112 } 2113 2114 2115 //--------------------------unique_ctrl_out------------------------------ 2116 // Return the unique control out if only one. Null if none or more than one. 2117 Node* Node::unique_ctrl_out() { 2118 Node* found = NULL; 2119 for (uint i = 0; i < outcnt(); i++) { 2120 Node* use = raw_out(i); 2121 if (use->is_CFG() && use != this) { 2122 if (found != NULL) return NULL; 2123 found = use; 2124 } 2125 } 2126 return found; 2127 } 2128 2129 //============================================================================= 2130 //------------------------------yank------------------------------------------- 2131 // Find and remove 2132 void Node_List::yank( Node *n ) { 2133 uint i; 2134 for( i = 0; i < _cnt; i++ ) 2135 if( _nodes[i] == n ) 2136 break; 2137 2138 if( i < _cnt ) 2139 _nodes[i] = _nodes[--_cnt]; 2140 } 2141 2142 //------------------------------dump------------------------------------------- 2143 void Node_List::dump() const { 2144 #ifndef PRODUCT 2145 for( uint i = 0; i < _cnt; i++ ) 2146 if( _nodes[i] ) { | 1415 1416 //------------------------------remove_dead_region----------------------------- 1417 bool Node::remove_dead_region(PhaseGVN *phase, bool can_reshape) { 1418 Node *n = in(0); 1419 if( !n ) return false; 1420 // Lost control into this guy? I.e., it became unreachable? 1421 // Aggressively kill all unreachable code. 1422 if (can_reshape && n->is_top()) { 1423 kill_dead_code(this, phase->is_IterGVN()); 1424 return false; // Node is dead. 1425 } 1426 1427 if( n->is_Region() && n->as_Region()->is_copy() ) { 1428 Node *m = n->nonnull_req(); 1429 set_req(0, m); 1430 return true; 1431 } 1432 return false; 1433 } 1434 1435 //------------------------------hash------------------------------------------- 1436 // Hash function over Nodes. 1437 uint Node::hash() const { 1438 uint sum = 0; 1439 for( uint i=0; i<_cnt; i++ ) // Add in all inputs 1440 sum = (sum<<1)-(uintptr_t)in(i); // Ignore embedded NULLs 1441 return (sum>>2) + _cnt + Opcode(); 1442 } 1443 1444 //------------------------------cmp-------------------------------------------- 1445 // Compare special parts of simple Nodes 1446 uint Node::cmp( const Node &n ) const { 1447 return 1; // Must be same 1448 } 1449 1450 //------------------------------rematerialize----------------------------------- 1451 // Should we clone rather than spill this instruction? 1452 bool Node::rematerialize() const { 1453 if ( is_Mach() ) 1454 return this->as_Mach()->rematerialize(); 2101 } 2102 } 2103 } 2104 } 2105 return NULL; 2106 } 2107 2108 2109 //--------------------------unique_ctrl_out------------------------------ 2110 // Return the unique control out if only one. Null if none or more than one. 2111 Node* Node::unique_ctrl_out() { 2112 Node* found = NULL; 2113 for (uint i = 0; i < outcnt(); i++) { 2114 Node* use = raw_out(i); 2115 if (use->is_CFG() && use != this) { 2116 if (found != NULL) return NULL; 2117 found = use; 2118 } 2119 } 2120 return found; 2121 } 2122 2123 void Node::ensure_control_or_add_prec(Node* c) { 2124 if (in(0) == NULL) { 2125 set_req(0, c); 2126 } else if (in(0) != c) { 2127 add_prec(c); 2128 } 2129 } 2130 2131 //============================================================================= 2132 //------------------------------yank------------------------------------------- 2133 // Find and remove 2134 void Node_List::yank( Node *n ) { 2135 uint i; 2136 for( i = 0; i < _cnt; i++ ) 2137 if( _nodes[i] == n ) 2138 break; 2139 2140 if( i < _cnt ) 2141 _nodes[i] = _nodes[--_cnt]; 2142 } 2143 2144 //------------------------------dump------------------------------------------- 2145 void Node_List::dump() const { 2146 #ifndef PRODUCT 2147 for( uint i = 0; i < _cnt; i++ ) 2148 if( _nodes[i] ) { |