annotate graal/com.oracle.graal.word/src/com/oracle/graal/word/nodes/SnippetLocationNode.java @ 16895:06c15e88d383

added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
author Doug Simon <doug.simon@oracle.com>
date Mon, 18 Aug 2014 14:04:21 +0200
parents cbd42807a31f
children f90dcdbbb75e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 */
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15001
diff changeset
23 package com.oracle.graal.word.nodes;
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
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.*;
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15001
diff changeset
28 import com.oracle.graal.api.replacements.*;
15193
96bb07a5d667 Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents: 15132
diff changeset
29 import com.oracle.graal.compiler.common.*;
15261
882f4cb7cfcf Move Stamps to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
30 import com.oracle.graal.compiler.common.type.*;
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
31 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
32 import com.oracle.graal.graph.spi.*;
15298
e4d6c613d552 Move LIRGeneratorTool to graal.lir (errors).
Josef Eisl <josef.eisl@jku.at>
parents: 15261
diff changeset
33 import com.oracle.graal.lir.gen.*;
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: 16837
diff changeset
34 import com.oracle.graal.nodeinfo.*;
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
35 import com.oracle.graal.nodes.*;
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15001
diff changeset
36 import com.oracle.graal.nodes.extended.*;
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
37 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
38
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 /**
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 * 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
41 * 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
42 * 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
43 * 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
44 * 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
45 */
16811
5d468add216f added @NodeInfo annotations to all Node classes
Doug Simon <doug.simon@oracle.com>
parents: 16444
diff changeset
46 @NodeInfo
5d468add216f added @NodeInfo annotations to all Node classes
Doug Simon <doug.simon@oracle.com>
parents: 16444
diff changeset
47 public class SnippetLocationNode extends LocationNode implements Canonicalizable {
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
48
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15001
diff changeset
49 private final SnippetReflectionProvider snippetReflection;
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15001
diff changeset
50
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
51 @Input private ValueNode valueKind;
15001
27c04ee36dcb input types
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14950
diff changeset
52 @Input(InputType.Association) private ValueNode 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:
diff changeset
53 @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
54 @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
55 @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
56
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15001
diff changeset
57 public static SnippetLocationNode create(SnippetReflectionProvider snippetReflection, ValueNode identity, ValueNode kind, ValueNode displacement, ValueNode index, ValueNode indexScaling,
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15001
diff changeset
58 Graph graph) {
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
59 return graph.unique(SnippetLocationNode.create(snippetReflection, identity, kind, displacement, index, indexScaling));
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
60 }
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
61
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
62 public static SnippetLocationNode create(SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement) {
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
63 return new SnippetLocationNodeGen(snippetReflection, locationIdentity, kind, displacement);
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
64 }
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
65
16837
a4ab20ebeed5 fixed Node classes that were final, private or had private constructors
Doug Simon <doug.simon@oracle.com>
parents: 16811
diff changeset
66 SnippetLocationNode(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement) {
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15001
diff changeset
67 this(snippetReflection, locationIdentity, kind, displacement, null, null);
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
68 }
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
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
70 public static SnippetLocationNode create(SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement, ValueNode index, ValueNode indexScaling) {
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
71 return new SnippetLocationNodeGen(snippetReflection, locationIdentity, kind, displacement, index, indexScaling);
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
72 }
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
73
16837
a4ab20ebeed5 fixed Node classes that were final, private or had private constructors
Doug Simon <doug.simon@oracle.com>
parents: 16811
diff changeset
74 SnippetLocationNode(@InjectedNodeParameter SnippetReflectionProvider snippetReflection, ValueNode locationIdentity, ValueNode kind, ValueNode displacement, ValueNode index, ValueNode 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
75 super(StampFactory.object());
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15001
diff changeset
76 this.snippetReflection = snippetReflection;
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
77 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
78 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
79 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
80 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
81 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
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
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
84 @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
85 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
86 if (valueKind.isConstant()) {
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15001
diff changeset
87 return (Kind) snippetReflection.asObject(valueKind.asConstant());
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 }
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 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
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
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 @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
93 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
94 if (locationIdentity.isConstant()) {
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15001
diff changeset
95 return (LocationIdentity) snippetReflection.asObject(locationIdentity.asConstant());
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
96 }
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 // 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
98 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
99 }
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 @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
102 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
103 if (valueKind.isConstant() && locationIdentity.isConstant() && displacement.isConstant() && (indexScaling == null || indexScaling.isConstant())) {
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15001
diff changeset
104 Kind constKind = (Kind) snippetReflection.asObject(valueKind.asConstant());
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 15001
diff changeset
105 LocationIdentity constLocation = (LocationIdentity) snippetReflection.asObject(locationIdentity.asConstant());
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
106 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
107 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
108
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 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
110 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
111 } 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
112 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
113 } 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
114 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
115 }
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
116 }
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
117 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
118 }
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
119
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
120 @Override
15130
ec22234bde0d Pass more restricted interfaces to ArithmeticLIRLowerable and LocationNode in LIR generation.
Roland Schatz <roland.schatz@oracle.com>
parents: 14950
diff changeset
121 public Value generateAddress(NodeMappableLIRBuilder builder, LIRGeneratorTool gen, Value base) {
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
122 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
123 }
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
124
16444
843e8efacd13 getDisplacementStamp on LocationNodes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15298
diff changeset
125 @Override
843e8efacd13 getDisplacementStamp on LocationNodes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15298
diff changeset
126 public IntegerStamp getDisplacementStamp() {
843e8efacd13 getDisplacementStamp on LocationNodes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15298
diff changeset
127 throw GraalInternalError.shouldNotReachHere();
843e8efacd13 getDisplacementStamp on LocationNodes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15298
diff changeset
128 }
843e8efacd13 getDisplacementStamp on LocationNodes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15298
diff changeset
129
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
130 @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
131 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
132
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
133 @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
134 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
135 }