510 while (lid != 0) { 511 LRG& lrg = lrgs(lid); 512 lrg._area += cost; 513 raise_pressure(b, lrg, int_pressure, float_pressure); 514 lid = elements.next(); 515 } 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"); 518 } 519 520 /* 521 * Remove dead node if it's not used. 522 * We only remove projection nodes if the node "defining" the projection is 523 * dead, for example on x86, if we have a dead Add node we remove its 524 * RFLAGS node. 525 */ 526 bool PhaseChaitin::remove_node_if_not_used(Block* b, uint location, Node* n, uint lid, IndexSet* liveout) { 527 Node* def = n->in(0); 528 if (!n->is_Proj() || 529 (_lrg_map.live_range_id(def) && !liveout->member(_lrg_map.live_range_id(def)))) { 530 b->remove_node(location); 531 LRG& lrg = lrgs(lid); 532 if (lrg._def == n) { 533 lrg._def = 0; 534 } 535 n->disconnect_inputs(NULL, C); 536 _cfg.unmap_node_from_block(n); 537 n->replace_by(C->top()); 538 return true; 539 } 540 return false; 541 } 542 543 /* 544 * When encountering a fat projection, we might go from a low to high to low 545 * (since the fat proj only lives at this instruction) going backwards in the 546 * block. If we find a low to high transition, we record it. 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) { 549 RegMask mask_tmp = lrg.mask(); | 510 while (lid != 0) { 511 LRG& lrg = lrgs(lid); 512 lrg._area += cost; 513 raise_pressure(b, lrg, int_pressure, float_pressure); 514 lid = elements.next(); 515 } 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"); 518 } 519 520 /* 521 * Remove dead node if it's not used. 522 * We only remove projection nodes if the node "defining" the projection is 523 * dead, for example on x86, if we have a dead Add node we remove its 524 * RFLAGS node. 525 */ 526 bool PhaseChaitin::remove_node_if_not_used(Block* b, uint location, Node* n, uint lid, IndexSet* liveout) { 527 Node* def = n->in(0); 528 if (!n->is_Proj() || 529 (_lrg_map.live_range_id(def) && !liveout->member(_lrg_map.live_range_id(def)))) { 530 if (n->is_MachProj()) { 531 // Don't remove KILL projections if their "defining" nodes have 532 // memory effects (have SCMemProj projection node) - 533 // they are not dead even when their result is not used. 534 // For example, compareAndSwapL (and other CAS) and EncodeISOArray nodes. 535 // The method add_input_to_liveout() keeps such nodes alive (put them on liveout list) 536 // when it sees SCMemProj node in a block. Unfortunately SCMemProj node could be placed 537 // in block in such order that KILL MachProj nodes are processed first. 538 uint cnt = def->outcnt(); 539 for (uint i = 0; i < cnt; i++) { 540 Node* proj = def->raw_out(i); 541 if (proj->Opcode() == Op_SCMemProj) { 542 return false; 543 } 544 } 545 } 546 b->remove_node(location); 547 LRG& lrg = lrgs(lid); 548 if (lrg._def == n) { 549 lrg._def = 0; 550 } 551 n->disconnect_inputs(NULL, C); 552 _cfg.unmap_node_from_block(n); 553 n->replace_by(C->top()); 554 return true; 555 } 556 return false; 557 } 558 559 /* 560 * When encountering a fat projection, we might go from a low to high to low 561 * (since the fat proj only lives at this instruction) going backwards in the 562 * block. If we find a low to high transition, we record it. 563 */ 564 void PhaseChaitin::check_for_high_pressure_transition_at_fatproj(uint& block_reg_pressure, uint location, LRG& lrg, Pressure& pressure, const int op_regtype) { 565 RegMask mask_tmp = lrg.mask(); |