< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/cfg/Block.java

Print this page




  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 package org.graalvm.compiler.nodes.cfg;
  26 
  27 import java.util.ArrayList;
  28 import java.util.Iterator;
  29 
  30 import org.graalvm.compiler.core.common.cfg.AbstractBlockBase;
  31 import org.graalvm.compiler.core.common.cfg.AbstractControlFlowGraph;
  32 import org.graalvm.compiler.core.common.cfg.Loop;
  33 import org.graalvm.compiler.graph.Node;
  34 import org.graalvm.compiler.nodeinfo.Verbosity;
  35 import org.graalvm.compiler.nodes.AbstractBeginNode;
  36 import org.graalvm.compiler.nodes.BeginNode;
  37 import org.graalvm.compiler.nodes.FixedNode;
  38 import org.graalvm.compiler.nodes.FixedWithNextNode;
  39 import org.graalvm.compiler.nodes.InvokeWithExceptionNode;
  40 import org.graalvm.compiler.nodes.LoopBeginNode;
  41 import org.graalvm.compiler.nodes.LoopEndNode;
  42 import org.graalvm.compiler.nodes.LoopExitNode;
  43 import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
  44 import jdk.internal.vm.compiler.word.LocationIdentity;
  45 
  46 public final class Block extends AbstractBlockBase<Block> {
  47     public static final Block[] EMPTY_ARRAY = new Block[0];
  48 
  49     protected final AbstractBeginNode beginNode;
  50 
  51     protected FixedNode endNode;
  52 
  53     protected double relativeFrequency;
  54     private Loop<Block> loop;
  55 
  56     protected Block postdominator;
  57     private LocationSet killLocations;
  58     private LocationSet killLocationsBetweenThisAndDominator;
  59 
  60     public Block(AbstractBeginNode node) {
  61         this.beginNode = node;
  62     }
  63 
  64     public AbstractBeginNode getBeginNode() {
  65         return beginNode;
  66     }
  67 
  68     public FixedNode getEndNode() {
  69         return endNode;
  70     }
  71 
  72     /**
  73      * Return the {@link LoopExitNode} for this block if it exists.
  74      */
  75     public LoopExitNode getLoopExit() {
  76         if (beginNode instanceof BeginNode) {
  77             if (beginNode.next() instanceof LoopExitNode) {
  78                 return (LoopExitNode) beginNode.next();
  79             }
  80         }
  81         if (beginNode instanceof LoopExitNode) {
  82             return (LoopExitNode) beginNode;
  83         }
  84         return null;
  85     }
  86 
  87     @Override
  88     public Loop<Block> getLoop() {
  89         return loop;
  90     }
  91 
  92     public void setLoop(Loop<Block> loop) {
  93         this.loop = loop;
  94     }
  95 
  96     @Override
  97     public int getLoopDepth() {
  98         return loop == null ? 0 : loop.getDepth();
  99     }
 100 
 101     @Override
 102     public boolean isLoopHeader() {
 103         return getBeginNode() instanceof LoopBeginNode;
 104     }




  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 package org.graalvm.compiler.nodes.cfg;
  26 
  27 import java.util.ArrayList;
  28 import java.util.Iterator;
  29 
  30 import org.graalvm.compiler.core.common.cfg.AbstractBlockBase;
  31 import org.graalvm.compiler.core.common.cfg.AbstractControlFlowGraph;
  32 import org.graalvm.compiler.core.common.cfg.Loop;
  33 import org.graalvm.compiler.graph.Node;
  34 import org.graalvm.compiler.nodeinfo.Verbosity;
  35 import org.graalvm.compiler.nodes.AbstractBeginNode;

  36 import org.graalvm.compiler.nodes.FixedNode;
  37 import org.graalvm.compiler.nodes.FixedWithNextNode;
  38 import org.graalvm.compiler.nodes.InvokeWithExceptionNode;
  39 import org.graalvm.compiler.nodes.LoopBeginNode;
  40 import org.graalvm.compiler.nodes.LoopEndNode;

  41 import org.graalvm.compiler.nodes.memory.MemoryCheckpoint;
  42 import jdk.internal.vm.compiler.word.LocationIdentity;
  43 
  44 public final class Block extends AbstractBlockBase<Block> {
  45     public static final Block[] EMPTY_ARRAY = new Block[0];
  46 
  47     protected final AbstractBeginNode beginNode;
  48 
  49     protected FixedNode endNode;
  50 
  51     protected double relativeFrequency;
  52     private Loop<Block> loop;
  53 
  54     protected Block postdominator;
  55     private LocationSet killLocations;
  56     private LocationSet killLocationsBetweenThisAndDominator;
  57 
  58     public Block(AbstractBeginNode node) {
  59         this.beginNode = node;
  60     }
  61 
  62     public AbstractBeginNode getBeginNode() {
  63         return beginNode;
  64     }
  65 
  66     public FixedNode getEndNode() {
  67         return endNode;















  68     }
  69 
  70     @Override
  71     public Loop<Block> getLoop() {
  72         return loop;
  73     }
  74 
  75     public void setLoop(Loop<Block> loop) {
  76         this.loop = loop;
  77     }
  78 
  79     @Override
  80     public int getLoopDepth() {
  81         return loop == null ? 0 : loop.getDepth();
  82     }
  83 
  84     @Override
  85     public boolean isLoopHeader() {
  86         return getBeginNode() instanceof LoopBeginNode;
  87     }


< prev index next >