Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/BeginNode.java @ 5608:3bc48971a1bf
Make NodeIterable an interface and create AbstractNodeIterable,
Make NodeList extend AbstractList to get a number of method implemeted
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Wed, 13 Jun 2012 14:17:37 +0200 |
parents | 141817e206d4 |
children | 3b8bc07f8d17 |
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 { |
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5362
diff
changeset
|
35 @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
|
36 |
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5362
diff
changeset
|
37 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
|
38 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
|
39 } |
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 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
|
42 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
|
43 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
|
44 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 } |
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 public boolean hasSideEffect() { |
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5362
diff
changeset
|
48 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
|
49 } |
3035b6b881d9
removed stateAfter field from FixedWithNextNode - now only StateSplit implementations have this field
Doug Simon <doug.simon@oracle.com>
parents:
5362
diff
changeset
|
50 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
51 public BeginNode() { |
5443
141817e206d4
changes to the dependencies and stamp system:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5375
diff
changeset
|
52 super(StampFactory.dependency()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
53 } |
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 public static BeginNode begin(FixedNode with) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 if (with instanceof BeginNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 return (BeginNode) with; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
59 BeginNode begin = with.graph().add(new BeginNode()); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 begin.setNext(with); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 return begin; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 } |
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 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
65 public Map<Object, Object> getDebugProperties() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
66 Map<Object, Object> debugProperties = super.getDebugProperties(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 debugProperties.put("shortName", "B"); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 return debugProperties; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
69 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
71 @Override |
4310
72d099e5be61
more CanonicalizerPhase simplifications, added Simplifiable interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
4309
diff
changeset
|
72 public void simplify(SimplifierTool tool) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
73 FixedNode prev = (FixedNode) this.predecessor(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
74 if (prev == null) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
75 // This is the start node. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
76 } else if (prev instanceof ControlSplitNode) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
77 // This begin node is necessary. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
78 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
79 // 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
|
80 prepareDelete(); |
4599
97d11635f2bf
evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents:
4310
diff
changeset
|
81 ((StructuredGraph) graph()).removeFixed(this); |
97d11635f2bf
evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents:
4310
diff
changeset
|
82 } |
97d11635f2bf
evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents:
4310
diff
changeset
|
83 } |
97d11635f2bf
evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents:
4310
diff
changeset
|
84 |
5215
ae367987a18c
Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5214
diff
changeset
|
85 public static BeginNode prevBegin(FixedNode from) { |
ae367987a18c
Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5214
diff
changeset
|
86 Node prevBegin = from; |
ae367987a18c
Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5214
diff
changeset
|
87 while (prevBegin != null) { |
ae367987a18c
Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5214
diff
changeset
|
88 if (prevBegin instanceof BeginNode) { |
ae367987a18c
Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5214
diff
changeset
|
89 return (BeginNode) prevBegin; |
ae367987a18c
Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5214
diff
changeset
|
90 } |
ae367987a18c
Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5214
diff
changeset
|
91 prevBegin = prevBegin.predecessor(); |
ae367987a18c
Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5214
diff
changeset
|
92 } |
ae367987a18c
Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5214
diff
changeset
|
93 return null; |
ae367987a18c
Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5214
diff
changeset
|
94 } |
ae367987a18c
Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5214
diff
changeset
|
95 |
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
|
96 public void evacuateGuards(FixedNode evacuateFrom) { |
4599
97d11635f2bf
evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents:
4310
diff
changeset
|
97 if (!usages().isEmpty()) { |
5215
ae367987a18c
Add options for OptLoopTransform and OptSafepointElimination
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5214
diff
changeset
|
98 BeginNode prevBegin = prevBegin(evacuateFrom); |
4599
97d11635f2bf
evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents:
4310
diff
changeset
|
99 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
|
100 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
|
101 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
|
102 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
103 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
104 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
105 |
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
|
106 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
|
107 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
|
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 |
dfe925845cad
Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5061
diff
changeset
|
110 public void prepareDelete(FixedNode evacuateFrom) { |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5206
diff
changeset
|
111 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
|
112 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
|
113 } |
dfe925845cad
Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5061
diff
changeset
|
114 |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5206
diff
changeset
|
115 public void removeProxies() { |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5206
diff
changeset
|
116 StructuredGraph graph = (StructuredGraph) graph(); |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5206
diff
changeset
|
117 for (ValueProxyNode vpn : proxies().snapshot()) { |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5206
diff
changeset
|
118 graph.replaceFloating(vpn, vpn.value()); |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5206
diff
changeset
|
119 } |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5206
diff
changeset
|
120 } |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5206
diff
changeset
|
121 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
122 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
123 public boolean verify() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
124 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
|
125 return super.verify(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
126 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
127 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
128 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
129 public void generate(LIRGeneratorTool gen) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
130 // nop |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
131 } |
4599
97d11635f2bf
evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents:
4310
diff
changeset
|
132 |
97d11635f2bf
evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents:
4310
diff
changeset
|
133 public NodeIterable<GuardNode> guards() { |
97d11635f2bf
evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents:
4310
diff
changeset
|
134 return usages().filter(GuardNode.class); |
97d11635f2bf
evacuate guards when deleting control splits
Lukas Stadler <lukas.stadler@jku.at>
parents:
4310
diff
changeset
|
135 } |
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
|
136 |
dfe925845cad
Improve exacuation of anchored values, use it to fix if and merge simplifications
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5061
diff
changeset
|
137 public NodeIterable<Node> anchored() { |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5206
diff
changeset
|
138 return usages().filter(isNotA(ValueProxyNode.class)); |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5206
diff
changeset
|
139 } |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5206
diff
changeset
|
140 |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5206
diff
changeset
|
141 public NodeIterable<ValueProxyNode> proxies() { |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5206
diff
changeset
|
142 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
|
143 } |
5214 | 144 |
145 public NodeIterable<FixedNode> getBlockNodes() { | |
5608
3bc48971a1bf
Make NodeIterable an interface and create AbstractNodeIterable,
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5443
diff
changeset
|
146 return new AbstractNodeIterable<FixedNode>() { |
5214 | 147 @Override |
148 public Iterator<FixedNode> iterator() { | |
149 return new BlockNodeIterator(BeginNode.this); | |
150 } | |
151 }; | |
152 } | |
153 | |
154 private class BlockNodeIterator implements Iterator<FixedNode> { | |
155 private FixedNode current; | |
156 | |
157 public BlockNodeIterator(FixedNode next) { | |
158 this.current = next; | |
159 } | |
160 | |
161 @Override | |
162 public boolean hasNext() { | |
163 return current != null; | |
164 } | |
165 | |
166 @Override | |
167 public FixedNode next() { | |
168 FixedNode ret = current; | |
169 if (ret == null) { | |
170 throw new NoSuchElementException(); | |
171 } | |
172 if (!(current instanceof FixedWithNextNode) || (current instanceof BeginNode && current != BeginNode.this)) { | |
173 current = null; | |
174 } else { | |
175 current = ((FixedWithNextNode) current).next(); | |
176 } | |
177 return ret; | |
178 } | |
179 | |
180 @Override | |
181 public void remove() { | |
182 throw new UnsupportedOperationException(); | |
183 } | |
184 } | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
185 } |