129 tty->print_cr("==============================================");
130 tty->print_cr("orig_old:");
131 orig_old->dump();
132 tty->print_cr("old:");
133 old->dump();
134 assert(false, "unexpected yanked node");
135 }
136 if (old->is_Con())
137 orig_old = old; // Reset to satisfy expected nodes checks.
138 #endif
139 blk_adjust += yank(old, current_block, value, regnd);
140
141 for (uint i = 1; i < old->req(); i++) {
142 Node* n = old->in(i);
143 if (n != NULL) {
144 old->set_req(i, NULL);
145 blk_adjust += yank_if_dead_recurse(n, orig_old, current_block, value, regnd);
146 }
147 }
148 // Disconnect control and remove precedence edges if any exist
149 old->disconnect_inputs(NULL);
150 }
151 return blk_adjust;
152 }
153
154 //------------------------------use_prior_register-----------------------------
155 // Use the prior value instead of the current value, in an effort to make
156 // the current value go dead. Return block iterator adjustment, in case
157 // we yank some instructions from this block.
158 int PhaseChaitin::use_prior_register( Node *n, uint idx, Node *def, Block *current_block, Node_List &value, Node_List ®nd ) {
159 // No effect?
160 if( def == n->in(idx) ) return 0;
161 // Def is currently dead and can be removed? Do not resurrect
162 if( def->outcnt() == 0 ) return 0;
163
164 // Not every pair of physical registers are assignment compatible,
165 // e.g. on sparc floating point registers are not assignable to integer
166 // registers.
167 const LRG &def_lrg = lrgs(n2lidx(def));
168 OptoReg::Name def_reg = def_lrg.reg();
169 const RegMask &use_mask = n->in_RegMask(idx);
496 }
497
498 // For all Phi's
499 for( j = 1; j < phi_dex; j++ ) {
500 uint k;
501 Node *phi = b->_nodes[j];
502 uint pidx = n2lidx(phi);
503 OptoReg::Name preg = lrgs(n2lidx(phi)).reg();
504
505 // Remove copies remaining on edges. Check for junk phi.
506 Node *u = NULL;
507 for( k=1; k<phi->req(); k++ ) {
508 Node *x = phi->in(k);
509 if( phi != x && u != x ) // Found a different input
510 u = u ? NodeSentinel : x; // Capture unique input, or NodeSentinel for 2nd input
511 }
512 if( u != NodeSentinel ) { // Junk Phi. Remove
513 b->_nodes.remove(j--); phi_dex--;
514 _cfg._bbs.map(phi->_idx,NULL);
515 phi->replace_by(u);
516 phi->disconnect_inputs(NULL);
517 continue;
518 }
519 // Note that if value[pidx] exists, then we merged no new values here
520 // and the phi is useless. This can happen even with the above phi
521 // removal for complex flows. I cannot keep the better known value here
522 // because locally the phi appears to define a new merged value. If I
523 // keep the better value then a copy of the phi, being unable to use the
524 // global flow analysis, can't "peek through" the phi to the original
525 // reaching value and so will act like it's defining a new value. This
526 // can lead to situations where some uses are from the old and some from
527 // the new values. Not illegal by itself but throws the over-strong
528 // assert in scheduling.
529 if( pidx ) {
530 value.map(preg,phi);
531 regnd.map(preg,phi);
532 int n_regs = RegMask::num_registers(phi->ideal_reg());
533 for (int l = 1; l < n_regs; l++) {
534 OptoReg::Name preg_lo = OptoReg::add(preg,-l);
535 value.map(preg_lo,phi);
536 regnd.map(preg_lo,phi);
|
129 tty->print_cr("==============================================");
130 tty->print_cr("orig_old:");
131 orig_old->dump();
132 tty->print_cr("old:");
133 old->dump();
134 assert(false, "unexpected yanked node");
135 }
136 if (old->is_Con())
137 orig_old = old; // Reset to satisfy expected nodes checks.
138 #endif
139 blk_adjust += yank(old, current_block, value, regnd);
140
141 for (uint i = 1; i < old->req(); i++) {
142 Node* n = old->in(i);
143 if (n != NULL) {
144 old->set_req(i, NULL);
145 blk_adjust += yank_if_dead_recurse(n, orig_old, current_block, value, regnd);
146 }
147 }
148 // Disconnect control and remove precedence edges if any exist
149 old->disconnect_inputs(NULL, C);
150 }
151 return blk_adjust;
152 }
153
154 //------------------------------use_prior_register-----------------------------
155 // Use the prior value instead of the current value, in an effort to make
156 // the current value go dead. Return block iterator adjustment, in case
157 // we yank some instructions from this block.
158 int PhaseChaitin::use_prior_register( Node *n, uint idx, Node *def, Block *current_block, Node_List &value, Node_List ®nd ) {
159 // No effect?
160 if( def == n->in(idx) ) return 0;
161 // Def is currently dead and can be removed? Do not resurrect
162 if( def->outcnt() == 0 ) return 0;
163
164 // Not every pair of physical registers are assignment compatible,
165 // e.g. on sparc floating point registers are not assignable to integer
166 // registers.
167 const LRG &def_lrg = lrgs(n2lidx(def));
168 OptoReg::Name def_reg = def_lrg.reg();
169 const RegMask &use_mask = n->in_RegMask(idx);
496 }
497
498 // For all Phi's
499 for( j = 1; j < phi_dex; j++ ) {
500 uint k;
501 Node *phi = b->_nodes[j];
502 uint pidx = n2lidx(phi);
503 OptoReg::Name preg = lrgs(n2lidx(phi)).reg();
504
505 // Remove copies remaining on edges. Check for junk phi.
506 Node *u = NULL;
507 for( k=1; k<phi->req(); k++ ) {
508 Node *x = phi->in(k);
509 if( phi != x && u != x ) // Found a different input
510 u = u ? NodeSentinel : x; // Capture unique input, or NodeSentinel for 2nd input
511 }
512 if( u != NodeSentinel ) { // Junk Phi. Remove
513 b->_nodes.remove(j--); phi_dex--;
514 _cfg._bbs.map(phi->_idx,NULL);
515 phi->replace_by(u);
516 phi->disconnect_inputs(NULL, C);
517 continue;
518 }
519 // Note that if value[pidx] exists, then we merged no new values here
520 // and the phi is useless. This can happen even with the above phi
521 // removal for complex flows. I cannot keep the better known value here
522 // because locally the phi appears to define a new merged value. If I
523 // keep the better value then a copy of the phi, being unable to use the
524 // global flow analysis, can't "peek through" the phi to the original
525 // reaching value and so will act like it's defining a new value. This
526 // can lead to situations where some uses are from the old and some from
527 // the new values. Not illegal by itself but throws the over-strong
528 // assert in scheduling.
529 if( pidx ) {
530 value.map(preg,phi);
531 regnd.map(preg,phi);
532 int n_regs = RegMask::num_registers(phi->ideal_reg());
533 for (int l = 1; l < n_regs; l++) {
534 OptoReg::Name preg_lo = OptoReg::add(preg,-l);
535 value.map(preg_lo,phi);
536 regnd.map(preg_lo,phi);
|