Mercurial > hg > truffle
annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ConstantLocationNode.java @ 16237:0e5e4628fca7
let AddLocationNode implement Canonicalizable.Binary
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Thu, 26 Jun 2014 09:53:59 +0200 |
parents | e4d6c613d552 |
children | 843e8efacd13 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
3733
diff
changeset
|
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
3733
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.extended; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5504
diff
changeset
|
25 import com.oracle.graal.api.meta.*; |
15261
882f4cb7cfcf
Move Stamps to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15132
diff
changeset
|
26 import com.oracle.graal.compiler.common.type.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
27 import com.oracle.graal.graph.*; |
15298
e4d6c613d552
Move LIRGeneratorTool to graal.lir (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
28 import com.oracle.graal.lir.gen.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
29 import com.oracle.graal.nodes.spi.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 |
5465 | 31 /** |
9203
f78437ffb8d3
Restructure class hierarchy of LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
8892
diff
changeset
|
32 * Location node that has a constant displacement. Can represent addresses of the form [base + disp] |
f78437ffb8d3
Restructure class hierarchy of LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
8892
diff
changeset
|
33 * where base is a node and disp is a constant. |
5465 | 34 */ |
5814
d241f8b2e6f9
Adapt the coloring filter for binary dumped graphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5540
diff
changeset
|
35 @NodeInfo(nameTemplate = "Loc {p#locationIdentity/s}") |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9298
diff
changeset
|
36 public final class ConstantLocationNode extends LocationNode { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
37 |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9298
diff
changeset
|
38 private final Kind valueKind; |
9526
ae5cd887e67c
Use a LocationIdentity interface instead of just Object for the location identity of a LocationNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9525
diff
changeset
|
39 private final LocationIdentity locationIdentity; |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9298
diff
changeset
|
40 private final long displacement; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
41 |
9526
ae5cd887e67c
Use a LocationIdentity interface instead of just Object for the location identity of a LocationNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9525
diff
changeset
|
42 public static ConstantLocationNode create(LocationIdentity identity, Kind kind, long displacement, Graph graph) { |
9203
f78437ffb8d3
Restructure class hierarchy of LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
8892
diff
changeset
|
43 return graph.unique(new ConstantLocationNode(identity, kind, displacement)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
44 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 |
16237
0e5e4628fca7
let AddLocationNode implement Canonicalizable.Binary
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15298
diff
changeset
|
46 public static ConstantLocationNode create(LocationIdentity identity, Kind kind, long displacement) { |
0e5e4628fca7
let AddLocationNode implement Canonicalizable.Binary
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15298
diff
changeset
|
47 return new ConstantLocationNode(identity, kind, displacement); |
0e5e4628fca7
let AddLocationNode implement Canonicalizable.Binary
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15298
diff
changeset
|
48 } |
0e5e4628fca7
let AddLocationNode implement Canonicalizable.Binary
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15298
diff
changeset
|
49 |
9526
ae5cd887e67c
Use a LocationIdentity interface instead of just Object for the location identity of a LocationNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9525
diff
changeset
|
50 private ConstantLocationNode(LocationIdentity identity, Kind kind, long displacement) { |
15006
e60ea0bf468d
remove StampFactory.dependency/extension/condition
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14950
diff
changeset
|
51 super(StampFactory.forVoid()); |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9298
diff
changeset
|
52 assert kind != Kind.Illegal && kind != Kind.Void; |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9298
diff
changeset
|
53 this.valueKind = kind; |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9298
diff
changeset
|
54 this.locationIdentity = identity; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 this.displacement = displacement; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 @Override |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9298
diff
changeset
|
59 public Kind getValueKind() { |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9298
diff
changeset
|
60 return valueKind; |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9298
diff
changeset
|
61 } |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9298
diff
changeset
|
62 |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9298
diff
changeset
|
63 @Override |
9526
ae5cd887e67c
Use a LocationIdentity interface instead of just Object for the location identity of a LocationNode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9525
diff
changeset
|
64 public LocationIdentity getLocationIdentity() { |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9298
diff
changeset
|
65 return locationIdentity; |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9298
diff
changeset
|
66 } |
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9298
diff
changeset
|
67 |
9525
038fa65cbd8d
Consistent naming of accessor methods in the LocationNode class hierarchy
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9524
diff
changeset
|
68 public long getDisplacement() { |
9524
ff8d87eabda8
Refactor the LocationNode class hierarchy to allow a SnippetLocationNode, i.e., a LocationNode that can be used in snippets without requiring the individual components to be constants at the time the snippet is prepared
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9298
diff
changeset
|
69 return displacement; |
9205 | 70 } |
71 | |
72 @Override | |
15130
ec22234bde0d
Pass more restricted interfaces to ArithmeticLIRLowerable and LocationNode in LIR generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
14950
diff
changeset
|
73 public Value generateAddress(NodeMappableLIRBuilder builder, LIRGeneratorTool gen, Value base) { |
ec22234bde0d
Pass more restricted interfaces to ArithmeticLIRLowerable and LocationNode in LIR generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
14950
diff
changeset
|
74 return gen.emitAddress(base, getDisplacement(), Value.ILLEGAL, 0); |
7861
c6d003891de0
Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7827
diff
changeset
|
75 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
76 } |