5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 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 "incls/_precompiled.incl" 26 #include "incls/_loopTransform.cpp.incl" 27 28 //------------------------------is_loop_exit----------------------------------- 29 // Given an IfNode, return the loop-exiting projection or NULL if both 30 // arms remain in the loop. 31 Node *IdealLoopTree::is_loop_exit(Node *iff) const { 32 if( iff->outcnt() != 2 ) return NULL; // Ignore partially dead tests 33 PhaseIdealLoop *phase = _phase; 34 // Test is an IfNode, has 2 projections. If BOTH are in the loop 35 // we need loop unswitching instead of peeling. 36 if( !is_member(phase->get_loop( iff->raw_out(0) )) ) 37 return iff->raw_out(0); 38 if( !is_member(phase->get_loop( iff->raw_out(1) )) ) 39 return iff->raw_out(1); 40 return NULL; 41 } 42 43 44 //============================================================================= 45 46 | 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 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 "compiler/compileLog.hpp" 27 #include "memory/allocation.inline.hpp" 28 #include "opto/addnode.hpp" 29 #include "opto/callnode.hpp" 30 #include "opto/connode.hpp" 31 #include "opto/divnode.hpp" 32 #include "opto/loopnode.hpp" 33 #include "opto/mulnode.hpp" 34 #include "opto/rootnode.hpp" 35 #include "opto/runtime.hpp" 36 #include "opto/subnode.hpp" 37 38 //------------------------------is_loop_exit----------------------------------- 39 // Given an IfNode, return the loop-exiting projection or NULL if both 40 // arms remain in the loop. 41 Node *IdealLoopTree::is_loop_exit(Node *iff) const { 42 if( iff->outcnt() != 2 ) return NULL; // Ignore partially dead tests 43 PhaseIdealLoop *phase = _phase; 44 // Test is an IfNode, has 2 projections. If BOTH are in the loop 45 // we need loop unswitching instead of peeling. 46 if( !is_member(phase->get_loop( iff->raw_out(0) )) ) 47 return iff->raw_out(0); 48 if( !is_member(phase->get_loop( iff->raw_out(1) )) ) 49 return iff->raw_out(1); 50 return NULL; 51 } 52 53 54 //============================================================================= 55 56 |