src/share/vm/opto/loopnode.hpp

Print this page


   1 /*
   2  * Copyright (c) 1998, 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 class CmpNode;
  26 class CountedLoopEndNode;
  27 class CountedLoopNode;
  28 class IdealLoopTree;
  29 class LoopNode;
  30 class Node;
  31 class PhaseIdealLoop;
  32 class VectorSet;
  33 class Invariance;
  34 struct small_cache;
  35 
  36 //
  37 //                  I D E A L I Z E D   L O O P S
  38 //
  39 // Idealized loops are the set of loops I perform more interesting
  40 // transformations on, beyond simple hoisting.
  41 
  42 //------------------------------LoopNode---------------------------------------
  43 // Simple loop header.  Fall in path on left, loop-back path on right.
  44 class LoopNode : public RegionNode {


 998 // Example that visits all counted loops from within PhaseIdealLoop
 999 //
1000 //  for (LoopTreeIterator iter(_ltree_root); !iter.done(); iter.next()) {
1001 //   IdealLoopTree* lpt = iter.current();
1002 //   if (!lpt->is_counted()) continue;
1003 //   ...
1004 class LoopTreeIterator : public StackObj {
1005 private:
1006   IdealLoopTree* _root;
1007   IdealLoopTree* _curnt;
1008 
1009 public:
1010   LoopTreeIterator(IdealLoopTree* root) : _root(root), _curnt(root) {}
1011 
1012   bool done() { return _curnt == NULL; }       // Finished iterating?
1013 
1014   void next();                                 // Advance to next loop tree
1015 
1016   IdealLoopTree* current() { return _curnt; }  // Return current value of iterator.
1017 };


   1 /*
   2  * Copyright (c) 1998, 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 #ifndef SHARE_VM_OPTO_LOOPNODE_HPP
  26 #define SHARE_VM_OPTO_LOOPNODE_HPP
  27 
  28 #include "opto/cfgnode.hpp"
  29 #include "opto/multnode.hpp"
  30 #include "opto/phaseX.hpp"
  31 #include "opto/subnode.hpp"
  32 #include "opto/type.hpp"
  33 
  34 class CmpNode;
  35 class CountedLoopEndNode;
  36 class CountedLoopNode;
  37 class IdealLoopTree;
  38 class LoopNode;
  39 class Node;
  40 class PhaseIdealLoop;
  41 class VectorSet;
  42 class Invariance;
  43 struct small_cache;
  44 
  45 //
  46 //                  I D E A L I Z E D   L O O P S
  47 //
  48 // Idealized loops are the set of loops I perform more interesting
  49 // transformations on, beyond simple hoisting.
  50 
  51 //------------------------------LoopNode---------------------------------------
  52 // Simple loop header.  Fall in path on left, loop-back path on right.
  53 class LoopNode : public RegionNode {


1007 // Example that visits all counted loops from within PhaseIdealLoop
1008 //
1009 //  for (LoopTreeIterator iter(_ltree_root); !iter.done(); iter.next()) {
1010 //   IdealLoopTree* lpt = iter.current();
1011 //   if (!lpt->is_counted()) continue;
1012 //   ...
1013 class LoopTreeIterator : public StackObj {
1014 private:
1015   IdealLoopTree* _root;
1016   IdealLoopTree* _curnt;
1017 
1018 public:
1019   LoopTreeIterator(IdealLoopTree* root) : _root(root), _curnt(root) {}
1020 
1021   bool done() { return _curnt == NULL; }       // Finished iterating?
1022 
1023   void next();                                 // Advance to next loop tree
1024 
1025   IdealLoopTree* current() { return _curnt; }  // Return current value of iterator.
1026 };
1027 
1028 #endif // SHARE_VM_OPTO_LOOPNODE_HPP