1 /* 2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 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 "opto/loopnode.hpp" 27 #include "opto/opaquenode.hpp" 28 #include "opto/phaseX.hpp" 29 30 //============================================================================= 31 // Do not allow value-numbering 32 uint Opaque1Node::hash() const { return NO_HASH; } 33 uint Opaque1Node::cmp(const Node &n) const { 34 return (&n == this); // Always fail except on self 35 } 36 37 //------------------------------Identity--------------------------------------- 38 // If _major_progress, then more loop optimizations follow. Do NOT remove 39 // the opaque Node until no more loop ops can happen. Note the timing of 40 // _major_progress; it's set in the major loop optimizations THEN comes the 41 // call to IterGVN and any chance of hitting this code. Hence there's no 42 // phase-ordering problem with stripping Opaque1 in IGVN followed by some 43 // more loop optimizations that require it. 44 Node *Opaque1Node::Identity(PhaseTransform *phase) { 45 return phase->C->major_progress() ? this : in(1); 46 } 47 48 //============================================================================= 49 // A node to prevent unwanted optimizations. Allows constant folding. Stops 50 // value-numbering, most Ideal calls or Identity functions. This Node is 51 // specifically designed to prevent the pre-increment value of a loop trip 52 // counter from being live out of the bottom of the loop (hence causing the 53 // pre- and post-increment values both being live and thus requiring an extra 54 // temp register and an extra move). If we "accidentally" optimize through 55 // this kind of a Node, we'll get slightly pessimal, but correct, code. Thus 56 // it's OK to be slightly sloppy on optimizations here. 57 58 // Do not allow value-numbering 59 uint Opaque2Node::hash() const { return NO_HASH; } 60 uint Opaque2Node::cmp( const Node &n ) const { 61 return (&n == this); // Always fail except on self 62 } 63 64