Mercurial > hg > truffle
annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ProxyNode.java @ 18993:480bd3b1adcd
Rename BeginNode => AbstractBeginNode.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 28 Jan 2015 00:50:31 +0100 |
parents | f57d86eb036f |
children | 7e2c87dae93e |
rev | line source |
---|---|
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
1 /* |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
4 * |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
8 * |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
14 * |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
18 * |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
21 * questions. |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
22 */ |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
23 package com.oracle.graal.nodes; |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
24 |
15198
2c0cfbf454b5
Move LIRTypeTool and Stamp to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15145
diff
changeset
|
25 import com.oracle.graal.compiler.common.type.*; |
5657
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5631
diff
changeset
|
26 import com.oracle.graal.graph.*; |
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5631
diff
changeset
|
27 import com.oracle.graal.graph.Node.ValueNumberable; |
16841
cbd42807a31f
moved NodeInfo and friends into separate com.oracle.graal.nodeinfo project so that annotation processor can be applied to the base Node class
Doug Simon <doug.simon@oracle.com>
parents:
16822
diff
changeset
|
28 import com.oracle.graal.nodeinfo.*; |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
29 import com.oracle.graal.nodes.calc.*; |
11334
7f713aad89de
Allow ProxyNode as a GuardingNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
10765
diff
changeset
|
30 import com.oracle.graal.nodes.extended.*; |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
31 |
5377
9a5608ce6743
added javadoc to ValueProxyNode
Doug Simon <doug.simon@oracle.com>
parents:
5299
diff
changeset
|
32 /** |
14978
e302df8bf51c
separate subclasses for value and guard phis and proxies
Lukas Stadler <lukas.stadler@oracle.com>
parents:
13941
diff
changeset
|
33 * A proxy is inserted at loop exits for any value that is created inside the loop (i.e. was not |
e302df8bf51c
separate subclasses for value and guard phis and proxies
Lukas Stadler <lukas.stadler@oracle.com>
parents:
13941
diff
changeset
|
34 * live on entry to the loop) and is (potentially) used after the loop. |
5377
9a5608ce6743
added javadoc to ValueProxyNode
Doug Simon <doug.simon@oracle.com>
parents:
5299
diff
changeset
|
35 */ |
16822
5d468add216f
added @NodeInfo annotations to all Node classes
Doug Simon <doug.simon@oracle.com>
parents:
16459
diff
changeset
|
36 @NodeInfo |
15009
e49f62425090
introduce non-ValueNode Proxy interface
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15001
diff
changeset
|
37 public abstract class ProxyNode extends FloatingNode implements IterableNodeType, ValueNumberable { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7394
diff
changeset
|
38 |
18993
480bd3b1adcd
Rename BeginNode => AbstractBeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
39 @Input(InputType.Association) AbstractBeginNode proxyPoint; |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
40 |
18993
480bd3b1adcd
Rename BeginNode => AbstractBeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
41 public ProxyNode(Stamp stamp, AbstractBeginNode proxyPoint) { |
14978
e302df8bf51c
separate subclasses for value and guard phis and proxies
Lukas Stadler <lukas.stadler@oracle.com>
parents:
13941
diff
changeset
|
42 super(stamp); |
e302df8bf51c
separate subclasses for value and guard phis and proxies
Lukas Stadler <lukas.stadler@oracle.com>
parents:
13941
diff
changeset
|
43 assert proxyPoint != null; |
e302df8bf51c
separate subclasses for value and guard phis and proxies
Lukas Stadler <lukas.stadler@oracle.com>
parents:
13941
diff
changeset
|
44 this.proxyPoint = proxyPoint; |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
45 } |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
46 |
14978
e302df8bf51c
separate subclasses for value and guard phis and proxies
Lukas Stadler <lukas.stadler@oracle.com>
parents:
13941
diff
changeset
|
47 public abstract ValueNode value(); |
5631
f2d228de28d7
Make the value proxy node use the stamp of the proxied value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5377
diff
changeset
|
48 |
18993
480bd3b1adcd
Rename BeginNode => AbstractBeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
49 public AbstractBeginNode proxyPoint() { |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
50 return proxyPoint; |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
51 } |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
52 |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
53 @Override |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
54 public boolean verify() { |
14978
e302df8bf51c
separate subclasses for value and guard phis and proxies
Lukas Stadler <lukas.stadler@oracle.com>
parents:
13941
diff
changeset
|
55 assert value() != null; |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
56 assert proxyPoint != null; |
14978
e302df8bf51c
separate subclasses for value and guard phis and proxies
Lukas Stadler <lukas.stadler@oracle.com>
parents:
13941
diff
changeset
|
57 assert !(value() instanceof ProxyNode) || ((ProxyNode) value()).proxyPoint != proxyPoint; |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
58 return super.verify(); |
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
59 } |
6710
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
5659
diff
changeset
|
60 |
18993
480bd3b1adcd
Rename BeginNode => AbstractBeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
61 public static ValueProxyNode forValue(ValueNode value, AbstractBeginNode exit, StructuredGraph graph) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
16897
diff
changeset
|
62 return graph.unique(new ValueProxyNode(value, exit)); |
6710
6db6881c1270
add Virtualizable and VirtualizerTool, refactor PEA to use it
Lukas Stadler <lukas.stadler@jku.at>
parents:
5659
diff
changeset
|
63 } |
8551
0f6dd67470d9
location identity on PhiNodes and ProxyNodes
Lukas Stadler <lukas.stadler@jku.at>
parents:
7897
diff
changeset
|
64 |
18993
480bd3b1adcd
Rename BeginNode => AbstractBeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18845
diff
changeset
|
65 public static GuardProxyNode forGuard(GuardingNode value, AbstractBeginNode exit, StructuredGraph graph) { |
18845
f57d86eb036f
removed Node factory methods
Doug Simon <doug.simon@oracle.com>
parents:
16897
diff
changeset
|
66 return graph.unique(new GuardProxyNode(value, exit)); |
10762
c483912aaf70
add ValueProxy interface and infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
9436
diff
changeset
|
67 } |
5210
e3e7542d78b7
Loop-closed form GraphBuidling
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
diff
changeset
|
68 } |