/* * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. * */ #include "precompiled.hpp" #include "opto/opaquenode.hpp" #include "opto/phaseX.hpp" //============================================================================= // Do not allow value-numbering uint Opaque1Node::hash() const { return NO_HASH; } uint Opaque1Node::cmp( const Node &n ) const { return (&n == this); // Always fail except on self } //------------------------------Identity--------------------------------------- // If _major_progress, then more loop optimizations follow. Do NOT remove // the opaque Node until no more loop ops can happen. Note the timing of // _major_progress; it's set in the major loop optimizations THEN comes the // call to IterGVN and any chance of hitting this code. Hence there's no // phase-ordering problem with stripping Opaque1 in IGVN followed by some // more loop optimizations that require it. Node *Opaque1Node::Identity( PhaseTransform *phase ) { return phase->C->major_progress() ? this : in(1); } //============================================================================= // A node to prevent unwanted optimizations. Allows constant folding. Stops // value-numbering, most Ideal calls or Identity functions. This Node is // specifically designed to prevent the pre-increment value of a loop trip // counter from being live out of the bottom of the loop (hence causing the // pre- and post-increment values both being live and thus requiring an extra // temp register and an extra move). If we "accidentally" optimize through // this kind of a Node, we'll get slightly pessimal, but correct, code. Thus // it's OK to be slightly sloppy on optimizations here. // Do not allow value-numbering uint Opaque2Node::hash() const { return NO_HASH; } uint Opaque2Node::cmp( const Node &n ) const { return (&n == this); // Always fail except on self } //============================================================================= uint Opaque4Node::hash() const { return NO_HASH; } uint Opaque4Node::cmp( const Node &n ) const { return (&n == this); } Node *Opaque4Node::Ideal(PhaseGVN *phase, bool can_reshape) { if (can_reshape & _delay_removal) { _delay_removal = false; return this; } else { return NULL; } } Node *Opaque4Node::Identity( PhaseTransform *phase ) { if (_delay_removal) { return this; } else { return in(1); } }