Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SnippetLocationNode.java @ 11881:da9db8331658
moved Canonicalizable and Simplifiable to the com.oracle.graal.graph project (GRAAL-506)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 01 Oct 2013 20:38:25 +0200 |
parents | 9a747d8e0d0f |
children | 1cf373d2b415 |
rev | line source |
---|---|
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:
diff
changeset
|
1 /* |
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:
diff
changeset
|
2 * Copyright (c) 2013, 2013, Oracle and/or its affiliates. All rights reserved. |
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:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
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:
diff
changeset
|
4 * |
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:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
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:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
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:
diff
changeset
|
7 * published by the Free Software Foundation. |
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:
diff
changeset
|
8 * |
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:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
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:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
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:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
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:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
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:
diff
changeset
|
13 * accompanied this code). |
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:
diff
changeset
|
14 * |
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:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
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:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
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:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
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:
diff
changeset
|
18 * |
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:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
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:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
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:
diff
changeset
|
21 * questions. |
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:
diff
changeset
|
22 */ |
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:
diff
changeset
|
23 package com.oracle.graal.nodes.extended; |
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:
diff
changeset
|
24 |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
25 import static com.oracle.graal.api.meta.LocationIdentity.*; |
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
26 |
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:
diff
changeset
|
27 import com.oracle.graal.api.meta.*; |
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:
diff
changeset
|
28 import com.oracle.graal.graph.*; |
11881
da9db8331658
moved Canonicalizable and Simplifiable to the com.oracle.graal.graph project (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
11880
diff
changeset
|
29 import com.oracle.graal.graph.spi.*; |
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:
diff
changeset
|
30 import com.oracle.graal.nodes.*; |
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:
diff
changeset
|
31 import com.oracle.graal.nodes.spi.*; |
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:
diff
changeset
|
32 import com.oracle.graal.nodes.type.*; |
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:
diff
changeset
|
33 |
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:
diff
changeset
|
34 /** |
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:
diff
changeset
|
35 * Location node that can be used inside a snippet without having the elements (including the |
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:
diff
changeset
|
36 * location identity and kind) as a snippet constant. Can represent locations in the form of [base + |
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:
diff
changeset
|
37 * index * scale + disp]. When the location is created, all elements (base, index, scale, disp) are |
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:
diff
changeset
|
38 * nodes. Both scale and disp must eventually canonicalize to {@link ConstantNode constants} so that |
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:
diff
changeset
|
39 * this node can be canonicalized to a {@link IndexedLocationNode} or {@link ConstantLocationNode}. |
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:
diff
changeset
|
40 */ |
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:
diff
changeset
|
41 public final class SnippetLocationNode extends LocationNode implements Canonicalizable { |
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:
diff
changeset
|
42 |
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:
diff
changeset
|
43 @Input private ValueNode 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:
diff
changeset
|
44 @Input private ValueNode 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:
diff
changeset
|
45 @Input private ValueNode displacement; |
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:
diff
changeset
|
46 @Input private ValueNode index; |
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:
diff
changeset
|
47 @Input private ValueNode indexScaling; |
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:
diff
changeset
|
48 |
9601
278a50fb49c7
Create a LoadFieldNode for a getstatic of a static final field in the graph builder, and rely on the canonicalizer for replacing it with the constant value.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9545
diff
changeset
|
49 public static SnippetLocationNode create(ValueNode identity, ValueNode kind, ValueNode displacement, ValueNode index, ValueNode indexScaling, Graph graph) { |
278a50fb49c7
Create a LoadFieldNode for a getstatic of a static final field in the graph builder, and rely on the canonicalizer for replacing it with the constant value.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9545
diff
changeset
|
50 return graph.unique(new SnippetLocationNode(identity, kind, displacement, index, indexScaling)); |
278a50fb49c7
Create a LoadFieldNode for a getstatic of a static final field in the graph builder, and rely on the canonicalizer for replacing it with the constant value.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9545
diff
changeset
|
51 } |
278a50fb49c7
Create a LoadFieldNode for a getstatic of a static final field in the graph builder, and rely on the canonicalizer for replacing it with the constant value.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9545
diff
changeset
|
52 |
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:
diff
changeset
|
53 private SnippetLocationNode(ValueNode locationIdentity, ValueNode kind, ValueNode displacement) { |
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:
diff
changeset
|
54 this(locationIdentity, kind, displacement, null, null); |
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:
diff
changeset
|
55 } |
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:
diff
changeset
|
56 |
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:
diff
changeset
|
57 private SnippetLocationNode(ValueNode locationIdentity, ValueNode kind, ValueNode displacement, ValueNode index, ValueNode indexScaling) { |
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:
diff
changeset
|
58 super(StampFactory.object()); |
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:
diff
changeset
|
59 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:
diff
changeset
|
60 this.locationIdentity = 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:
diff
changeset
|
61 this.displacement = displacement; |
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:
diff
changeset
|
62 this.index = index; |
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:
diff
changeset
|
63 this.indexScaling = indexScaling; |
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:
diff
changeset
|
64 } |
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:
diff
changeset
|
65 |
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:
diff
changeset
|
66 @Override |
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:
diff
changeset
|
67 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:
diff
changeset
|
68 if (valueKind.isConstant()) { |
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:
diff
changeset
|
69 return (Kind) valueKind.asConstant().asObject(); |
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:
diff
changeset
|
70 } |
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:
diff
changeset
|
71 throw new GraalInternalError("Cannot access kind yet because it is not constant: " + 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:
diff
changeset
|
72 } |
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:
diff
changeset
|
73 |
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:
diff
changeset
|
74 @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
|
75 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:
diff
changeset
|
76 if (locationIdentity.isConstant()) { |
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
|
77 return (LocationIdentity) locationIdentity.asConstant().asObject(); |
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:
diff
changeset
|
78 } |
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:
diff
changeset
|
79 // We do not know our actual location identity yet, so be conservative. |
9793
b4f12c603be5
added support for the runtime to specify for each foreign call whether it is re-executable and what memory locations it kills
Doug Simon <doug.simon@oracle.com>
parents:
9792
diff
changeset
|
80 return ANY_LOCATION; |
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:
diff
changeset
|
81 } |
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:
diff
changeset
|
82 |
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:
diff
changeset
|
83 @Override |
11880
9a747d8e0d0f
broadened types in Canonicalizable interface so that it can be moved to the com.oracle.graal.graph project (GRAAL-506)
Doug Simon <doug.simon@oracle.com>
parents:
9793
diff
changeset
|
84 public Node canonical(CanonicalizerTool tool) { |
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:
diff
changeset
|
85 if (valueKind.isConstant() && locationIdentity.isConstant() && displacement.isConstant() && (indexScaling == null || indexScaling.isConstant())) { |
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:
diff
changeset
|
86 Kind constKind = (Kind) valueKind.asConstant().asObject(); |
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
|
87 LocationIdentity constLocation = (LocationIdentity) locationIdentity.asConstant().asObject(); |
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:
diff
changeset
|
88 long constDisplacement = displacement.asConstant().asLong(); |
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:
diff
changeset
|
89 int constIndexScaling = indexScaling == null ? 0 : indexScaling.asConstant().asInt(); |
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:
diff
changeset
|
90 |
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:
diff
changeset
|
91 if (index == null || constIndexScaling == 0) { |
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:
diff
changeset
|
92 return ConstantLocationNode.create(constLocation, constKind, constDisplacement, graph()); |
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:
diff
changeset
|
93 } else if (index.isConstant()) { |
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:
diff
changeset
|
94 return ConstantLocationNode.create(constLocation, constKind, index.asConstant().asLong() * constIndexScaling + constDisplacement, graph()); |
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:
diff
changeset
|
95 } else { |
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:
diff
changeset
|
96 return IndexedLocationNode.create(constLocation, constKind, constDisplacement, index, graph(), constIndexScaling); |
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:
diff
changeset
|
97 } |
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:
diff
changeset
|
98 } |
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:
diff
changeset
|
99 return this; |
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:
diff
changeset
|
100 } |
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:
diff
changeset
|
101 |
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:
diff
changeset
|
102 @Override |
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:
diff
changeset
|
103 public Value generateAddress(LIRGeneratorTool gen, Value base) { |
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:
diff
changeset
|
104 throw new GraalInternalError("locationIdentity must be a constant so that this node can be canonicalized: " + 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:
diff
changeset
|
105 } |
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:
diff
changeset
|
106 |
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:
diff
changeset
|
107 @NodeIntrinsic |
9545
7931508747f5
Fix parameters of node intrinsics to use more specific Location and LocationIdentity types.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9526
diff
changeset
|
108 public static native Location constantLocation(LocationIdentity identity, Kind kind, long displacement); |
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:
diff
changeset
|
109 |
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:
diff
changeset
|
110 @NodeIntrinsic |
9545
7931508747f5
Fix parameters of node intrinsics to use more specific Location and LocationIdentity types.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
9526
diff
changeset
|
111 public static native Location indexedLocation(LocationIdentity identity, Kind kind, long displacement, int index, int indexScaling); |
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:
diff
changeset
|
112 } |