annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginNode.java @ 7530:5e3d1a68664e

applied mx eclipseformat to all Java files
author Doug Simon <doug.simon@oracle.com>
date Wed, 23 Jan 2013 16:34:57 +0100
parents f170a0d2b3b9
children a58851061377
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
23 package com.oracle.graal.nodes;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
5210
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
25 import static com.oracle.graal.graph.iterators.NodePredicates.*;
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
26
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
27 import java.util.*;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
29 import com.oracle.graal.graph.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
30 import com.oracle.graal.graph.iterators.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
31 import com.oracle.graal.nodes.spi.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
32 import com.oracle.graal.nodes.type.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33
5375
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
34 public class BeginNode extends FixedWithNextNode implements StateSplit, LIRLowerable, Simplifiable, Node.IterableNodeType {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6577
diff changeset
35
5375
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
36 @Input(notDataflow = true) private FrameState stateAfter;
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
37
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
38 public FrameState stateAfter() {
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
39 return stateAfter;
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
40 }
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
41
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
42 public void setStateAfter(FrameState x) {
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
43 assert x == null || x.isAlive() : "frame state must be in a graph";
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
44 updateUsages(stateAfter, x);
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
45 stateAfter = x;
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
46 }
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
47
6534
feb579677b58 SnippetTemplate must not depend on CodeCacheProvider (only on MetaAccessProvider). This means that the hasSideEffect flag of a RuntimeCall must be already fixed in the RuntimeCall.Descriptor to avoid a lookup of the actual RuntimeCall using the CodeCacheProvider.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6521
diff changeset
48 public boolean hasSideEffect() {
5375
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
49 return false;
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
50 }
3035b6b881d9 removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents: 5362
diff changeset
51
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
52 public BeginNode() {
5443
141817e206d4 changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5375
diff changeset
53 super(StampFactory.dependency());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56 public static BeginNode begin(FixedNode with) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
57 if (with instanceof BeginNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58 return (BeginNode) with;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
59 }
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6577
diff changeset
60 BeginNode begin = with.graph().add(new BeginNode());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
61 begin.setNext(with);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62 return begin;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
63 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
64
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
65 @Override
4310
72d099e5be61 more CanonicalizerPhase simplifications, added Simplifiable interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 4309
diff changeset
66 public void simplify(SimplifierTool tool) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
67 FixedNode prev = (FixedNode) this.predecessor();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
68 if (prev == null) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
69 // This is the start node.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
70 } else if (prev instanceof ControlSplitNode) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
71 // This begin node is necessary.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
72 } else {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
73 // This begin node can be removed and all guards moved up to the preceding begin node.
5215
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
74 prepareDelete();
5831
ed08c40d67de Add a alwaysNull property to ObjectStamp (Phi(null, a! A) get a "a A" stamp and not just "a -")
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5814
diff changeset
75 tool.addToWorkList(next());
4599
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
76 ((StructuredGraph) graph()).removeFixed(this);
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
77 }
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
78 }
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
79
5215
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
80 public static BeginNode prevBegin(FixedNode from) {
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
81 Node prevBegin = from;
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
82 while (prevBegin != null) {
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
83 if (prevBegin instanceof BeginNode) {
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
84 return (BeginNode) prevBegin;
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
85 }
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
86 prevBegin = prevBegin.predecessor();
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
87 }
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
88 return null;
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
89 }
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
90
6573
4eba1a717254 extended IfNode simplification to try and connect code that initializes a variable directly with the successors of an if construct that switches on the variable
Doug Simon <doug.simon@oracle.com>
parents: 6534
diff changeset
91 private void evacuateGuards(FixedNode evacuateFrom) {
4599
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
92 if (!usages().isEmpty()) {
5215
ae367987a18c Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5214
diff changeset
93 BeginNode prevBegin = prevBegin(evacuateFrom);
4599
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
94 assert prevBegin != null;
5206
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
95 for (Node anchored : anchored().snapshot()) {
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
96 anchored.replaceFirstInput(this, prevBegin);
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
97 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
98 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
99 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
100
5206
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
101 public void prepareDelete() {
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
102 prepareDelete((FixedNode) predecessor());
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
103 }
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
104
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
105 public void prepareDelete(FixedNode evacuateFrom) {
5210
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
106 removeProxies();
5206
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
107 evacuateGuards(evacuateFrom);
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
108 }
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
109
5210
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
110 public void removeProxies() {
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
111 for (ValueProxyNode vpn : proxies().snapshot()) {
6318
8886fdfde36c Factor out code that kills loop exits
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5831
diff changeset
112 // can not use graph.replaceFloating because vpn.value may be null during killCFG
8886fdfde36c Factor out code that kills loop exits
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5831
diff changeset
113 vpn.replaceAtUsages(vpn.value());
8886fdfde36c Factor out code that kills loop exits
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5831
diff changeset
114 vpn.safeDelete();
5210
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
115 }
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
116 }
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
117
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
118 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
119 public boolean verify() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
120 assertTrue(predecessor() != null || this == ((StructuredGraph) graph()).start() || this instanceof MergeNode, "begin nodes must be connected");
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
121 return super.verify();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
122 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
123
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
124 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
125 public void generate(LIRGeneratorTool gen) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
126 // nop
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
127 }
4599
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
128
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
129 public NodeIterable<GuardNode> guards() {
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
130 return usages().filter(GuardNode.class);
97d11635f2bf evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents: 4310
diff changeset
131 }
5206
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
132
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
133 public NodeIterable<Node> anchored() {
5210
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
134 return usages().filter(isNotA(ValueProxyNode.class));
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
135 }
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
136
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
137 public NodeIterable<ValueProxyNode> proxies() {
e3e7542d78b7 Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5206
diff changeset
138 return usages().filter(ValueProxyNode.class);
5206
dfe925845cad Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5061
diff changeset
139 }
5214
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
140
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
141 public NodeIterable<FixedNode> getBlockNodes() {
5608
3bc48971a1bf Make NodeIterable an interface and create AbstractNodeIterable,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5443
diff changeset
142 return new AbstractNodeIterable<FixedNode>() {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6577
diff changeset
143
5214
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
144 @Override
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
145 public Iterator<FixedNode> iterator() {
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
146 return new BlockNodeIterator(BeginNode.this);
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
147 }
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
148 };
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
149 }
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
150
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
151 private class BlockNodeIterator implements Iterator<FixedNode> {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 6577
diff changeset
152
5214
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
153 private FixedNode current;
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
154
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
155 public BlockNodeIterator(FixedNode next) {
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
156 this.current = next;
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
157 }
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
158
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
159 @Override
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
160 public boolean hasNext() {
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
161 return current != null;
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
162 }
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
163
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
164 @Override
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
165 public FixedNode next() {
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
166 FixedNode ret = current;
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
167 if (ret == null) {
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
168 throw new NoSuchElementException();
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
169 }
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
170 if (!(current instanceof FixedWithNextNode) || (current instanceof BeginNode && current != BeginNode.this)) {
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
171 current = null;
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
172 } else {
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
173 current = ((FixedWithNextNode) current).next();
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
174 }
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
175 return ret;
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
176 }
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
177
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
178 @Override
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
179 public void remove() {
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
180 throw new UnsupportedOperationException();
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
181 }
1020e363a05d Loop peeling
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5210
diff changeset
182 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
183 }