src/share/vm/opto/cfgnode.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2009, 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 // Portions of code courtesy of Clifford Click
  26 
  27 // Optimization - Graph Style
  28 
  29 #include "incls/_precompiled.incl"
  30 #include "incls/_cfgnode.cpp.incl"
  31 
  32 //=============================================================================
  33 //------------------------------Value------------------------------------------
  34 // Compute the type of the RegionNode.
  35 const Type *RegionNode::Value( PhaseTransform *phase ) const {
  36   for( uint i=1; i<req(); ++i ) {       // For all paths in
  37     Node *n = in(i);            // Get Control source
  38     if( !n ) continue;          // Missing inputs are TOP
  39     if( phase->type(n) == Type::CONTROL )
  40       return Type::CONTROL;
  41   }
  42   return Type::TOP;             // All paths dead?  Then so are we
  43 }
  44 
  45 //------------------------------Identity---------------------------------------
  46 // Check for Region being Identity.
  47 Node *RegionNode::Identity( PhaseTransform *phase ) {
  48   // Cannot have Region be an identity, even if it has only 1 input.
  49   // Phi users cannot have their Region input folded away for them,
  50   // since they need to select the proper data input
  51   return this;


   1 /*
   2  * Copyright (c) 1997, 2010, 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 "classfile/systemDictionary.hpp"
  27 #include "memory/allocation.inline.hpp"
  28 #include "oops/objArrayKlass.hpp"
  29 #include "opto/addnode.hpp"
  30 #include "opto/cfgnode.hpp"
  31 #include "opto/connode.hpp"
  32 #include "opto/loopnode.hpp"
  33 #include "opto/machnode.hpp"
  34 #include "opto/mulnode.hpp"
  35 #include "opto/phaseX.hpp"
  36 #include "opto/regmask.hpp"
  37 #include "opto/runtime.hpp"
  38 #include "opto/subnode.hpp"
  39 
  40 // Portions of code courtesy of Clifford Click
  41 
  42 // Optimization - Graph Style
  43 



  44 //=============================================================================
  45 //------------------------------Value------------------------------------------
  46 // Compute the type of the RegionNode.
  47 const Type *RegionNode::Value( PhaseTransform *phase ) const {
  48   for( uint i=1; i<req(); ++i ) {       // For all paths in
  49     Node *n = in(i);            // Get Control source
  50     if( !n ) continue;          // Missing inputs are TOP
  51     if( phase->type(n) == Type::CONTROL )
  52       return Type::CONTROL;
  53   }
  54   return Type::TOP;             // All paths dead?  Then so are we
  55 }
  56 
  57 //------------------------------Identity---------------------------------------
  58 // Check for Region being Identity.
  59 Node *RegionNode::Identity( PhaseTransform *phase ) {
  60   // Cannot have Region be an identity, even if it has only 1 input.
  61   // Phi users cannot have their Region input folded away for them,
  62   // since they need to select the proper data input
  63   return this;