annotate graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/calc/Condition.java @ 15200:97eed257999b

Move Condition to graal.compiler.common.
author Josef Eisl <josef.eisl@jku.at>
date Thu, 17 Apr 2014 18:12:12 +0200
parents graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java@96bb07a5d667
children 7d9c2a7f6ec9
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 /*
15200
97eed257999b Move Condition to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
2 * Copyright (c) 2009, 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 */
15200
97eed257999b Move Condition to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
23 package com.oracle.graal.compiler.common.calc;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
5510
426c605c9d3c Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
25 import com.oracle.graal.api.code.*;
5507
dc71b06d09f8 Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5502
diff changeset
26 import com.oracle.graal.api.meta.*;
15193
96bb07a5d667 Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents: 13488
diff changeset
27 import com.oracle.graal.compiler.common.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
29 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
30 * Condition codes used in conditionals.
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 public enum Condition {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
34 * Equal.
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 EQ("=="),
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
37
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
38 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
39 * Not equal.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
40 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
41 NE("!="),
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
42
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
43 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
44 * Signed less than.
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 LT("<"),
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47
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 * Signed less than or equal.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
50 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
51 LE("<="),
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
52
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
53 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54 * Signed greater than.
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
55 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56 GT(">"),
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
57
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
58 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
59 * Signed greater than or equal.
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 GE(">="),
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
62
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
63 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
64 * Unsigned greater than or equal ("above than or equal").
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
65 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
66 AE("|>=|"),
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
67
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
68 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
69 * Unsigned less than or equal ("below than or equal").
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 BE("|<=|"),
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
72
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 * Unsigned greater than ("above than").
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
75 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
76 AT("|>|"),
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
77
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
78 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
79 * Unsigned less than ("below than").
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
80 */
5402
80127e4a1742 remove Condition.OF and Condition.NOF
Lukas Stadler <lukas.stadler@jku.at>
parents: 5077
diff changeset
81 BT("|<|");
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
82
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
83 public final String operator;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
84
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
85 private Condition(String operator) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
86 this.operator = operator;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
87 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
88
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
89 public boolean check(int left, int right) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
90 switch (this) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
91 case EQ:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
92 return left == right;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
93 case NE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
94 return left != right;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
95 case LT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
96 return left < right;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
97 case LE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
98 return left <= right;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
99 case GT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
100 return left > right;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
101 case GE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
102 return left >= right;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
103 case AE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
104 return UnsignedMath.aboveOrEqual(left, right);
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
105 case BE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
106 return UnsignedMath.belowOrEqual(left, right);
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
107 case AT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
108 return UnsignedMath.aboveThan(left, right);
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
109 case BT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
110 return UnsignedMath.belowThan(left, right);
5402
80127e4a1742 remove Condition.OF and Condition.NOF
Lukas Stadler <lukas.stadler@jku.at>
parents: 5077
diff changeset
111 }
80127e4a1742 remove Condition.OF and Condition.NOF
Lukas Stadler <lukas.stadler@jku.at>
parents: 5077
diff changeset
112 throw new IllegalArgumentException(this.toString());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
113 }
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 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
116 * Given a condition and its negation, this method returns true for one of the two and false for
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
117 * the other one. This can be used to keep comparisons in a canonical form.
15200
97eed257999b Move Condition to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
118 *
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
119 * @return true if this condition is considered to be the canonical form, false otherwise.
5405
136e9e8daf3d changes to Condition: more canonicalization support, foldCondition always returns a result
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
120 */
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
121 public boolean isCanonical() {
5405
136e9e8daf3d changes to Condition: more canonicalization support, foldCondition always returns a result
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
122 switch (this) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
123 case EQ:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
124 return true;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
125 case NE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
126 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
127 case LT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
128 return true;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
129 case LE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
130 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
131 case GT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
132 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
133 case GE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
134 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
135 case BT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
136 return true;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
137 case BE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
138 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
139 case AT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
140 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
141 case AE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
142 return false;
5405
136e9e8daf3d changes to Condition: more canonicalization support, foldCondition always returns a result
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
143 }
136e9e8daf3d changes to Condition: more canonicalization support, foldCondition always returns a result
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
144 throw new IllegalArgumentException(this.toString());
136e9e8daf3d changes to Condition: more canonicalization support, foldCondition always returns a result
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
145 }
136e9e8daf3d changes to Condition: more canonicalization support, foldCondition always returns a result
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
146
136e9e8daf3d changes to Condition: more canonicalization support, foldCondition always returns a result
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
147 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
148 * Returns true if the condition needs to be mirrored to get to a canonical condition. The
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
149 * result of the mirroring operation might still need to be negated to achieve a canonical form.
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
150 */
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
151 public boolean canonicalMirror() {
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
152 switch (this) {
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
153 case EQ:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
154 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
155 case NE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
156 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
157 case LT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
158 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
159 case LE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
160 return true;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
161 case GT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
162 return true;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
163 case GE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
164 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
165 case BT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
166 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
167 case BE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
168 return true;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
169 case AT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
170 return true;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
171 case AE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
172 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
173 }
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
174 throw new IllegalArgumentException(this.toString());
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
175 }
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
176
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
177 /**
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
178 * Returns true if the condition needs to be negated to get to a canonical condition. The result
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
179 * of the negation might still need to be mirrored to achieve a canonical form.
5405
136e9e8daf3d changes to Condition: more canonicalization support, foldCondition always returns a result
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
180 */
136e9e8daf3d changes to Condition: more canonicalization support, foldCondition always returns a result
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
181 public boolean canonicalNegate() {
136e9e8daf3d changes to Condition: more canonicalization support, foldCondition always returns a result
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
182 switch (this) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
183 case EQ:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
184 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
185 case NE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
186 return true;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
187 case LT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
188 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
189 case LE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
190 return true;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
191 case GT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
192 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
193 case GE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
194 return true;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
195 case BT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
196 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
197 case BE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
198 return true;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
199 case AT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
200 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
201 case AE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
202 return true;
5405
136e9e8daf3d changes to Condition: more canonicalization support, foldCondition always returns a result
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
203 }
136e9e8daf3d changes to Condition: more canonicalization support, foldCondition always returns a result
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
204 throw new IllegalArgumentException(this.toString());
136e9e8daf3d changes to Condition: more canonicalization support, foldCondition always returns a result
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
205 }
136e9e8daf3d changes to Condition: more canonicalization support, foldCondition always returns a result
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
206
136e9e8daf3d changes to Condition: more canonicalization support, foldCondition always returns a result
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
207 /**
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
208 * Negate this conditional.
15200
97eed257999b Move Condition to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
209 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
210 * @return the condition that represents the negation
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
211 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
212 public final Condition negate() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
213 switch (this) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
214 case EQ:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
215 return NE;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
216 case NE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
217 return EQ;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
218 case LT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
219 return GE;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
220 case LE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
221 return GT;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
222 case GT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
223 return LE;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
224 case GE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
225 return LT;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
226 case BT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
227 return AE;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
228 case BE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
229 return AT;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
230 case AT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
231 return BE;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
232 case AE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
233 return BT;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
234 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
235 throw new IllegalArgumentException(this.toString());
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
236 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
237
4650
8e39bd349bbb added Condition.implies(...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 4550
diff changeset
238 public boolean implies(Condition other) {
8e39bd349bbb added Condition.implies(...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 4550
diff changeset
239 if (other == this) {
8e39bd349bbb added Condition.implies(...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 4550
diff changeset
240 return true;
8e39bd349bbb added Condition.implies(...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 4550
diff changeset
241 }
8e39bd349bbb added Condition.implies(...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 4550
diff changeset
242 switch (this) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
243 case EQ:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
244 return other == LE || other == GE || other == BE || other == AE;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
245 case NE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
246 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
247 case LT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
248 return other == LE || other == NE;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
249 case LE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
250 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
251 case GT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
252 return other == GE || other == NE;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
253 case GE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
254 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
255 case BT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
256 return other == BE || other == NE;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
257 case BE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
258 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
259 case AT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
260 return other == AE || other == NE;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
261 case AE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
262 return false;
4650
8e39bd349bbb added Condition.implies(...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 4550
diff changeset
263 }
8e39bd349bbb added Condition.implies(...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 4550
diff changeset
264 throw new IllegalArgumentException(this.toString());
8e39bd349bbb added Condition.implies(...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 4550
diff changeset
265 }
8e39bd349bbb added Condition.implies(...)
Lukas Stadler <lukas.stadler@jku.at>
parents: 4550
diff changeset
266
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
267 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
268 * Mirror this conditional (i.e. commute "a op b" to "b op' a")
15200
97eed257999b Move Condition to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
269 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
270 * @return the condition representing the equivalent commuted operation
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
271 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
272 public final Condition mirror() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
273 switch (this) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
274 case EQ:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
275 return EQ;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
276 case NE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
277 return NE;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
278 case LT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
279 return GT;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
280 case LE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
281 return GE;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
282 case GT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
283 return LT;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
284 case GE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
285 return LE;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
286 case BT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
287 return AT;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
288 case BE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
289 return AE;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
290 case AT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
291 return BT;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
292 case AE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
293 return BE;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
294 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
295 throw new IllegalArgumentException();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
296 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
297
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
298 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
299 * Returns true if this condition represents an unsigned comparison. EQ and NE are not
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
300 * considered to be unsigned.
5425
0364a2a874b8 changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5405
diff changeset
301 */
0364a2a874b8 changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5405
diff changeset
302 public final boolean isUnsigned() {
0364a2a874b8 changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5405
diff changeset
303 return this == Condition.BT || this == Condition.BE || this == Condition.AT || this == Condition.AE;
0364a2a874b8 changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5405
diff changeset
304 }
0364a2a874b8 changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5405
diff changeset
305
0364a2a874b8 changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5405
diff changeset
306 /**
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
307 * Checks if this conditional operation is commutative.
15200
97eed257999b Move Condition to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
308 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
309 * @return {@code true} if this operation is commutative
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
310 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
311 public final boolean isCommutative() {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
312 return this == EQ || this == NE;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
313 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
314
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
315 /**
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
316 * Attempts to fold a comparison between two constants and return the result.
15200
97eed257999b Move Condition to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
317 *
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
318 * @param lt the constant on the left side of the comparison
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
319 * @param rt the constant on the right side of the comparison
12052
0afe7370260c refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents: 11959
diff changeset
320 * @param constantReflection needed to compare constants
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
321 * @return {@link Boolean#TRUE} if the comparison is known to be true, {@link Boolean#FALSE} if
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
322 * the comparison is known to be false
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
323 */
12052
0afe7370260c refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents: 11959
diff changeset
324 public boolean foldCondition(Constant lt, Constant rt, ConstantReflectionProvider constantReflection) {
12695
4aec62c32a82 Helper functions for identifying numeric kinds.
Roland Schatz <roland.schatz@oracle.com>
parents: 12052
diff changeset
325 assert !lt.getKind().isNumericFloat() && !rt.getKind().isNumericFloat();
12052
0afe7370260c refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents: 11959
diff changeset
326 return foldCondition(lt, rt, constantReflection, false);
5425
0364a2a874b8 changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5405
diff changeset
327 }
0364a2a874b8 changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5405
diff changeset
328
0364a2a874b8 changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5405
diff changeset
329 /**
0364a2a874b8 changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5405
diff changeset
330 * Attempts to fold a comparison between two constants and return the result.
15200
97eed257999b Move Condition to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
331 *
5425
0364a2a874b8 changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5405
diff changeset
332 * @param lt the constant on the left side of the comparison
0364a2a874b8 changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5405
diff changeset
333 * @param rt the constant on the right side of the comparison
12052
0afe7370260c refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents: 11959
diff changeset
334 * @param constantReflection needed to compare constants
5425
0364a2a874b8 changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5405
diff changeset
335 * @param unorderedIsTrue true if an undecided float comparison should result in "true"
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
336 * @return true if the comparison is known to be true, false if the comparison is known to be
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
337 * false
5425
0364a2a874b8 changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents: 5405
diff changeset
338 */
12052
0afe7370260c refactored constantEquals(), lookupArrayLength() and readUnsafeConstant() out of MetaAccessProvider into ConstantReflectionProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents: 11959
diff changeset
339 public boolean foldCondition(Constant lt, Constant rt, ConstantReflectionProvider constantReflection, boolean unorderedIsTrue) {
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5775
diff changeset
340 switch (lt.getKind()) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
341 case Boolean:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
342 case Byte:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
343 case Char:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
344 case Short:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
345 case Int: {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
346 int x = lt.asInt();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
347 int y = rt.asInt();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
348 switch (this) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
349 case EQ:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
350 return x == y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
351 case NE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
352 return x != y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
353 case LT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
354 return x < y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
355 case LE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
356 return x <= y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
357 case GT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
358 return x > y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
359 case GE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
360 return x >= y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
361 case AE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
362 return UnsignedMath.aboveOrEqual(x, y);
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
363 case BE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
364 return UnsignedMath.belowOrEqual(x, y);
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
365 case AT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
366 return UnsignedMath.aboveThan(x, y);
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
367 case BT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
368 return UnsignedMath.belowThan(x, y);
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
369 default:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
370 throw new GraalInternalError("expected condition: %s", this);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
371 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
372 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
373 case Long: {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
374 long x = lt.asLong();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
375 long y = rt.asLong();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
376 switch (this) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
377 case EQ:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
378 return x == y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
379 case NE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
380 return x != y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
381 case LT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
382 return x < y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
383 case LE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
384 return x <= y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
385 case GT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
386 return x > y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
387 case GE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
388 return x >= y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
389 case AE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
390 return UnsignedMath.aboveOrEqual(x, y);
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
391 case BE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
392 return UnsignedMath.belowOrEqual(x, y);
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
393 case AT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
394 return UnsignedMath.aboveThan(x, y);
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
395 case BT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
396 return UnsignedMath.belowThan(x, y);
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
397 default:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
398 throw new GraalInternalError("expected condition: %s", this);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
399 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
400 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
401 case Object: {
13488
83adefeb8e5c The runtime cannot always compare two constants
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
402 Boolean equal = constantReflection.constantEquals(lt, rt);
83adefeb8e5c The runtime cannot always compare two constants
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
403 if (equal != null) {
83adefeb8e5c The runtime cannot always compare two constants
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
404 switch (this) {
83adefeb8e5c The runtime cannot always compare two constants
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
405 case EQ:
83adefeb8e5c The runtime cannot always compare two constants
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
406 return equal.booleanValue();
83adefeb8e5c The runtime cannot always compare two constants
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
407 case NE:
83adefeb8e5c The runtime cannot always compare two constants
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
408 return !equal.booleanValue();
83adefeb8e5c The runtime cannot always compare two constants
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
409 default:
83adefeb8e5c The runtime cannot always compare two constants
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
410 throw new GraalInternalError("expected condition: %s", this);
83adefeb8e5c The runtime cannot always compare two constants
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
411 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
412 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
413 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
414 case Float: {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
415 float x = lt.asFloat();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
416 float y = rt.asFloat();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
417 if (Float.isNaN(x) || Float.isNaN(y)) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
418 return unorderedIsTrue;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
419 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
420 switch (this) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
421 case EQ:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
422 return x == y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
423 case NE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
424 return x != y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
425 case LT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
426 return x < y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
427 case LE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
428 return x <= y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
429 case GT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
430 return x > y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
431 case GE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
432 return x >= y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
433 default:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
434 throw new GraalInternalError("expected condition: %s", this);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
435 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
436 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
437 case Double: {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
438 double x = lt.asDouble();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
439 double y = rt.asDouble();
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
440 if (Double.isNaN(x) || Double.isNaN(y)) {
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
441 return unorderedIsTrue;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
442 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
443 switch (this) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
444 case EQ:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
445 return x == y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
446 case NE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
447 return x != y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
448 case LT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
449 return x < y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
450 case LE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
451 return x <= y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
452 case GT:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
453 return x > y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
454 case GE:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
455 return x >= y;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
456 default:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
457 throw new GraalInternalError("expected condition: %s", this);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
458 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
459 }
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
460 default:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7098
diff changeset
461 throw new GraalInternalError("expected value kind %s while folding condition: %s", lt.getKind(), this);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
462 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
463 }
4671
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
464
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
465 public Condition join(Condition other) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
466 if (other == this) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
467 return this;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
468 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
469 switch (this) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
470 case EQ:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
471 if (other == LE || other == GE || other == BE || other == AE) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
472 return EQ;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
473 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
474 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
475 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
476 case NE:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
477 if (other == LT || other == GT || other == BT || other == AT) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
478 return other;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
479 } else if (other == LE) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
480 return LT;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
481 } else if (other == GE) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
482 return GT;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
483 } else if (other == BE) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
484 return BT;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
485 } else if (other == AE) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
486 return AT;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
487 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
488 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
489 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
490 case LE:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
491 if (other == GE || other == EQ) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
492 return EQ;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
493 } else if (other == NE || other == LT) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
494 return LT;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
495 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
496 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
497 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
498 case LT:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
499 if (other == NE || other == LE) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
500 return LT;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
501 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
502 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
503 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
504 case GE:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
505 if (other == LE || other == EQ) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
506 return EQ;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
507 } else if (other == NE || other == GT) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
508 return GT;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
509 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
510 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
511 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
512 case GT:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
513 if (other == NE || other == GE) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
514 return GT;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
515 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
516 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
517 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
518 case BE:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
519 if (other == AE || other == EQ) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
520 return EQ;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
521 } else if (other == NE || other == BT) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
522 return BT;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
523 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
524 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
525 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
526 case BT:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
527 if (other == NE || other == BE) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
528 return BT;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
529 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
530 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
531 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
532 case AE:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
533 if (other == BE || other == EQ) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
534 return EQ;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
535 } else if (other == NE || other == AT) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
536 return AT;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
537 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
538 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
539 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
540 case AT:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
541 if (other == NE || other == AE) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
542 return AT;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
543 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
544 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
545 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
546 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
547 throw new IllegalArgumentException(this.toString());
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
548 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
549
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
550 public Condition meet(Condition other) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
551 if (other == this) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
552 return this;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
553 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
554 switch (this) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
555 case EQ:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
556 if (other == LE || other == GE || other == BE || other == AE) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
557 return other;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
558 } else if (other == LT) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
559 return LE;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
560 } else if (other == GT) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
561 return GE;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
562 } else if (other == BT) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
563 return BE;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
564 } else if (other == AT) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
565 return AE;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
566 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
567 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
568 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
569 case NE:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
570 if (other == LT || other == GT || other == BT || other == AT) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
571 return NE;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
572 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
573 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
574 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
575 case LE:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
576 if (other == EQ || other == LT) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
577 return LE;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
578 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
579 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
580 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
581 case LT:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
582 if (other == EQ || other == LE) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
583 return LE;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
584 } else if (other == NE || other == GT) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
585 return NE;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
586 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
587 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
588 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
589 case GE:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
590 if (other == EQ || other == GT) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
591 return GE;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
592 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
593 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
594 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
595 case GT:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
596 if (other == EQ || other == GE) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
597 return GE;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
598 } else if (other == NE || other == LT) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
599 return NE;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
600 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
601 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
602 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
603 case BE:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
604 if (other == EQ || other == BT) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
605 return BE;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
606 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
607 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
608 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
609 case BT:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
610 if (other == EQ || other == BE) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
611 return BE;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
612 } else if (other == NE || other == AT) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
613 return NE;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
614 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
615 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
616 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
617 case AE:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
618 if (other == EQ || other == AT) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
619 return AE;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
620 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
621 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
622 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
623 case AT:
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
624 if (other == EQ || other == AE) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
625 return AE;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
626 } else if (other == NE || other == BT) {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
627 return NE;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
628 } else {
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
629 return null;
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
630 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
631 }
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
632 throw new IllegalArgumentException(this.toString());
70b7b7071e68 add Condition.join, Condition.meet and tests
Lukas Stadler <lukas.stadler@jku.at>
parents: 4650
diff changeset
633 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
634 }