annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerDivNode.java @ 17450:45b45f902bed

removed Node generation (GRAAL-857)
author Doug Simon <doug.simon@oracle.com>
date Wed, 15 Oct 2014 15:35:33 +0200
parents ffb974bef674
children 9619ba4daf4c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
16215
b558af6ff4bc don't pass stamps to arithmetic node constructors
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16207
diff changeset
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
23 package com.oracle.graal.nodes.calc;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
17210
ef64e2682bb6 added Edges class to consolidate code operating on set of input or successor edges and to better isolate magic used to access edges
Doug Simon <doug.simon@oracle.com>
parents: 17198
diff changeset
25 import static com.oracle.graal.graph.Edges.Type.*;
ef64e2682bb6 added Edges class to consolidate code operating on set of input or successor edges and to better isolate magic used to access edges
Doug Simon <doug.simon@oracle.com>
parents: 17198
diff changeset
26
5657
d71eb56d6bb0 new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents: 5540
diff changeset
27 import com.oracle.graal.api.code.*;
15198
2c0cfbf454b5 Move LIRTypeTool and Stamp to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 14950
diff changeset
28 import com.oracle.graal.compiler.common.type.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
29 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
30 import com.oracle.graal.graph.spi.*;
16841
cbd42807a31f moved NodeInfo and friends into separate com.oracle.graal.nodeinfo project so that annotation processor can be applied to the base Node class
Doug Simon <doug.simon@oracle.com>
parents: 16263
diff changeset
31 import com.oracle.graal.nodeinfo.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
32 import com.oracle.graal.nodes.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
33 import com.oracle.graal.nodes.spi.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
34
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
35 @NodeInfo(shortName = "/")
16223
1434b835f0d3 implement Canonicalizable.Binary in the FixedBinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16218
diff changeset
36 public class IntegerDivNode extends FixedBinaryNode implements Lowerable, LIRLowerable {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
37
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
38 public static IntegerDivNode create(ValueNode x, ValueNode y) {
17450
45b45f902bed removed Node generation (GRAAL-857)
Doug Simon <doug.simon@oracle.com>
parents: 17276
diff changeset
39 return new IntegerDivNode(x, y);
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
40 }
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
41
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
42 protected IntegerDivNode(ValueNode x, ValueNode y) {
17198
75177b3cc5a8 Remove unused methods from StampTool.
Roland Schatz <roland.schatz@oracle.com>
parents: 17197
diff changeset
43 super(IntegerStamp.OPS.getDiv().foldStamp(x.stamp(), y.stamp()), x, y);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
44 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
45
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46 @Override
5657
d71eb56d6bb0 new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents: 5540
diff changeset
47 public boolean inferStamp() {
17198
75177b3cc5a8 Remove unused methods from StampTool.
Roland Schatz <roland.schatz@oracle.com>
parents: 17197
diff changeset
48 return updateStamp(IntegerStamp.OPS.getDiv().foldStamp(getX().stamp(), getY().stamp()));
5657
d71eb56d6bb0 new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents: 5540
diff changeset
49 }
d71eb56d6bb0 new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents: 5540
diff changeset
50
d71eb56d6bb0 new stamp inference in CanonicalizerPhase, IntegerStamp.mask
Lukas Stadler <lukas.stadler@jku.at>
parents: 5540
diff changeset
51 @Override
16223
1434b835f0d3 implement Canonicalizable.Binary in the FixedBinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16218
diff changeset
52 public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) {
1434b835f0d3 implement Canonicalizable.Binary in the FixedBinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16218
diff changeset
53 if (forX.isConstant() && forY.isConstant()) {
16897
f90dcdbbb75e switched to using new NodeFieldIterator and NodeFieldIterable for traversing Node inputs and successors
Doug Simon <doug.simon@oracle.com>
parents: 16895
diff changeset
54 @SuppressWarnings("hiding")
16223
1434b835f0d3 implement Canonicalizable.Binary in the FixedBinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16218
diff changeset
55 long y = forY.asConstant().asLong();
14024
34c07ef28bc9 Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents: 12655
diff changeset
56 if (y == 0) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
57 return this; // this will trap, can not canonicalize
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58 }
16223
1434b835f0d3 implement Canonicalizable.Binary in the FixedBinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16218
diff changeset
59 return ConstantNode.forIntegerStamp(stamp(), forX.asConstant().asLong() / y);
1434b835f0d3 implement Canonicalizable.Binary in the FixedBinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16218
diff changeset
60 } else if (forY.isConstant()) {
1434b835f0d3 implement Canonicalizable.Binary in the FixedBinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16218
diff changeset
61 long c = forY.asConstant().asLong();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62 if (c == 1) {
16223
1434b835f0d3 implement Canonicalizable.Binary in the FixedBinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16218
diff changeset
63 return forX;
5689
1d3df3a16940 Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5657
diff changeset
64 }
1d3df3a16940 Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5657
diff changeset
65 if (c == -1) {
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
66 return NegateNode.create(forX);
5689
1d3df3a16940 Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5657
diff changeset
67 }
1d3df3a16940 Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5657
diff changeset
68 long abs = Math.abs(c);
16223
1434b835f0d3 implement Canonicalizable.Binary in the FixedBinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16218
diff changeset
69 if (CodeUtil.isPowerOf2(abs) && forX.stamp() instanceof IntegerStamp) {
1434b835f0d3 implement Canonicalizable.Binary in the FixedBinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16218
diff changeset
70 ValueNode dividend = forX;
1434b835f0d3 implement Canonicalizable.Binary in the FixedBinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16218
diff changeset
71 IntegerStamp stampX = (IntegerStamp) forX.stamp();
5689
1d3df3a16940 Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5657
diff changeset
72 int log2 = CodeUtil.log2(abs);
6299
1ed726759f65 Add helper methods to IntegerStamp for sign, use them
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5689
diff changeset
73 // no rounding if dividend is positive or if its low bits are always 0
11352
8185c119d731 "always set" bit mask on IntegerStamps
Lukas Stadler <lukas.stadler@jku.at>
parents: 11265
diff changeset
74 if (stampX.canBeNegative() || (stampX.upMask() & (abs - 1)) != 0) {
14024
34c07ef28bc9 Support integer arithmetic for arbitrary types.
Roland Schatz <roland.schatz@oracle.com>
parents: 12655
diff changeset
75 int bits = PrimitiveStamp.getBits(stamp());
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
76 RightShiftNode sign = RightShiftNode.create(forX, ConstantNode.forInt(bits - 1));
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
77 UnsignedRightShiftNode round = UnsignedRightShiftNode.create(sign, ConstantNode.forInt(bits - log2));
17197
ec35bb4eccb8 Add support for other data types to integer arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents: 16986
diff changeset
78 dividend = BinaryArithmeticNode.add(dividend, round);
5689
1d3df3a16940 Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5657
diff changeset
79 }
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
80 RightShiftNode shift = RightShiftNode.create(dividend, ConstantNode.forInt(log2));
5689
1d3df3a16940 Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5657
diff changeset
81 if (c < 0) {
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
82 return NegateNode.create(shift);
5689
1d3df3a16940 Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5657
diff changeset
83 }
1d3df3a16940 Canonicalize more Mul/Div to shifts
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 5657
diff changeset
84 return shift;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
85 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
86 }
7378
88506cfc3bab Canonicalize ((a - a % b) / b) into (a / b).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7305
diff changeset
87
88506cfc3bab Canonicalize ((a - a % b) / b) into (a / b).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7305
diff changeset
88 // Convert the expression ((a - a % b) / b) into (a / b).
17197
ec35bb4eccb8 Add support for other data types to integer arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents: 16986
diff changeset
89 if (forX instanceof SubNode) {
ec35bb4eccb8 Add support for other data types to integer arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents: 16986
diff changeset
90 SubNode integerSubNode = (SubNode) forX;
16207
df6f2365b153 rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15301
diff changeset
91 if (integerSubNode.getY() instanceof IntegerRemNode) {
df6f2365b153 rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15301
diff changeset
92 IntegerRemNode integerRemNode = (IntegerRemNode) integerSubNode.getY();
16218
c3260b05fd26 rename x() to getX() and y() to getY() in FixedBinaryNode
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16217
diff changeset
93 if (integerSubNode.stamp().isCompatible(this.stamp()) && integerRemNode.stamp().isCompatible(this.stamp()) && integerSubNode.getX() == integerRemNode.getX() &&
16223
1434b835f0d3 implement Canonicalizable.Binary in the FixedBinaryNode hierarchy
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16218
diff changeset
94 forY == integerRemNode.getY()) {
16895
06c15e88d383 added factory method to all Node classes; replaced Node classes instantiation with calls to factory methods; replaced identity tests on Node classes with ' == <node class>.getGenClass()' idiom
Doug Simon <doug.simon@oracle.com>
parents: 16841
diff changeset
95 return IntegerDivNode.create(integerSubNode.getX(), forY);
7378
88506cfc3bab Canonicalize ((a - a % b) / b) into (a / b).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7305
diff changeset
96 }
88506cfc3bab Canonicalize ((a - a % b) / b) into (a / b).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7305
diff changeset
97 }
88506cfc3bab Canonicalize ((a - a % b) / b) into (a / b).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7305
diff changeset
98 }
88506cfc3bab Canonicalize ((a - a % b) / b) into (a / b).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7305
diff changeset
99
9449
3d309a26d4d5 Add canonicalization to interger div
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9251
diff changeset
100 if (next() instanceof IntegerDivNode) {
16986
f7359a0ce946 tweaked comparison of a Node against a node class
Doug Simon <doug.simon@oracle.com>
parents: 16919
diff changeset
101 NodeClass nodeClass = getNodeClass();
17276
ffb974bef674 moved Node valueNumber and valueEquals logic (optionally) to generated nodes
Doug Simon <doug.simon@oracle.com>
parents: 17210
diff changeset
102 if (next().getClass() == this.getClass() && nodeClass.getEdges(Inputs).areEqualIn(this, next()) && valueEquals(next())) {
9449
3d309a26d4d5 Add canonicalization to interger div
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9251
diff changeset
103 return next();
3d309a26d4d5 Add canonicalization to interger div
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9251
diff changeset
104 }
3d309a26d4d5 Add canonicalization to interger div
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9251
diff changeset
105 }
3d309a26d4d5 Add canonicalization to interger div
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9251
diff changeset
106
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
107 return this;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
108 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
109
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
110 @Override
11579
ae619d70bf4b Rename LoweringType to GuardsPhase and make it an attribute of StructuredGraphs
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11352
diff changeset
111 public void lower(LoweringTool tool) {
12045
0fc653a9e019 made GraalCodeCacheProvider independent of CodeCacheProvider and renamed the former to LoweringProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents: 11959
diff changeset
112 tool.getLowerer().lower(this, tool);
7305
cd205ca515dd Make integer division and remainder nodes fixed so that they can be lowered via snippets to do exception checks
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
113 }
cd205ca515dd Make integer division and remainder nodes fixed so that they can be lowered via snippets to do exception checks
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
114
cd205ca515dd Make integer division and remainder nodes fixed so that they can be lowered via snippets to do exception checks
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7098
diff changeset
115 @Override
14950
d5a1206e1923 NodeLIRBuilderTool: fix typo in interface name.
Josef Eisl <josef.eisl@jku.at>
parents: 14888
diff changeset
116 public void generate(NodeLIRBuilderTool gen) {
16218
c3260b05fd26 rename x() to getX() and y() to getY() in FixedBinaryNode
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16217
diff changeset
117 gen.setResult(this, gen.getLIRGeneratorTool().emitDiv(gen.operand(getX()), gen.operand(getY()), gen.state(this)));
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7378
diff changeset
118 }
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7378
diff changeset
119
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7378
diff changeset
120 @Override
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7378
diff changeset
121 public boolean canDeoptimize() {
16218
c3260b05fd26 rename x() to getX() and y() to getY() in FixedBinaryNode
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16217
diff changeset
122 return !(getY().stamp() instanceof IntegerStamp) || ((IntegerStamp) getY().stamp()).contains(0);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
123 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
124 }