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