8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "memory/allocation.inline.hpp"
27 #include "opto/callnode.hpp"
28 #include "opto/loopnode.hpp"
29 #include "opto/movenode.hpp"
30 #include "opto/opaquenode.hpp"
31
32
33 //------------------------------split_thru_region------------------------------
34 // Split Node 'n' through merge point.
35 RegionNode* PhaseIdealLoop::split_thru_region(Node* n, RegionNode* region) {
36 assert(n->is_CFG(), "");
37 RegionNode* r = new RegionNode(region->req());
38 IdealLoopTree* loop = get_loop(n);
39 for (uint i = 1; i < region->req(); i++) {
40 Node* x = n->clone();
41 Node* in0 = n->in(0);
42 if (in0->in(0) == region) x->set_req(0, in0->in(i));
43 for (uint j = 1; j < n->req(); j++) {
44 Node* in = n->in(j);
45 if (get_ctrl(in) == region) {
46 x->set_req(j, in->in(i));
47 }
495 Node* n = region->out(i);
496 if( n == region ) continue;
497 // The IF to be split is OK.
498 if( n == iff ) continue;
499 if( !n->is_Phi() ) { // Found pinned memory op or such
500 if (split_up(n, region, iff)) {
501 i = region->refresh_out_pos(i);
502 progress = true;
503 }
504 continue;
505 }
506 assert( n->in(0) == region, "" );
507
508 // Recursively split up all users of a Phi
509 for (j = n->outs(); n->has_out(j); j++) {
510 Node* m = n->out(j);
511 // If m is dead, throw it away, and declare progress
512 if (_nodes[m->_idx] == NULL) {
513 _igvn.remove_dead_node(m);
514 // fall through
515 }
516 else if (m != iff && split_up(m, region, iff)) {
517 // fall through
518 } else {
519 continue;
520 }
521 // Something unpredictable changed.
522 // Tell the iterators to refresh themselves, and rerun the loop.
523 i = region->refresh_out_pos(i);
524 j = region->refresh_out_pos(j);
525 progress = true;
526 }
527 }
528 }
529
530 // Now we have no instructions in the block containing the IF.
531 // Split the IF.
532 RegionNode *new_iff = split_thru_region(iff, region);
533
534 // Replace both uses of 'new_iff' with Regions merging True/False
535 // paths. This makes 'new_iff' go dead.
536 Node *old_false = NULL, *old_true = NULL;
|
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "memory/allocation.inline.hpp"
27 #include "opto/callnode.hpp"
28 #include "opto/inlinetypenode.hpp"
29 #include "opto/loopnode.hpp"
30 #include "opto/movenode.hpp"
31 #include "opto/opaquenode.hpp"
32
33
34 //------------------------------split_thru_region------------------------------
35 // Split Node 'n' through merge point.
36 RegionNode* PhaseIdealLoop::split_thru_region(Node* n, RegionNode* region) {
37 assert(n->is_CFG(), "");
38 RegionNode* r = new RegionNode(region->req());
39 IdealLoopTree* loop = get_loop(n);
40 for (uint i = 1; i < region->req(); i++) {
41 Node* x = n->clone();
42 Node* in0 = n->in(0);
43 if (in0->in(0) == region) x->set_req(0, in0->in(i));
44 for (uint j = 1; j < n->req(); j++) {
45 Node* in = n->in(j);
46 if (get_ctrl(in) == region) {
47 x->set_req(j, in->in(i));
48 }
496 Node* n = region->out(i);
497 if( n == region ) continue;
498 // The IF to be split is OK.
499 if( n == iff ) continue;
500 if( !n->is_Phi() ) { // Found pinned memory op or such
501 if (split_up(n, region, iff)) {
502 i = region->refresh_out_pos(i);
503 progress = true;
504 }
505 continue;
506 }
507 assert( n->in(0) == region, "" );
508
509 // Recursively split up all users of a Phi
510 for (j = n->outs(); n->has_out(j); j++) {
511 Node* m = n->out(j);
512 // If m is dead, throw it away, and declare progress
513 if (_nodes[m->_idx] == NULL) {
514 _igvn.remove_dead_node(m);
515 // fall through
516 } else if (m != iff && split_up(m, region, iff)) {
517 // fall through
518 } else {
519 continue;
520 }
521 // Something unpredictable changed.
522 // Tell the iterators to refresh themselves, and rerun the loop.
523 i = region->refresh_out_pos(i);
524 j = region->refresh_out_pos(j);
525 progress = true;
526 }
527 }
528 }
529
530 // Now we have no instructions in the block containing the IF.
531 // Split the IF.
532 RegionNode *new_iff = split_thru_region(iff, region);
533
534 // Replace both uses of 'new_iff' with Regions merging True/False
535 // paths. This makes 'new_iff' go dead.
536 Node *old_false = NULL, *old_true = NULL;
|