1/*
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24package compiler.intrinsics.bmi;
25
26/**
27 * Expression that should be replaced by particular instrinsic
28 * or intruction during compilation.
29 */
30public abstract class Expr {
31
32    public static class MemI {
33        public MemI(int i) {
34            this.value = i;
35        }
36
37        public int value;
38    }
39
40    public static class MemL {
41        public MemL(long l) {
42            this.value = l;
43        }
44
45        public long value;
46    }
47
48    public boolean isUnaryArgumentSupported() {
49        return false;
50    }
51
52    public boolean isIntExprSupported() {
53        return false;
54    }
55
56    public boolean isBinaryArgumentSupported() {
57        return false;
58    }
59
60    public boolean isLongExprSupported() {
61        return false;
62    }
63
64    public boolean isMemExprSupported() {
65        return false;
66    }
67
68    public int intExpr(int reg) {
69        throw new UnsupportedOperationException();
70    }
71
72    public int intExpr(MemI mem) {
73        throw new UnsupportedOperationException();
74    }
75
76    public int intExpr(int a, int b) {
77        throw new UnsupportedOperationException();
78    }
79
80    public int intExpr(int a, MemI b) {
81        throw new UnsupportedOperationException();
82    }
83
84    public int intExpr(MemI a, int b) {
85        throw new UnsupportedOperationException();
86    }
87
88    public int intExpr(MemI a, MemI b) {
89        throw new UnsupportedOperationException();
90    }
91
92    public long longExpr(long reg) {
93        throw new UnsupportedOperationException();
94    }
95
96    public long longExpr(MemL mem) {
97        throw new UnsupportedOperationException();
98    }
99
100    public long longExpr(long a, long b) {
101        throw new UnsupportedOperationException();
102    }
103
104    public long longExpr(long a, MemL b) {
105        throw new UnsupportedOperationException();
106    }
107
108    public long longExpr(MemL a, long b) {
109        throw new UnsupportedOperationException();
110    }
111
112    public long longExpr(MemL a, MemL b) {
113        throw new UnsupportedOperationException();
114    }
115
116    public static class BMIExpr extends Expr {
117
118        public boolean isMemExprSupported() {
119            return true;
120        }
121    }
122
123    public static class BMIBinaryExpr extends BMIExpr {
124
125        public boolean isBinaryArgumentSupported() {
126            return true;
127        }
128
129    }
130
131    public static class BMIUnaryExpr extends BMIExpr {
132        public boolean isUnaryArgumentSupported() {
133            return true;
134        }
135    }
136
137    public static class BMIBinaryIntExpr extends BMIBinaryExpr {
138        public boolean isIntExprSupported() {
139            return true;
140        }
141    }
142
143    public static class BMIBinaryLongExpr extends BMIBinaryExpr {
144        public boolean isLongExprSupported() {
145            return true;
146        }
147    }
148
149    public static class BMIUnaryIntExpr extends BMIUnaryExpr {
150        public boolean isIntExprSupported() {
151            return true;
152        }
153    }
154
155    public static class BMIUnaryLongExpr extends BMIUnaryExpr {
156        public boolean isLongExprSupported() {
157            return true;
158        }
159    }
160
161    public static class BitCountingExpr extends Expr {
162        public boolean isUnaryArgumentSupported() {
163            return true;
164        }
165    }
166
167    public static class BitCountingIntExpr extends BitCountingExpr {
168        public boolean isIntExprSupported() {
169            return true;
170        }
171    }
172
173    public static class BitCountingLongExpr extends BitCountingExpr {
174        public boolean isLongExprSupported() {
175            return true;
176        }
177    }
178}
179