annotate graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConvertNode.java @ 22054:0e095e2c24e2

Rename com.oracle.jvmci to jdk.internal.jvmci
author twisti
date Mon, 22 Jun 2015 12:12:53 -0700
parents 48c1ebd24120
children 7b4a47fcc4c0
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 /*
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 17436
diff changeset
2 * Copyright (c) 2014, 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
22054
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 21556
diff changeset
25 import jdk.internal.jvmci.code.*;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 21556
diff changeset
26 import jdk.internal.jvmci.meta.*;
0e095e2c24e2 Rename com.oracle.jvmci to jdk.internal.jvmci
twisti
parents: 21556
diff changeset
27
15414
997bfb063417 Fix bug in CompareNode canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents: 15198
diff changeset
28 import com.oracle.graal.compiler.common.calc.*;
17344
98e60bdf6d05 Use ArithmeticOpTable for primitive convert operations.
Roland Schatz <roland.schatz@oracle.com>
parents: 16841
diff changeset
29 import com.oracle.graal.graph.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
30 import com.oracle.graal.nodes.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
31
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
32 /**
14000
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 12751
diff changeset
33 * Represents a conversion between primitive types.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
34 */
17344
98e60bdf6d05 Use ArithmeticOpTable for primitive convert operations.
Roland Schatz <roland.schatz@oracle.com>
parents: 16841
diff changeset
35 public interface ConvertNode extends ArithmeticOperation, NodeInterface {
98e60bdf6d05 Use ArithmeticOpTable for primitive convert operations.
Roland Schatz <roland.schatz@oracle.com>
parents: 16841
diff changeset
36
98e60bdf6d05 Use ArithmeticOpTable for primitive convert operations.
Roland Schatz <roland.schatz@oracle.com>
parents: 16841
diff changeset
37 ValueNode getValue();
12656
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
38
18720
ab9d3ff6829b Pass constant reflection into ConvertNode.convert
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18713
diff changeset
39 Constant convert(Constant c, ConstantReflectionProvider constantReflection);
11851
04b039d82e86 Simplify constant folding.
Roland Schatz <roland.schatz@oracle.com>
parents: 11579
diff changeset
40
18720
ab9d3ff6829b Pass constant reflection into ConvertNode.convert
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18713
diff changeset
41 Constant reverse(Constant c, ConstantReflectionProvider constantReflection);
14000
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 12751
diff changeset
42
15414
997bfb063417 Fix bug in CompareNode canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents: 15198
diff changeset
43 /**
997bfb063417 Fix bug in CompareNode canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents: 15198
diff changeset
44 * Check whether a conversion is lossless.
997bfb063417 Fix bug in CompareNode canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents: 15198
diff changeset
45 *
997bfb063417 Fix bug in CompareNode canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents: 15198
diff changeset
46 * @return true iff reverse(convert(c)) == c for all c
997bfb063417 Fix bug in CompareNode canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents: 15198
diff changeset
47 */
17344
98e60bdf6d05 Use ArithmeticOpTable for primitive convert operations.
Roland Schatz <roland.schatz@oracle.com>
parents: 16841
diff changeset
48 boolean isLossless();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
49
15414
997bfb063417 Fix bug in CompareNode canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents: 15198
diff changeset
50 /**
997bfb063417 Fix bug in CompareNode canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents: 15198
diff changeset
51 * Check whether a conversion preserves comparison order.
997bfb063417 Fix bug in CompareNode canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents: 15198
diff changeset
52 *
997bfb063417 Fix bug in CompareNode canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents: 15198
diff changeset
53 * @param op a comparison operator
997bfb063417 Fix bug in CompareNode canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents: 15198
diff changeset
54 * @return true iff (c1 op c2) == (convert(c1) op convert(c2)) for all c1, c2
997bfb063417 Fix bug in CompareNode canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents: 15198
diff changeset
55 */
17344
98e60bdf6d05 Use ArithmeticOpTable for primitive convert operations.
Roland Schatz <roland.schatz@oracle.com>
parents: 16841
diff changeset
56 default boolean preservesOrder(Condition op) {
15414
997bfb063417 Fix bug in CompareNode canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents: 15198
diff changeset
57 return isLossless();
997bfb063417 Fix bug in CompareNode canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents: 15198
diff changeset
58 }
997bfb063417 Fix bug in CompareNode canonicalization.
Roland Schatz <roland.schatz@oracle.com>
parents: 15198
diff changeset
59
18713
cbb097347545 Convert compare against Class to compare against Klass
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18188
diff changeset
60 /**
cbb097347545 Convert compare against Class to compare against Klass
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18188
diff changeset
61 * Check whether a conversion preserves comparison order against a particular constant value.
cbb097347545 Convert compare against Class to compare against Klass
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18188
diff changeset
62 *
cbb097347545 Convert compare against Class to compare against Klass
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18188
diff changeset
63 * @param op a comparison operator
cbb097347545 Convert compare against Class to compare against Klass
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18188
diff changeset
64 * @param value
18720
ab9d3ff6829b Pass constant reflection into ConvertNode.convert
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18713
diff changeset
65 * @param constantReflection
18713
cbb097347545 Convert compare against Class to compare against Klass
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18188
diff changeset
66 * @return true iff (c1 op value) == (convert(c1) op convert(value)) for value and all c1
cbb097347545 Convert compare against Class to compare against Klass
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18188
diff changeset
67 */
18720
ab9d3ff6829b Pass constant reflection into ConvertNode.convert
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18713
diff changeset
68 default boolean preservesOrder(Condition op, Constant value, ConstantReflectionProvider constantReflection) {
18713
cbb097347545 Convert compare against Class to compare against Klass
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18188
diff changeset
69 return preservesOrder(op);
cbb097347545 Convert compare against Class to compare against Klass
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18188
diff changeset
70 }
cbb097347545 Convert compare against Class to compare against Klass
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18188
diff changeset
71
17344
98e60bdf6d05 Use ArithmeticOpTable for primitive convert operations.
Roland Schatz <roland.schatz@oracle.com>
parents: 16841
diff changeset
72 ValueNode asNode();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
73 }