Mercurial > hg > truffle
annotate graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java @ 21783:a858c5f56d8a
Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Mon, 08 Jun 2015 18:47:58 +0200 |
parents | 3d15183f3c93 |
children |
rev | line source |
---|---|
14839 | 1 /* |
20926
35e1b66f2810
Rename Stamp.illegal() to Stamp.empty().
Roland Schatz <roland.schatz@oracle.com>
parents:
20898
diff
changeset
|
2 * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. |
14839 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
23 package com.oracle.graal.compiler.gen; | |
24 | |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
25 import com.oracle.jvmci.code.ValueUtil; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
26 import com.oracle.jvmci.code.StackSlot; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
27 import com.oracle.jvmci.code.CallingConvention; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
28 import com.oracle.jvmci.meta.Value; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
29 import com.oracle.jvmci.meta.Kind; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
30 import com.oracle.jvmci.meta.LIRKind; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
31 import com.oracle.jvmci.meta.AllocatableValue; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
32 import com.oracle.jvmci.meta.PlatformKind; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
33 import com.oracle.jvmci.meta.JavaConstant; |
21780
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21556
diff
changeset
|
34 |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21554
diff
changeset
|
35 import static com.oracle.jvmci.code.ValueUtil.*; |
21780
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21556
diff
changeset
|
36 import static com.oracle.jvmci.debug.JVMCIDebugConfig.*; |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
37 import static com.oracle.graal.compiler.common.GraalOptions.*; |
14839 | 38 import static com.oracle.graal.lir.LIR.*; |
39 | |
40 import java.util.*; | |
41 import java.util.Map.Entry; | |
42 | |
15200
97eed257999b
Move Condition to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15199
diff
changeset
|
43 import com.oracle.graal.compiler.common.calc.*; |
15192
644dfe49c0f4
Move packages com.oracle.graal.cfg to com.oracle.graal.compiler.common.cfg.
Josef Eisl <josef.eisl@jku.at>
parents:
15157
diff
changeset
|
44 import com.oracle.graal.compiler.common.cfg.*; |
15261
882f4cb7cfcf
Move Stamps to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15259
diff
changeset
|
45 import com.oracle.graal.compiler.common.type.*; |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
46 import com.oracle.graal.compiler.match.*; |
14839 | 47 import com.oracle.graal.graph.*; |
48 import com.oracle.graal.lir.*; | |
49 import com.oracle.graal.lir.StandardOp.JumpOp; | |
21216 | 50 import com.oracle.graal.lir.StandardOp.LabelOp; |
19164
b215b88e215f
Introduce LIRGenerationDebugContext.
Josef Eisl <josef.eisl@jku.at>
parents:
18995
diff
changeset
|
51 import com.oracle.graal.lir.debug.*; |
15297
3a6151ed5a25
Move LIRGenerator to graal.lir (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15296
diff
changeset
|
52 import com.oracle.graal.lir.gen.*; |
15336
c260582ba074
Remove obsolete LIRGenResLowerable interface.
Josef Eisl <josef.eisl@jku.at>
parents:
15335
diff
changeset
|
53 import com.oracle.graal.lir.gen.LIRGenerator.Options; |
21183
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
54 import com.oracle.graal.lir.gen.LIRGeneratorTool.BlockScope; |
14839 | 55 import com.oracle.graal.nodes.*; |
56 import com.oracle.graal.nodes.calc.*; | |
57 import com.oracle.graal.nodes.cfg.*; | |
58 import com.oracle.graal.nodes.extended.*; | |
21418
cba35d171cd1
Move memory related nodes to their own package.
Roland Schatz <roland.schatz@oracle.com>
parents:
21308
diff
changeset
|
59 import com.oracle.graal.nodes.memory.*; |
14839 | 60 import com.oracle.graal.nodes.spi.*; |
61 import com.oracle.graal.nodes.virtual.*; | |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21445
diff
changeset
|
62 import com.oracle.jvmci.common.*; |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
63 import com.oracle.jvmci.debug.*; |
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21543
diff
changeset
|
64 import com.oracle.jvmci.debug.Debug.Scope; |
14839 | 65 |
66 /** | |
67 * This class traverses the HIR instructions and generates LIR instructions from them. | |
68 */ | |
15547
cab432461b8b
use NodeClass.Position when matching graphs, rearrange MatchableNode annotations, improve error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15521
diff
changeset
|
69 @MatchableNode(nodeClass = ConstantNode.class, shareable = true) |
16156
0993768dfc8e
new UnaryNode base class
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16094
diff
changeset
|
70 @MatchableNode(nodeClass = FloatConvertNode.class, inputs = {"value"}) |
21783
a858c5f56d8a
Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21780
diff
changeset
|
71 @MatchableNode(nodeClass = FloatingReadNode.class, inputs = {"address"}) |
15547
cab432461b8b
use NodeClass.Position when matching graphs, rearrange MatchableNode annotations, improve error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15521
diff
changeset
|
72 @MatchableNode(nodeClass = IfNode.class, inputs = {"condition"}) |
17197
ec35bb4eccb8
Add support for other data types to integer arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
17177
diff
changeset
|
73 @MatchableNode(nodeClass = SubNode.class, inputs = {"x", "y"}) |
15547
cab432461b8b
use NodeClass.Position when matching graphs, rearrange MatchableNode annotations, improve error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15521
diff
changeset
|
74 @MatchableNode(nodeClass = LeftShiftNode.class, inputs = {"x", "y"}) |
16156
0993768dfc8e
new UnaryNode base class
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16094
diff
changeset
|
75 @MatchableNode(nodeClass = NarrowNode.class, inputs = {"value"}) |
21783
a858c5f56d8a
Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21780
diff
changeset
|
76 @MatchableNode(nodeClass = ReadNode.class, inputs = {"address"}) |
15547
cab432461b8b
use NodeClass.Position when matching graphs, rearrange MatchableNode annotations, improve error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15521
diff
changeset
|
77 @MatchableNode(nodeClass = ReinterpretNode.class, inputs = {"value"}) |
16156
0993768dfc8e
new UnaryNode base class
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16094
diff
changeset
|
78 @MatchableNode(nodeClass = SignExtendNode.class, inputs = {"value"}) |
15547
cab432461b8b
use NodeClass.Position when matching graphs, rearrange MatchableNode annotations, improve error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15521
diff
changeset
|
79 @MatchableNode(nodeClass = UnsignedRightShiftNode.class, inputs = {"x", "y"}) |
21783
a858c5f56d8a
Introduce AddressNode to represent pointer arithmetic, remove LocationNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
21780
diff
changeset
|
80 @MatchableNode(nodeClass = WriteNode.class, inputs = {"address", "value"}) |
16156
0993768dfc8e
new UnaryNode base class
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16094
diff
changeset
|
81 @MatchableNode(nodeClass = ZeroExtendNode.class, inputs = {"value"}) |
15547
cab432461b8b
use NodeClass.Position when matching graphs, rearrange MatchableNode annotations, improve error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15521
diff
changeset
|
82 @MatchableNode(nodeClass = AndNode.class, inputs = {"x", "y"}, commutative = true) |
cab432461b8b
use NodeClass.Position when matching graphs, rearrange MatchableNode annotations, improve error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15521
diff
changeset
|
83 @MatchableNode(nodeClass = FloatEqualsNode.class, inputs = {"x", "y"}, commutative = true) |
cab432461b8b
use NodeClass.Position when matching graphs, rearrange MatchableNode annotations, improve error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15521
diff
changeset
|
84 @MatchableNode(nodeClass = FloatLessThanNode.class, inputs = {"x", "y"}, commutative = true) |
17197
ec35bb4eccb8
Add support for other data types to integer arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
17177
diff
changeset
|
85 @MatchableNode(nodeClass = AddNode.class, inputs = {"x", "y"}, commutative = true) |
16601
cd25e42d9b22
rename IntegerBelowThanNode to IntegerBelowNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16573
diff
changeset
|
86 @MatchableNode(nodeClass = IntegerBelowNode.class, inputs = {"x", "y"}, commutative = true) |
15547
cab432461b8b
use NodeClass.Position when matching graphs, rearrange MatchableNode annotations, improve error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15521
diff
changeset
|
87 @MatchableNode(nodeClass = IntegerEqualsNode.class, inputs = {"x", "y"}, commutative = true) |
cab432461b8b
use NodeClass.Position when matching graphs, rearrange MatchableNode annotations, improve error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15521
diff
changeset
|
88 @MatchableNode(nodeClass = IntegerLessThanNode.class, inputs = {"x", "y"}, commutative = true) |
17197
ec35bb4eccb8
Add support for other data types to integer arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
17177
diff
changeset
|
89 @MatchableNode(nodeClass = MulNode.class, inputs = {"x", "y"}, commutative = true) |
15547
cab432461b8b
use NodeClass.Position when matching graphs, rearrange MatchableNode annotations, improve error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15521
diff
changeset
|
90 @MatchableNode(nodeClass = IntegerTestNode.class, inputs = {"x", "y"}, commutative = true) |
cab432461b8b
use NodeClass.Position when matching graphs, rearrange MatchableNode annotations, improve error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15521
diff
changeset
|
91 @MatchableNode(nodeClass = ObjectEqualsNode.class, inputs = {"x", "y"}, commutative = true) |
cab432461b8b
use NodeClass.Position when matching graphs, rearrange MatchableNode annotations, improve error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15521
diff
changeset
|
92 @MatchableNode(nodeClass = OrNode.class, inputs = {"x", "y"}, commutative = true) |
cab432461b8b
use NodeClass.Position when matching graphs, rearrange MatchableNode annotations, improve error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15521
diff
changeset
|
93 @MatchableNode(nodeClass = XorNode.class, inputs = {"x", "y"}, commutative = true) |
cab432461b8b
use NodeClass.Position when matching graphs, rearrange MatchableNode annotations, improve error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15521
diff
changeset
|
94 @MatchableNode(nodeClass = PiNode.class, inputs = {"object"}) |
19164
b215b88e215f
Introduce LIRGenerationDebugContext.
Josef Eisl <josef.eisl@jku.at>
parents:
18995
diff
changeset
|
95 public abstract class NodeLIRBuilder implements NodeLIRBuilderTool, LIRGenerationDebugContext { |
14839 | 96 |
97 private final NodeMap<Value> nodeOperands; | |
98 private final DebugInfoBuilder debugInfoBuilder; | |
99 | |
15331
71cdf5518dab
Use LIRGeneratorTool in NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
15330
diff
changeset
|
100 protected final LIRGeneratorTool gen; |
14839 | 101 |
102 private ValueNode currentInstruction; | |
103 private ValueNode lastInstructionPrinted; // Debugging only | |
104 | |
19824
6b73ce815fc2
Add a new algorithm for latest possible schedule. Fix earliest possible schedule for the case of floating reads. Add scheduling test cases.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
105 private Map<Class<? extends Node>, List<MatchStatement>> matchRules; |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
106 |
15333
06ecedffb109
Use LIRGeneratorTool in Backend.
Josef Eisl <josef.eisl@jku.at>
parents:
15331
diff
changeset
|
107 public NodeLIRBuilder(StructuredGraph graph, LIRGeneratorTool gen) { |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14920
diff
changeset
|
108 this.gen = gen; |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14839
diff
changeset
|
109 this.nodeOperands = graph.createNodeMap(); |
15838
15771ff797b4
Pass the compiled method to LIR factory
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15547
diff
changeset
|
110 this.debugInfoBuilder = createDebugInfoBuilder(graph, nodeOperands); |
15521
76213c9350ad
improve annotation error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
111 if (MatchExpressions.getValue()) { |
76213c9350ad
improve annotation error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
112 matchRules = MatchRuleRegistry.lookup(getClass()); |
76213c9350ad
improve annotation error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
113 } |
14839 | 114 } |
115 | |
15838
15771ff797b4
Pass the compiled method to LIR factory
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15547
diff
changeset
|
116 @SuppressWarnings({"unused", "hiding"}) |
15771ff797b4
Pass the compiled method to LIR factory
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15547
diff
changeset
|
117 protected DebugInfoBuilder createDebugInfoBuilder(StructuredGraph graph, NodeMap<Value> nodeOperands) { |
14839 | 118 return new DebugInfoBuilder(nodeOperands); |
119 } | |
120 | |
121 /** | |
122 * Returns the operand that has been previously initialized by | |
14850 | 123 * {@link #setResult(ValueNode, Value)} with the result of an instruction. It's a code |
124 * generation error to ask for the operand of ValueNode that doesn't have one yet. | |
125 * | |
14839 | 126 * @param node A node that produces a result value. |
127 */ | |
128 @Override | |
19824
6b73ce815fc2
Add a new algorithm for latest possible schedule. Fix earliest possible schedule for the case of floating reads. Add scheduling test cases.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
129 public Value operand(Node node) { |
14850 | 130 Value operand = getOperand(node); |
131 assert operand != null : String.format("missing operand for %1s", node); | |
132 return operand; | |
133 } | |
134 | |
135 @Override | |
19824
6b73ce815fc2
Add a new algorithm for latest possible schedule. Fix earliest possible schedule for the case of floating reads. Add scheduling test cases.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
136 public boolean hasOperand(Node node) { |
14850 | 137 return getOperand(node) != null; |
138 } | |
139 | |
19824
6b73ce815fc2
Add a new algorithm for latest possible schedule. Fix earliest possible schedule for the case of floating reads. Add scheduling test cases.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
140 private Value getOperand(Node node) { |
14839 | 141 if (nodeOperands == null) { |
142 return null; | |
143 } | |
16073
b38191cd1665
removed code to make recording usages optional for ConstantNodes (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
16012
diff
changeset
|
144 return nodeOperands.get(node); |
14839 | 145 } |
146 | |
147 public ValueNode valueForOperand(Value value) { | |
148 for (Entry<Node, Value> entry : getNodeOperands().entries()) { | |
149 if (entry.getValue().equals(value)) { | |
150 return (ValueNode) entry.getKey(); | |
151 } | |
152 } | |
153 return null; | |
154 } | |
155 | |
156 @Override | |
19164
b215b88e215f
Introduce LIRGenerationDebugContext.
Josef Eisl <josef.eisl@jku.at>
parents:
18995
diff
changeset
|
157 public Object getSourceForOperand(Value value) { |
b215b88e215f
Introduce LIRGenerationDebugContext.
Josef Eisl <josef.eisl@jku.at>
parents:
18995
diff
changeset
|
158 return valueForOperand(value); |
b215b88e215f
Introduce LIRGenerationDebugContext.
Josef Eisl <josef.eisl@jku.at>
parents:
18995
diff
changeset
|
159 } |
b215b88e215f
Introduce LIRGenerationDebugContext.
Josef Eisl <josef.eisl@jku.at>
parents:
18995
diff
changeset
|
160 |
b215b88e215f
Introduce LIRGenerationDebugContext.
Josef Eisl <josef.eisl@jku.at>
parents:
18995
diff
changeset
|
161 @Override |
14839 | 162 public Value setResult(ValueNode x, Value operand) { |
163 assert (!isRegister(operand) || !gen.attributes(asRegister(operand)).isAllocatable()); | |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
164 assert nodeOperands != null && (nodeOperands.get(x) == null || nodeOperands.get(x) instanceof ComplexMatchValue) : "operand cannot be set twice"; |
14839 | 165 assert operand != null && isLegal(operand) : "operand must be legal"; |
166 assert !(x instanceof VirtualObjectNode); | |
167 nodeOperands.set(x, operand); | |
168 return operand; | |
169 } | |
170 | |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
171 /** |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
172 * Used by the {@link MatchStatement} machinery to override the generation LIR for some |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
173 * ValueNodes. |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
174 */ |
19824
6b73ce815fc2
Add a new algorithm for latest possible schedule. Fix earliest possible schedule for the case of floating reads. Add scheduling test cases.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
175 public void setMatchResult(Node x, Value operand) { |
15453
100306ae985b
switch MatchRule from class to method annotation and fix review feedback
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15413
diff
changeset
|
176 assert operand.equals(ComplexMatchValue.INTERIOR_MATCH) || operand instanceof ComplexMatchValue; |
18969
14496953435e
Use Node#getUsageCount wherever possible.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18941
diff
changeset
|
177 assert operand instanceof ComplexMatchValue || x.getUsageCount() == 1 : "interior matches must be single user"; |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
178 assert nodeOperands != null && nodeOperands.get(x) == null : "operand cannot be set twice"; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
179 assert !(x instanceof VirtualObjectNode); |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
180 nodeOperands.set(x, operand); |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
181 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
182 |
14839 | 183 public LabelRef getLIRBlock(FixedNode b) { |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14920
diff
changeset
|
184 assert gen.getResult().getLIR().getControlFlowGraph() instanceof ControlFlowGraph; |
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14920
diff
changeset
|
185 Block result = ((ControlFlowGraph) gen.getResult().getLIR().getControlFlowGraph()).blockFor(b); |
14843
dd75a505f1b6
Remove currentBlock from NodeLIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14842
diff
changeset
|
186 int suxIndex = gen.getCurrentBlock().getSuccessors().indexOf(result); |
14839 | 187 assert suxIndex != -1 : "Block not in successor list of current block"; |
188 | |
14843
dd75a505f1b6
Remove currentBlock from NodeLIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14842
diff
changeset
|
189 assert gen.getCurrentBlock() instanceof Block; |
14946
31ded66cd2cb
Use AbstractBlock in LabelRef.
Josef Eisl <josef.eisl@jku.at>
parents:
14945
diff
changeset
|
190 return LabelRef.forSuccessor(gen.getResult().getLIR(), gen.getCurrentBlock(), suxIndex); |
14839 | 191 } |
192 | |
14850 | 193 public final void append(LIRInstruction op) { |
15330
cc0dde80d6df
Remove traceLevel and printIRWithLIR members from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
15297
diff
changeset
|
194 if (Options.PrintIRWithLIR.getValue() && !TTY.isSuppressed()) { |
14839 | 195 if (currentInstruction != null && lastInstructionPrinted != currentInstruction) { |
196 lastInstructionPrinted = currentInstruction; | |
197 InstructionPrinter ip = new InstructionPrinter(TTY.out()); | |
198 ip.printInstructionListing(currentInstruction); | |
199 } | |
200 } | |
14844
b9b1129a5d85
Fix NodeLIRGenerator.append() issue.
Josef Eisl <josef.eisl@jku.at>
parents:
14843
diff
changeset
|
201 gen.append(op); |
14839 | 202 } |
203 | |
21224
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
204 protected LIRKind getExactPhiKind(PhiNode phi) { |
21445
567fd5394b80
NodeLIRBuilder#getExactPhiKind: handle non-java constants.
Josef Eisl <josef.eisl@jku.at>
parents:
21443
diff
changeset
|
205 // TODO (je): maybe turn this into generator-style instead of allocating an ArrayList. |
567fd5394b80
NodeLIRBuilder#getExactPhiKind: handle non-java constants.
Josef Eisl <josef.eisl@jku.at>
parents:
21443
diff
changeset
|
206 ArrayList<LIRKind> values = new ArrayList<>(phi.valueCount()); |
21224
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
207 for (int i = 0; i < phi.valueCount(); i++) { |
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
208 ValueNode node = phi.valueAt(i); |
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
209 Value value = node instanceof ConstantNode ? ((ConstantNode) node).asJavaConstant() : getOperand(node); |
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
210 if (value != null) { |
21445
567fd5394b80
NodeLIRBuilder#getExactPhiKind: handle non-java constants.
Josef Eisl <josef.eisl@jku.at>
parents:
21443
diff
changeset
|
211 values.add(value.getLIRKind()); |
21224
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
212 } else { |
21445
567fd5394b80
NodeLIRBuilder#getExactPhiKind: handle non-java constants.
Josef Eisl <josef.eisl@jku.at>
parents:
21443
diff
changeset
|
213 assert node instanceof ConstantNode || isPhiInputFromBackedge(phi, i) : String.format("Input %s to phi node %s is not yet available although it is not coming from a loop back edge", |
567fd5394b80
NodeLIRBuilder#getExactPhiKind: handle non-java constants.
Josef Eisl <josef.eisl@jku.at>
parents:
21443
diff
changeset
|
214 node, phi); |
567fd5394b80
NodeLIRBuilder#getExactPhiKind: handle non-java constants.
Josef Eisl <josef.eisl@jku.at>
parents:
21443
diff
changeset
|
215 // non-java constant -> get Kind from stamp. |
567fd5394b80
NodeLIRBuilder#getExactPhiKind: handle non-java constants.
Josef Eisl <josef.eisl@jku.at>
parents:
21443
diff
changeset
|
216 values.add(getLIRGeneratorTool().getLIRKind(node.stamp())); |
21224
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
217 } |
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
218 } |
21445
567fd5394b80
NodeLIRBuilder#getExactPhiKind: handle non-java constants.
Josef Eisl <josef.eisl@jku.at>
parents:
21443
diff
changeset
|
219 LIRKind derivedKind = LIRKind.merge(values); |
21239
ad3a3c192be6
NodeLIRBuilder: relax verification of derived kinds for PHIs (aka look at stack kinds).
Josef Eisl <josef.eisl@jku.at>
parents:
21235
diff
changeset
|
220 assert verifyPHIKind(derivedKind, gen.getLIRKind(phi.stamp())); |
ad3a3c192be6
NodeLIRBuilder: relax verification of derived kinds for PHIs (aka look at stack kinds).
Josef Eisl <josef.eisl@jku.at>
parents:
21235
diff
changeset
|
221 return derivedKind; |
ad3a3c192be6
NodeLIRBuilder: relax verification of derived kinds for PHIs (aka look at stack kinds).
Josef Eisl <josef.eisl@jku.at>
parents:
21235
diff
changeset
|
222 } |
ad3a3c192be6
NodeLIRBuilder: relax verification of derived kinds for PHIs (aka look at stack kinds).
Josef Eisl <josef.eisl@jku.at>
parents:
21235
diff
changeset
|
223 |
ad3a3c192be6
NodeLIRBuilder: relax verification of derived kinds for PHIs (aka look at stack kinds).
Josef Eisl <josef.eisl@jku.at>
parents:
21235
diff
changeset
|
224 private static boolean verifyPHIKind(LIRKind derivedKind, LIRKind phiKind) { |
21224
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
225 assert derivedKind.getPlatformKind() != Kind.Object || !derivedKind.isDerivedReference(); |
21239
ad3a3c192be6
NodeLIRBuilder: relax verification of derived kinds for PHIs (aka look at stack kinds).
Josef Eisl <josef.eisl@jku.at>
parents:
21235
diff
changeset
|
226 PlatformKind phiPlatformKind = phiKind.getPlatformKind(); |
21308
e15605ce5aba
NodeLIRBuilder#verifyPHIKind: check for LIRKind equality first.
Josef Eisl <josef.eisl@jku.at>
parents:
21239
diff
changeset
|
227 assert derivedKind.equals(phiKind) || derivedKind.getPlatformKind().equals(phiPlatformKind instanceof Kind ? ((Kind) phiPlatformKind).getStackKind() : phiPlatformKind); |
21239
ad3a3c192be6
NodeLIRBuilder: relax verification of derived kinds for PHIs (aka look at stack kinds).
Josef Eisl <josef.eisl@jku.at>
parents:
21235
diff
changeset
|
228 return true; |
21224
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
229 } |
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
230 |
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
231 private static boolean isPhiInputFromBackedge(PhiNode phi, int index) { |
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
232 AbstractMergeNode merge = phi.merge(); |
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
233 AbstractEndNode end = merge.phiPredecessorAt(index); |
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
234 return end instanceof LoopEndNode && ((LoopEndNode) end).loopBegin().equals(merge); |
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
235 } |
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
236 |
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
237 private Value[] createPhiIn(AbstractMergeNode merge) { |
21216 | 238 List<Value> values = new ArrayList<>(); |
21235
7e9edc108b35
NodeLIRBuilder: use AbstractMergeNode#valuePhis.
Josef Eisl <josef.eisl@jku.at>
parents:
21230
diff
changeset
|
239 for (ValuePhiNode phi : merge.valuePhis()) { |
21216 | 240 assert getOperand(phi) == null; |
21224
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
241 Variable value = gen.newVariable(getExactPhiKind(phi)); |
21216 | 242 values.add(value); |
243 setResult(phi, value); | |
244 } | |
245 return values.toArray(new Value[values.size()]); | |
246 } | |
247 | |
248 private Value[] createPhiOut(AbstractMergeNode merge, AbstractEndNode pred) { | |
249 List<Value> values = new ArrayList<>(); | |
21235
7e9edc108b35
NodeLIRBuilder: use AbstractMergeNode#valuePhis.
Josef Eisl <josef.eisl@jku.at>
parents:
21230
diff
changeset
|
250 for (PhiNode phi : merge.valuePhis()) { |
21216 | 251 Value value = operand(phi.valueAt(pred)); |
252 assert value != null; | |
21442
607ddc0b8d21
NodeLIRBuilder#createPhiOut: do not put fixed registers into phiOuts.
Josef Eisl <josef.eisl@jku.at>
parents:
21418
diff
changeset
|
253 if (isRegister(value)) { |
607ddc0b8d21
NodeLIRBuilder#createPhiOut: do not put fixed registers into phiOuts.
Josef Eisl <josef.eisl@jku.at>
parents:
21418
diff
changeset
|
254 /* |
607ddc0b8d21
NodeLIRBuilder#createPhiOut: do not put fixed registers into phiOuts.
Josef Eisl <josef.eisl@jku.at>
parents:
21418
diff
changeset
|
255 * Fixed register intervals are not allowed at block boundaries so we introduce a |
607ddc0b8d21
NodeLIRBuilder#createPhiOut: do not put fixed registers into phiOuts.
Josef Eisl <josef.eisl@jku.at>
parents:
21418
diff
changeset
|
256 * new Variable. |
607ddc0b8d21
NodeLIRBuilder#createPhiOut: do not put fixed registers into phiOuts.
Josef Eisl <josef.eisl@jku.at>
parents:
21418
diff
changeset
|
257 */ |
607ddc0b8d21
NodeLIRBuilder#createPhiOut: do not put fixed registers into phiOuts.
Josef Eisl <josef.eisl@jku.at>
parents:
21418
diff
changeset
|
258 value = gen.emitMove(value); |
607ddc0b8d21
NodeLIRBuilder#createPhiOut: do not put fixed registers into phiOuts.
Josef Eisl <josef.eisl@jku.at>
parents:
21418
diff
changeset
|
259 } |
21216 | 260 values.add(value); |
261 } | |
262 return values.toArray(new Value[values.size()]); | |
263 } | |
264 | |
19824
6b73ce815fc2
Add a new algorithm for latest possible schedule. Fix earliest possible schedule for the case of floating reads. Add scheduling test cases.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
265 public void doBlock(Block block, StructuredGraph graph, BlockMap<List<Node>> blockMap) { |
21183
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
266 try (BlockScope blockScope = gen.getBlockScope(block)) { |
14839 | 267 |
21183
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
268 if (block == gen.getResult().getLIR().getControlFlowGraph().getStartBlock()) { |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
269 assert block.getPredecessorCount() == 0; |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
270 emitPrologue(graph); |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
271 } else { |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
272 assert block.getPredecessorCount() > 0; |
21216 | 273 if (SSA_LIR.getValue()) { |
274 // create phi-in value array | |
275 AbstractBeginNode begin = block.getBeginNode(); | |
276 if (begin instanceof AbstractMergeNode) { | |
277 AbstractMergeNode merge = (AbstractMergeNode) begin; | |
278 LabelOp label = (LabelOp) gen.getResult().getLIR().getLIRforBlock(block).get(0); | |
279 label.setIncomingValues(createPhiIn(merge)); | |
21224
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
280 if (Options.PrintIRWithLIR.getValue() && !TTY.isSuppressed()) { |
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
281 TTY.println("Created PhiIn: " + label); |
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
282 |
993a5446ea6f
NodeLIRBuilder: use LIRKind.merge() to create kind for PHIs.
Josef Eisl <josef.eisl@jku.at>
parents:
21216
diff
changeset
|
283 } |
21216 | 284 } |
285 } | |
21183
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
286 } |
14839 | 287 |
21183
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
288 List<Node> nodes = blockMap.get(block); |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
289 |
21183
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
290 // Allow NodeLIRBuilder subclass to specialize code generation of any interesting groups |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
291 // of instructions |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
292 matchComplexExpressions(nodes); |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
293 |
21183
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
294 for (int i = 0; i < nodes.size(); i++) { |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
295 Node node = nodes.get(i); |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
296 if (node instanceof ValueNode) { |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
297 ValueNode valueNode = (ValueNode) node; |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
298 if (Options.TraceLIRGeneratorLevel.getValue() >= 3) { |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
299 TTY.println("LIRGen for " + valueNode); |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
300 } |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
301 Value operand = getOperand(valueNode); |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
302 if (operand == null) { |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
303 if (!peephole(valueNode)) { |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
304 try { |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
305 doRoot(valueNode); |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21445
diff
changeset
|
306 } catch (JVMCIError e) { |
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21445
diff
changeset
|
307 throw GraalGraphJVMCIError.transformAndAddContext(e, valueNode); |
21183
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
308 } catch (Throwable e) { |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21445
diff
changeset
|
309 throw new GraalGraphJVMCIError(e).addContext(valueNode); |
21183
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
310 } |
19824
6b73ce815fc2
Add a new algorithm for latest possible schedule. Fix earliest possible schedule for the case of floating reads. Add scheduling test cases.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
311 } |
21183
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
312 } else if (ComplexMatchValue.INTERIOR_MATCH.equals(operand)) { |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
313 // Doesn't need to be evaluated |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
314 Debug.log("interior match for %s", valueNode); |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
315 } else if (operand instanceof ComplexMatchValue) { |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
316 Debug.log("complex match for %s", valueNode); |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
317 ComplexMatchValue match = (ComplexMatchValue) operand; |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
318 operand = match.evaluate(this); |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
319 if (operand != null) { |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
320 setResult(valueNode, operand); |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
321 } |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
322 } else { |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
323 // There can be cases in which the result of an instruction is already set |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
324 // before by other instructions. |
14839 | 325 } |
326 } | |
327 } | |
328 | |
21183
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
329 if (!gen.hasBlockEnd(block)) { |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
330 NodeClassIterable successors = block.getEndNode().successors(); |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
331 assert successors.count() == block.getSuccessorCount(); |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
332 if (block.getSuccessorCount() != 1) { |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
333 /* |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
334 * If we have more than one successor, we cannot just use the first one. Since |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
335 * successors are unordered, this would be a random choice. |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
336 */ |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21445
diff
changeset
|
337 throw new JVMCIError("Block without BlockEndOp: " + block.getEndNode()); |
21183
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
338 } |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
339 gen.emitJump(getLIRBlock((FixedNode) successors.first())); |
14839 | 340 } |
21183
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
341 |
565d7dbae77c
LIRGenerator: replace doBlockStart/doBlockEnd with an AutoCloseable.
Josef Eisl <josef.eisl@jku.at>
parents:
20926
diff
changeset
|
342 assert verifyBlock(gen.getResult().getLIR(), block); |
14839 | 343 } |
344 } | |
345 | |
19824
6b73ce815fc2
Add a new algorithm for latest possible schedule. Fix earliest possible schedule for the case of floating reads. Add scheduling test cases.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
346 protected void matchComplexExpressions(List<Node> nodes) { |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
347 if (matchRules != null) { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
348 try (Scope s = Debug.scope("MatchComplexExpressions")) { |
15521
76213c9350ad
improve annotation error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
349 if (LogVerbose.getValue()) { |
76213c9350ad
improve annotation error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
350 int i = 0; |
19824
6b73ce815fc2
Add a new algorithm for latest possible schedule. Fix earliest possible schedule for the case of floating reads. Add scheduling test cases.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
351 for (Node node : nodes) { |
18969
14496953435e
Use Node#getUsageCount wherever possible.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18941
diff
changeset
|
352 Debug.log("%d: (%s) %1S", i++, node.getUsageCount(), node); |
15521
76213c9350ad
improve annotation error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
353 } |
76213c9350ad
improve annotation error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
354 } |
76213c9350ad
improve annotation error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
355 |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
356 // Match the nodes in backwards order to encourage longer matches. |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
357 for (int index = nodes.size() - 1; index >= 0; index--) { |
19824
6b73ce815fc2
Add a new algorithm for latest possible schedule. Fix earliest possible schedule for the case of floating reads. Add scheduling test cases.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19403
diff
changeset
|
358 Node node = nodes.get(index); |
15521
76213c9350ad
improve annotation error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
359 if (getOperand(node) != null) { |
76213c9350ad
improve annotation error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
360 continue; |
76213c9350ad
improve annotation error reporting
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
361 } |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
362 // See if this node is the root of any MatchStatements |
16994
9cf849d5b3f9
reverted matcher to use Class keys instead of NodeClass keys
Doug Simon <doug.simon@oracle.com>
parents:
16983
diff
changeset
|
363 List<MatchStatement> statements = matchRules.get(node.getClass()); |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
364 if (statements != null) { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
365 for (MatchStatement statement : statements) { |
15453
100306ae985b
switch MatchRule from class to method annotation and fix review feedback
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15413
diff
changeset
|
366 if (statement.generate(this, index, node, nodes)) { |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
367 // Found a match so skip to the next |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
368 break; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
369 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
370 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
371 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
372 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
373 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
374 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
375 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15336
diff
changeset
|
376 |
14839 | 377 protected abstract boolean peephole(ValueNode valueNode); |
378 | |
379 private void doRoot(ValueNode instr) { | |
15330
cc0dde80d6df
Remove traceLevel and printIRWithLIR members from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
15297
diff
changeset
|
380 if (Options.TraceLIRGeneratorLevel.getValue() >= 2) { |
14839 | 381 TTY.println("Emitting LIR for instruction " + instr); |
382 } | |
383 currentInstruction = instr; | |
384 | |
385 Debug.log("Visiting %s", instr); | |
386 emitNode(instr); | |
14850 | 387 Debug.log("Operand for %s = %s", instr, getOperand(instr)); |
14839 | 388 } |
389 | |
390 protected void emitNode(ValueNode node) { | |
20926
35e1b66f2810
Rename Stamp.illegal() to Stamp.empty().
Roland Schatz <roland.schatz@oracle.com>
parents:
20898
diff
changeset
|
391 if (Debug.isLogEnabled() && node.stamp().isEmpty()) { |
35e1b66f2810
Rename Stamp.illegal() to Stamp.empty().
Roland Schatz <roland.schatz@oracle.com>
parents:
20898
diff
changeset
|
392 Debug.log("This node has an empty stamp, we are emitting dead code(?): %s", node); |
14839 | 393 } |
15335
14a145f31312
Replace usages LIRGenLowerable with LIRLowerable.
Josef Eisl <josef.eisl@jku.at>
parents:
15333
diff
changeset
|
394 if (node instanceof LIRLowerable) { |
14a145f31312
Replace usages LIRGenLowerable with LIRLowerable.
Josef Eisl <josef.eisl@jku.at>
parents:
15333
diff
changeset
|
395 ((LIRLowerable) node).generate(this); |
14839 | 396 } else if (node instanceof ArithmeticLIRLowerable) { |
15130
ec22234bde0d
Pass more restricted interfaces to ArithmeticLIRLowerable and LocationNode in LIR generation.
Roland Schatz <roland.schatz@oracle.com>
parents:
14950
diff
changeset
|
397 ((ArithmeticLIRLowerable) node).generate(this, gen); |
14839 | 398 } else { |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21445
diff
changeset
|
399 throw JVMCIError.shouldNotReachHere("node is not LIRLowerable: " + node); |
14839 | 400 } |
401 } | |
402 | |
403 protected void emitPrologue(StructuredGraph graph) { | |
14843
dd75a505f1b6
Remove currentBlock from NodeLIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14842
diff
changeset
|
404 CallingConvention incomingArguments = gen.getCallingConvention(); |
14839 | 405 |
406 Value[] params = new Value[incomingArguments.getArgumentCount()]; | |
407 for (int i = 0; i < params.length; i++) { | |
14923
bcef7320c707
Remove more duplicate methods from NodeLIRBuilder and LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14921
diff
changeset
|
408 params[i] = LIRGenerator.toStackKind(incomingArguments.getArgument(i)); |
14839 | 409 if (ValueUtil.isStackSlot(params[i])) { |
410 StackSlot slot = ValueUtil.asStackSlot(params[i]); | |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14920
diff
changeset
|
411 if (slot.isInCallerFrame() && !gen.getResult().getLIR().hasArgInCallerFrame()) { |
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14920
diff
changeset
|
412 gen.getResult().getLIR().setHasArgInCallerFrame(); |
14839 | 413 } |
414 } | |
415 } | |
416 | |
14923
bcef7320c707
Remove more duplicate methods from NodeLIRBuilder and LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14921
diff
changeset
|
417 gen.emitIncomingValues(params); |
14839 | 418 |
19403
61d3cb8e1280
Add generic parameter to NodeClass. Change Graph#getNodes(Class) to Graph#getNodes(NodeClass).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19164
diff
changeset
|
419 for (ParameterNode param : graph.getNodes(ParameterNode.TYPE)) { |
14839 | 420 Value paramValue = params[param.index()]; |
18363
9cbed4622c3c
Fix assertion in SPARC backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
18187
diff
changeset
|
421 assert paramValue.getLIRKind().equals(getLIRGeneratorTool().getLIRKind(param.stamp())); |
14839 | 422 setResult(param, gen.emitMove(paramValue)); |
423 } | |
424 } | |
425 | |
426 @Override | |
18995
a2cb19764970
Rename MergeNode to AbstractMergeNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18993
diff
changeset
|
427 public void visitMerge(AbstractMergeNode x) { |
14839 | 428 } |
429 | |
430 @Override | |
431 public void visitEndNode(AbstractEndNode end) { | |
21187
f74b9f898cf2
NodeLIRBuilder: move creation of jump from moveToPhi() to visitEndNode().
Josef Eisl <josef.eisl@jku.at>
parents:
21183
diff
changeset
|
432 AbstractMergeNode merge = end.merge(); |
21216 | 433 JumpOp jump = newJumpOp(getLIRBlock(merge)); |
434 if (SSA_LIR.getValue()) { | |
435 jump.setOutgoingValues(createPhiOut(merge, end)); | |
436 } else { | |
437 moveToPhi(merge, end); | |
438 } | |
439 append(jump); | |
14839 | 440 } |
441 | |
442 /** | |
443 * Runtime specific classes can override this to insert a safepoint at the end of a loop. | |
444 */ | |
445 @Override | |
446 public void visitLoopEnd(LoopEndNode x) { | |
447 } | |
448 | |
18995
a2cb19764970
Rename MergeNode to AbstractMergeNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18993
diff
changeset
|
449 private void moveToPhi(AbstractMergeNode merge, AbstractEndNode pred) { |
15330
cc0dde80d6df
Remove traceLevel and printIRWithLIR members from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
15297
diff
changeset
|
450 if (Options.TraceLIRGeneratorLevel.getValue() >= 1) { |
14839 | 451 TTY.println("MOVE TO PHI from " + pred + " to " + merge); |
452 } | |
21191
12a5d2c12e2e
PhiResolver: add factory methods.
Josef Eisl <josef.eisl@jku.at>
parents:
21187
diff
changeset
|
453 PhiResolver resolver = PhiResolver.create(gen); |
14839 | 454 for (PhiNode phi : merge.phis()) { |
14978
e302df8bf51c
separate subclasses for value and guard phis and proxies
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14972
diff
changeset
|
455 if (phi instanceof ValuePhiNode) { |
14839 | 456 ValueNode curVal = phi.valueAt(pred); |
14978
e302df8bf51c
separate subclasses for value and guard phis and proxies
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14972
diff
changeset
|
457 resolver.move(operandForPhi((ValuePhiNode) phi), operand(curVal)); |
14839 | 458 } |
459 } | |
460 resolver.dispose(); | |
17177
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16994
diff
changeset
|
461 } |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16994
diff
changeset
|
462 |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16994
diff
changeset
|
463 protected JumpOp newJumpOp(LabelRef ref) { |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
16994
diff
changeset
|
464 return new JumpOp(ref); |
14839 | 465 } |
466 | |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16092
diff
changeset
|
467 protected LIRKind getPhiKind(PhiNode phi) { |
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16092
diff
changeset
|
468 return gen.getLIRKind(phi.stamp()); |
14839 | 469 } |
470 | |
14978
e302df8bf51c
separate subclasses for value and guard phis and proxies
Lukas Stadler <lukas.stadler@oracle.com>
parents:
14972
diff
changeset
|
471 private Value operandForPhi(ValuePhiNode phi) { |
14850 | 472 Value result = getOperand(phi); |
14839 | 473 if (result == null) { |
474 // allocate a variable for this phi | |
475 Variable newOperand = gen.newVariable(getPhiKind(phi)); | |
476 setResult(phi, newOperand); | |
477 return newOperand; | |
478 } else { | |
479 return result; | |
480 } | |
481 } | |
482 | |
483 @Override | |
484 public void emitIf(IfNode x) { | |
485 emitBranch(x.condition(), getLIRBlock(x.trueSuccessor()), getLIRBlock(x.falseSuccessor()), x.probability(x.trueSuccessor())); | |
486 } | |
487 | |
488 public void emitBranch(LogicNode node, LabelRef trueSuccessor, LabelRef falseSuccessor, double trueSuccessorProbability) { | |
489 if (node instanceof IsNullNode) { | |
490 emitNullCheckBranch((IsNullNode) node, trueSuccessor, falseSuccessor, trueSuccessorProbability); | |
491 } else if (node instanceof CompareNode) { | |
492 emitCompareBranch((CompareNode) node, trueSuccessor, falseSuccessor, trueSuccessorProbability); | |
493 } else if (node instanceof LogicConstantNode) { | |
494 emitConstantBranch(((LogicConstantNode) node).getValue(), trueSuccessor, falseSuccessor); | |
495 } else if (node instanceof IntegerTestNode) { | |
496 emitIntegerTestBranch((IntegerTestNode) node, trueSuccessor, falseSuccessor, trueSuccessorProbability); | |
497 } else { | |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21445
diff
changeset
|
498 throw JVMCIError.unimplemented(node.toString()); |
14839 | 499 } |
500 } | |
501 | |
502 private void emitNullCheckBranch(IsNullNode node, LabelRef trueSuccessor, LabelRef falseSuccessor, double trueSuccessorProbability) { | |
16207
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16156
diff
changeset
|
503 PlatformKind kind = gen.getLIRKind(node.getValue().stamp()).getPlatformKind(); |
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16156
diff
changeset
|
504 gen.emitCompareBranch(kind, operand(node.getValue()), kind.getDefaultValue(), Condition.EQ, false, trueSuccessor, falseSuccessor, trueSuccessorProbability); |
14839 | 505 } |
506 | |
507 public void emitCompareBranch(CompareNode compare, LabelRef trueSuccessor, LabelRef falseSuccessor, double trueSuccessorProbability) { | |
16207
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16156
diff
changeset
|
508 PlatformKind kind = gen.getLIRKind(compare.getX().stamp()).getPlatformKind(); |
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16156
diff
changeset
|
509 gen.emitCompareBranch(kind, operand(compare.getX()), operand(compare.getY()), compare.condition(), compare.unorderedIsTrue(), trueSuccessor, falseSuccessor, trueSuccessorProbability); |
14839 | 510 } |
511 | |
512 public void emitIntegerTestBranch(IntegerTestNode test, LabelRef trueSuccessor, LabelRef falseSuccessor, double trueSuccessorProbability) { | |
16207
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16156
diff
changeset
|
513 gen.emitIntegerTestBranch(operand(test.getX()), operand(test.getY()), trueSuccessor, falseSuccessor, trueSuccessorProbability); |
14839 | 514 } |
515 | |
516 public void emitConstantBranch(boolean value, LabelRef trueSuccessorBlock, LabelRef falseSuccessorBlock) { | |
517 LabelRef block = value ? trueSuccessorBlock : falseSuccessorBlock; | |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14839
diff
changeset
|
518 gen.emitJump(block); |
14839 | 519 } |
520 | |
521 @Override | |
522 public void emitConditional(ConditionalNode conditional) { | |
523 Value tVal = operand(conditional.trueValue()); | |
524 Value fVal = operand(conditional.falseValue()); | |
525 setResult(conditional, emitConditional(conditional.condition(), tVal, fVal)); | |
526 } | |
527 | |
528 public Variable emitConditional(LogicNode node, Value trueValue, Value falseValue) { | |
529 if (node instanceof IsNullNode) { | |
530 IsNullNode isNullNode = (IsNullNode) node; | |
16207
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16156
diff
changeset
|
531 PlatformKind kind = gen.getLIRKind(isNullNode.getValue().stamp()).getPlatformKind(); |
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16156
diff
changeset
|
532 return gen.emitConditionalMove(kind, operand(isNullNode.getValue()), kind.getDefaultValue(), Condition.EQ, false, trueValue, falseValue); |
14839 | 533 } else if (node instanceof CompareNode) { |
534 CompareNode compare = (CompareNode) node; | |
16207
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16156
diff
changeset
|
535 PlatformKind kind = gen.getLIRKind(compare.getX().stamp()).getPlatformKind(); |
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16156
diff
changeset
|
536 return gen.emitConditionalMove(kind, operand(compare.getX()), operand(compare.getY()), compare.condition(), compare.unorderedIsTrue(), trueValue, falseValue); |
14839 | 537 } else if (node instanceof LogicConstantNode) { |
538 return gen.emitMove(((LogicConstantNode) node).getValue() ? trueValue : falseValue); | |
539 } else if (node instanceof IntegerTestNode) { | |
540 IntegerTestNode test = (IntegerTestNode) node; | |
16207
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16156
diff
changeset
|
541 return gen.emitIntegerTestMove(operand(test.getX()), operand(test.getY()), trueValue, falseValue); |
14839 | 542 } else { |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21445
diff
changeset
|
543 throw JVMCIError.unimplemented(node.toString()); |
14839 | 544 } |
545 } | |
546 | |
547 @Override | |
548 public void emitInvoke(Invoke x) { | |
549 LoweredCallTargetNode callTarget = (LoweredCallTargetNode) x.callTarget(); | |
18149
c6086a18c9ce
Rename LIRGenerationResult.getFrameMap() to getFrameMapBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
18123
diff
changeset
|
550 CallingConvention invokeCc = gen.getResult().getFrameMapBuilder().getRegisterConfig().getCallingConvention(callTarget.callType(), x.asNode().stamp().javaType(gen.getMetaAccess()), |
18123
3c7e73362d6a
Encapsulate FrameMap.registerConfig & FrameMap.target.
Josef Eisl <josef.eisl@jku.at>
parents:
17200
diff
changeset
|
551 callTarget.signature(), gen.target(), false); |
18149
c6086a18c9ce
Rename LIRGenerationResult.getFrameMap() to getFrameMapBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
18123
diff
changeset
|
552 gen.getResult().getFrameMapBuilder().callsMethod(invokeCc); |
14839 | 553 |
554 Value[] parameters = visitInvokeArguments(invokeCc, callTarget.arguments()); | |
555 | |
556 LabelRef exceptionEdge = null; | |
557 if (x instanceof InvokeWithExceptionNode) { | |
558 exceptionEdge = getLIRBlock(((InvokeWithExceptionNode) x).exceptionEdge()); | |
559 } | |
15296
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
560 LIRFrameState callState = stateWithExceptionEdge(x, exceptionEdge); |
14839 | 561 |
562 Value result = invokeCc.getReturn(); | |
563 if (callTarget instanceof DirectCallTargetNode) { | |
564 emitDirectCall((DirectCallTargetNode) callTarget, result, parameters, AllocatableValue.NONE, callState); | |
565 } else if (callTarget instanceof IndirectCallTargetNode) { | |
566 emitIndirectCall((IndirectCallTargetNode) callTarget, result, parameters, AllocatableValue.NONE, callState); | |
567 } else { | |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21445
diff
changeset
|
568 throw JVMCIError.shouldNotReachHere(); |
14839 | 569 } |
570 | |
571 if (isLegal(result)) { | |
572 setResult(x.asNode(), gen.emitMove(result)); | |
573 } | |
574 | |
575 if (x instanceof InvokeWithExceptionNode) { | |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14839
diff
changeset
|
576 gen.emitJump(getLIRBlock(((InvokeWithExceptionNode) x).next())); |
14839 | 577 } |
578 } | |
579 | |
580 protected abstract void emitDirectCall(DirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState); | |
581 | |
582 protected abstract void emitIndirectCall(IndirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState); | |
583 | |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14839
diff
changeset
|
584 @Override |
14839 | 585 public Value[] visitInvokeArguments(CallingConvention invokeCc, Collection<ValueNode> arguments) { |
586 // for each argument, load it into the correct location | |
587 Value[] result = new Value[arguments.size()]; | |
588 int j = 0; | |
589 for (ValueNode arg : arguments) { | |
590 if (arg != null) { | |
14923
bcef7320c707
Remove more duplicate methods from NodeLIRBuilder and LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14921
diff
changeset
|
591 AllocatableValue operand = LIRGenerator.toStackKind(invokeCc.getArgument(j)); |
14839 | 592 gen.emitMove(operand, operand(arg)); |
593 result[j] = operand; | |
594 j++; | |
595 } else { | |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21445
diff
changeset
|
596 throw JVMCIError.shouldNotReachHere("I thought we no longer have null entries for two-slot types..."); |
14839 | 597 } |
598 } | |
599 return result; | |
600 } | |
601 | |
602 /** | |
603 * This method tries to create a switch implementation that is optimal for the given switch. It | |
604 * will either generate a sequential if/then/else cascade, a set of range tests or a table | |
605 * switch. | |
14850 | 606 * |
14839 | 607 * If the given switch does not contain int keys, it will always create a sequential |
608 * implementation. | |
609 */ | |
610 @Override | |
611 public void emitSwitch(SwitchNode x) { | |
612 assert x.defaultSuccessor() != null; | |
613 LabelRef defaultTarget = getLIRBlock(x.defaultSuccessor()); | |
614 int keyCount = x.keyCount(); | |
615 if (keyCount == 0) { | |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14839
diff
changeset
|
616 gen.emitJump(defaultTarget); |
14839 | 617 } else { |
618 Variable value = gen.load(operand(x.value())); | |
619 if (keyCount == 1) { | |
620 assert defaultTarget != null; | |
621 double probability = x.probability(x.keySuccessor(0)); | |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16092
diff
changeset
|
622 PlatformKind kind = gen.getLIRKind(x.value().stamp()).getPlatformKind(); |
14962
e4a5b8904695
Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14950
diff
changeset
|
623 gen.emitCompareBranch(kind, gen.load(operand(x.value())), x.keyAt(0), Condition.EQ, false, getLIRBlock(x.keySuccessor(0)), defaultTarget, probability); |
14839 | 624 } else { |
625 LabelRef[] keyTargets = new LabelRef[keyCount]; | |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18149
diff
changeset
|
626 JavaConstant[] keyConstants = new JavaConstant[keyCount]; |
14839 | 627 double[] keyProbabilities = new double[keyCount]; |
628 for (int i = 0; i < keyCount; i++) { | |
629 keyTargets[i] = getLIRBlock(x.keySuccessor(i)); | |
630 keyConstants[i] = x.keyAt(i); | |
631 keyProbabilities[i] = x.keyProbability(i); | |
632 } | |
633 if (value.getKind() != Kind.Int || !x.isSorted()) { | |
634 // hopefully only a few entries | |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14839
diff
changeset
|
635 gen.emitStrategySwitch(new SwitchStrategy.SequentialStrategy(keyProbabilities, keyConstants), value, keyTargets, defaultTarget); |
14839 | 636 } else { |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14839
diff
changeset
|
637 gen.emitStrategySwitch(keyConstants, keyProbabilities, keyTargets, defaultTarget, value); |
14839 | 638 } |
639 } | |
640 } | |
641 } | |
642 | |
643 public final NodeMap<Value> getNodeOperands() { | |
644 assert nodeOperands != null; | |
645 return nodeOperands; | |
646 } | |
647 | |
648 public DebugInfoBuilder getDebugInfoBuilder() { | |
649 assert debugInfoBuilder != null; | |
650 return debugInfoBuilder; | |
651 } | |
652 | |
15296
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
653 private static FrameState getFrameState(DeoptimizingNode deopt) { |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
654 if (deopt instanceof DeoptimizingNode.DeoptBefore) { |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
655 assert !(deopt instanceof DeoptimizingNode.DeoptDuring || deopt instanceof DeoptimizingNode.DeoptAfter); |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
656 return ((DeoptimizingNode.DeoptBefore) deopt).stateBefore(); |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
657 } else if (deopt instanceof DeoptimizingNode.DeoptDuring) { |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
658 assert !(deopt instanceof DeoptimizingNode.DeoptAfter); |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
659 return ((DeoptimizingNode.DeoptDuring) deopt).stateDuring(); |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
660 } else { |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
661 assert deopt instanceof DeoptimizingNode.DeoptAfter; |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
662 return ((DeoptimizingNode.DeoptAfter) deopt).stateAfter(); |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
663 } |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
664 } |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
665 |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
666 public LIRFrameState state(DeoptimizingNode deopt) { |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
667 if (!deopt.canDeoptimize()) { |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
668 return null; |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
669 } |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
670 return stateFor(getFrameState(deopt)); |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
671 } |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
672 |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
673 public LIRFrameState stateWithExceptionEdge(DeoptimizingNode deopt, LabelRef exceptionEdge) { |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
674 if (!deopt.canDeoptimize()) { |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
675 return null; |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
676 } |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
677 return stateForWithExceptionEdge(getFrameState(deopt), exceptionEdge); |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
678 } |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
679 |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
680 public LIRFrameState stateFor(FrameState state) { |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
681 return stateForWithExceptionEdge(state, null); |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
682 } |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
683 |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
684 public LIRFrameState stateForWithExceptionEdge(FrameState state, LabelRef exceptionEdge) { |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
685 if (gen.needOnlyOopMaps()) { |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
686 return new LIRFrameState(null, null, null); |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
687 } |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
688 assert state != null; |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
689 return getDebugInfoBuilder().build(state, exceptionEdge); |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
690 } |
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15261
diff
changeset
|
691 |
18843
5e80dd2f1783
Extend emitMul, emitAdd and emitSub in ArithmeticLIRGenerator for explicitly requesting to set the flags register. (In AMD64 flags are set implicitly, but on SPARC it is not)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
18363
diff
changeset
|
692 @Override |
18993
480bd3b1adcd
Rename BeginNode => AbstractBeginNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18969
diff
changeset
|
693 public void emitOverflowCheckBranch(AbstractBeginNode overflowSuccessor, AbstractBeginNode next, Stamp stamp, double probability) { |
18843
5e80dd2f1783
Extend emitMul, emitAdd and emitSub in ArithmeticLIRGenerator for explicitly requesting to set the flags register. (In AMD64 flags are set implicitly, but on SPARC it is not)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
18363
diff
changeset
|
694 LIRKind cmpKind = getLIRGeneratorTool().getLIRKind(stamp); |
5e80dd2f1783
Extend emitMul, emitAdd and emitSub in ArithmeticLIRGenerator for explicitly requesting to set the flags register. (In AMD64 flags are set implicitly, but on SPARC it is not)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
18363
diff
changeset
|
695 gen.emitOverflowCheckBranch(getLIRBlock(overflowSuccessor), getLIRBlock(next), cmpKind, probability); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14839
diff
changeset
|
696 } |
14839 | 697 |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14839
diff
changeset
|
698 @Override |
16573
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16207
diff
changeset
|
699 public void visitFullInfopointNode(FullInfopointNode i) { |
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16207
diff
changeset
|
700 append(new FullInfopointOp(stateFor(i.getState()), i.getReason())); |
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16207
diff
changeset
|
701 } |
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16207
diff
changeset
|
702 |
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16207
diff
changeset
|
703 @Override |
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16207
diff
changeset
|
704 public void visitSimpleInfopointNode(SimpleInfopointNode i) { |
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16207
diff
changeset
|
705 append(new SimpleInfopointOp(i.getReason(), i.getPosition())); |
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16207
diff
changeset
|
706 } |
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16207
diff
changeset
|
707 |
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16207
diff
changeset
|
708 @Override |
15331
71cdf5518dab
Use LIRGeneratorTool in NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
15330
diff
changeset
|
709 public LIRGeneratorTool getLIRGeneratorTool() { |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14839
diff
changeset
|
710 return gen; |
14839 | 711 } |
712 } |