Mercurial > hg > truffle
annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java @ 16248:c5b2a3c22318
refactor more Canonicalizable implementations to not add new nodes to the graph
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Thu, 26 Jun 2014 16:27:35 +0200 |
parents | 4182366b8eed |
children | 5d468add216f |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.nodes.calc; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
7724
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
25 import static com.oracle.graal.nodes.calc.CompareNode.*; |
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
26 |
5657
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5563
diff
changeset
|
27 import com.oracle.graal.api.meta.*; |
15200
97eed257999b
Move Condition to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15040
diff
changeset
|
28 import com.oracle.graal.compiler.common.calc.*; |
15261
882f4cb7cfcf
Move Stamps to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents:
15200
diff
changeset
|
29 import com.oracle.graal.compiler.common.type.*; |
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:
11652
diff
changeset
|
30 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
|
31 import com.oracle.graal.graph.spi.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
32 import com.oracle.graal.nodes.*; |
7724
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
33 import com.oracle.graal.nodes.java.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
34 import com.oracle.graal.nodes.spi.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
5657
diff
changeset
|
37 * The {@code ConditionalNode} class represents a comparison that yields one of two values. Note |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
5657
diff
changeset
|
38 * that these nodes are not built directly from the bytecode but are introduced by canonicalization. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 */ |
16162
b3945bb0016f
ConditionalNode is not a BinaryNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15756
diff
changeset
|
40 public final class ConditionalNode extends FloatingNode implements Canonicalizable, LIRLowerable { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
41 |
15001 | 42 @Input(InputType.Condition) private LogicNode condition; |
16162
b3945bb0016f
ConditionalNode is not a BinaryNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15756
diff
changeset
|
43 @Input private ValueNode trueValue; |
b3945bb0016f
ConditionalNode is not a BinaryNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15756
diff
changeset
|
44 @Input private ValueNode falseValue; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 |
7767
4a6646d8eb87
separate BooleanNode and ConstantNode hierarchy, rename BooleanNode to LogicNode and LogicNode to BitLogicNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7724
diff
changeset
|
46 public LogicNode condition() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 return condition; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
49 |
11314
dc14bcf752ea
New constructor for ConditionalNode. Made CustomTypeCheck node a LogicNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11278
diff
changeset
|
50 public ConditionalNode(LogicNode condition) { |
dc14bcf752ea
New constructor for ConditionalNode. Made CustomTypeCheck node a LogicNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11278
diff
changeset
|
51 this(condition, ConstantNode.forInt(1, condition.graph()), ConstantNode.forInt(0, condition.graph())); |
dc14bcf752ea
New constructor for ConditionalNode. Made CustomTypeCheck node a LogicNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11278
diff
changeset
|
52 } |
dc14bcf752ea
New constructor for ConditionalNode. Made CustomTypeCheck node a LogicNode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11278
diff
changeset
|
53 |
7767
4a6646d8eb87
separate BooleanNode and ConstantNode hierarchy, rename BooleanNode to LogicNode and LogicNode to BitLogicNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7724
diff
changeset
|
54 public ConditionalNode(LogicNode condition, ValueNode trueValue, ValueNode falseValue) { |
16162
b3945bb0016f
ConditionalNode is not a BinaryNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15756
diff
changeset
|
55 super(trueValue.stamp().meet(falseValue.stamp())); |
14024
34c07ef28bc9
Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents:
12655
diff
changeset
|
56 assert trueValue.stamp().isCompatible(falseValue.stamp()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 this.condition = condition; |
16162
b3945bb0016f
ConditionalNode is not a BinaryNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15756
diff
changeset
|
58 this.trueValue = trueValue; |
b3945bb0016f
ConditionalNode is not a BinaryNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15756
diff
changeset
|
59 this.falseValue = falseValue; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
60 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 |
7724
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
62 @Override |
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
63 public boolean inferStamp() { |
16162
b3945bb0016f
ConditionalNode is not a BinaryNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15756
diff
changeset
|
64 return updateStamp(trueValue.stamp().meet(falseValue.stamp())); |
7724
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
65 } |
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
66 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 public ValueNode trueValue() { |
16162
b3945bb0016f
ConditionalNode is not a BinaryNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15756
diff
changeset
|
68 return trueValue; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
69 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
71 public ValueNode falseValue() { |
16162
b3945bb0016f
ConditionalNode is not a BinaryNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15756
diff
changeset
|
72 return falseValue; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
73 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
74 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
75 @Override |
16162
b3945bb0016f
ConditionalNode is not a BinaryNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15756
diff
changeset
|
76 public ValueNode canonical(CanonicalizerTool tool) { |
11409
1f302b6e16b0
Introduce LogicNegationNode and remove Negatable interface.
Roland Schatz <roland.schatz@oracle.com>
parents:
11352
diff
changeset
|
77 if (condition instanceof LogicNegationNode) { |
1f302b6e16b0
Introduce LogicNegationNode and remove Negatable interface.
Roland Schatz <roland.schatz@oracle.com>
parents:
11352
diff
changeset
|
78 LogicNegationNode negated = (LogicNegationNode) condition; |
16248
c5b2a3c22318
refactor more Canonicalizable implementations to not add new nodes to the graph
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16220
diff
changeset
|
79 return new ConditionalNode(negated.getValue(), falseValue(), trueValue()); |
11409
1f302b6e16b0
Introduce LogicNegationNode and remove Negatable interface.
Roland Schatz <roland.schatz@oracle.com>
parents:
11352
diff
changeset
|
80 } |
1f302b6e16b0
Introduce LogicNegationNode and remove Negatable interface.
Roland Schatz <roland.schatz@oracle.com>
parents:
11352
diff
changeset
|
81 |
5657
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5563
diff
changeset
|
82 // this optimizes the case where a value that can only be 0 or 1 is materialized to 0 or 1 |
16162
b3945bb0016f
ConditionalNode is not a BinaryNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15756
diff
changeset
|
83 if (trueValue().isConstant() && falseValue().isConstant() && condition instanceof IntegerEqualsNode) { |
5657
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5563
diff
changeset
|
84 IntegerEqualsNode equals = (IntegerEqualsNode) condition; |
16207
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16162
diff
changeset
|
85 if (equals.getY().isConstant() && equals.getY().asConstant().equals(Constant.INT_0) && equals.getX().stamp() instanceof IntegerStamp) { |
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16162
diff
changeset
|
86 IntegerStamp equalsXStamp = (IntegerStamp) equals.getX().stamp(); |
11352
8185c119d731
"always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents:
11314
diff
changeset
|
87 if (equalsXStamp.upMask() == 1) { |
16162
b3945bb0016f
ConditionalNode is not a BinaryNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15756
diff
changeset
|
88 if (trueValue().asConstant().equals(Constant.INT_0) && falseValue().asConstant().equals(Constant.INT_1)) { |
16207
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16162
diff
changeset
|
89 return IntegerConvertNode.convertUnsigned(equals.getX(), stamp()); |
11278
6d28ce8cdeb7
Fix canonicalization of conditional nodes, add a test for this bug
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
11265
diff
changeset
|
90 } |
5657
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5563
diff
changeset
|
91 } |
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5563
diff
changeset
|
92 } |
d71eb56d6bb0
new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents:
5563
diff
changeset
|
93 } |
7767
4a6646d8eb87
separate BooleanNode and ConstantNode hierarchy, rename BooleanNode to LogicNode and LogicNode to BitLogicNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7724
diff
changeset
|
94 if (condition instanceof LogicConstantNode) { |
4a6646d8eb87
separate BooleanNode and ConstantNode hierarchy, rename BooleanNode to LogicNode and LogicNode to BitLogicNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7724
diff
changeset
|
95 LogicConstantNode c = (LogicConstantNode) condition; |
4a6646d8eb87
separate BooleanNode and ConstantNode hierarchy, rename BooleanNode to LogicNode and LogicNode to BitLogicNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7724
diff
changeset
|
96 if (c.getValue()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
97 return trueValue(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
98 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
99 return falseValue(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
100 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
101 } |
11410
446a94461d53
Improve canonicalization of ConditionalNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
11409
diff
changeset
|
102 if (condition instanceof CompareNode && ((CompareNode) condition).condition() == Condition.EQ) { |
446a94461d53
Improve canonicalization of ConditionalNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
11409
diff
changeset
|
103 // optimize the pattern (x == y) ? x : y |
446a94461d53
Improve canonicalization of ConditionalNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
11409
diff
changeset
|
104 CompareNode compare = (CompareNode) condition; |
16207
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16162
diff
changeset
|
105 if ((compare.getX() == trueValue() && compare.getY() == falseValue()) || (compare.getX() == falseValue() && compare.getY() == trueValue())) { |
11410
446a94461d53
Improve canonicalization of ConditionalNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
11409
diff
changeset
|
106 return falseValue(); |
446a94461d53
Improve canonicalization of ConditionalNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
11409
diff
changeset
|
107 } |
446a94461d53
Improve canonicalization of ConditionalNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
11409
diff
changeset
|
108 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
109 if (trueValue() == falseValue()) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
110 return trueValue(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
111 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
112 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
113 return this; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
114 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
115 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
116 @Override |
14950
d5a1206e1923
NodeLIRBuilderTool: fix typo in interface name.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
117 public void generate(NodeLIRBuilderTool generator) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
118 generator.emitConditional(this); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
119 } |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
120 |
12655
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
11881
diff
changeset
|
121 private ConditionalNode(@InjectedNodeParameter StructuredGraph graph, Condition condition, ValueNode x, ValueNode y) { |
2c4aa758ee18
made ConstantNodes external to a Graph (GRAAL-508)
Doug Simon <doug.simon@oracle.com>
parents:
11881
diff
changeset
|
122 this(createCompareNode(graph, condition, x, y)); |
7724
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
123 } |
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
124 |
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
125 private ConditionalNode(ValueNode type, ValueNode object) { |
11652
f091e0d6f4f3
Disallow add for global value numberable node types. Introduce addWithoutUnique.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
11410
diff
changeset
|
126 this(type.graph().unique(new InstanceOfDynamicNode(type, object))); |
7724
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
127 } |
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
128 |
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
129 @NodeIntrinsic |
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
130 public static native boolean materializeCondition(@ConstantNodeParameter Condition condition, int x, int y); |
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
131 |
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
132 @NodeIntrinsic |
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
133 public static native boolean materializeCondition(@ConstantNodeParameter Condition condition, long x, long y); |
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
134 |
ac3579b4adc9
remove MaterializeNode
Lukas Stadler <lukas.stadler@jku.at>
parents:
7530
diff
changeset
|
135 @NodeIntrinsic |
15040
288c23143d47
Fix most raw type references.
Josef Eisl <josef.eisl@jku.at>
parents:
15001
diff
changeset
|
136 public static boolean materializeIsInstance(Class<?> mirror, Object object) { |
8480
7abc6865bdc6
made method substitutions for Class be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
137 return mirror.isInstance(object); |
7abc6865bdc6
made method substitutions for Class be interpretable
Doug Simon <doug.simon@oracle.com>
parents:
8451
diff
changeset
|
138 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
139 } |