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 */ 24 25 package compiler.intrinsics.bmi; 26 27 /** 28 * Expression that should be replaced by particular instrinsic 29 * or intruction during compilation. 30 */ 31 public abstract class Expr { 32 33 public static class MemI { 34 public MemI(int i) { 35 this.value = i; 36 } 37 38 public int value; 39 } 40 41 public static class MemL { 42 public MemL(long l) { 43 this.value = l; 44 } 45 46 public long value; 47 } 48 49 public boolean isUnaryArgumentSupported() { 50 return false; 51 } 52 53 public boolean isIntExprSupported() { 54 return false; 55 } 56 57 public boolean isBinaryArgumentSupported() { 58 return false; 59 } 60 61 public boolean isLongExprSupported() { 62 return false; 63 } 64 65 public boolean isMemExprSupported() { 66 return false; 67 } 68 69 public int intExpr(int reg) { 70 throw new UnsupportedOperationException(); 71 } 72 73 public int intExpr(MemI mem) { 74 throw new UnsupportedOperationException(); 75 } 76 77 public int intExpr(int a, int b) { 78 throw new UnsupportedOperationException(); 79 } 80 81 public int intExpr(int a, MemI b) { 82 throw new UnsupportedOperationException(); 83 } 84 85 public int intExpr(MemI a, int b) { 86 throw new UnsupportedOperationException(); 87 } 88 89 public int intExpr(MemI a, MemI b) { 90 throw new UnsupportedOperationException(); 91 } 92 93 public long longExpr(long reg) { 94 throw new UnsupportedOperationException(); 95 } 96 97 public long longExpr(MemL mem) { 98 throw new UnsupportedOperationException(); 99 } 100 101 public long longExpr(long a, long b) { 102 throw new UnsupportedOperationException(); 103 } 104 105 public long longExpr(long a, MemL b) { 106 throw new UnsupportedOperationException(); 107 } 108 109 public long longExpr(MemL a, long b) { 110 throw new UnsupportedOperationException(); 111 } 112 113 public long longExpr(MemL a, MemL b) { 114 throw new UnsupportedOperationException(); 115 } 116 117 public static class BMIExpr extends Expr { 118 119 public boolean isMemExprSupported() { 120 return true; 121 } 122 } 123 124 public static class BMIBinaryExpr extends BMIExpr { 125 126 public boolean isBinaryArgumentSupported() { 127 return true; 128 } 129 130 } 131 132 public static class BMIUnaryExpr extends BMIExpr { 133 public boolean isUnaryArgumentSupported() { 134 return true; 135 } 136 } 137 138 public static class BMIBinaryIntExpr extends BMIBinaryExpr { 139 public boolean isIntExprSupported() { 140 return true; 141 } 142 } 143 144 public static class BMIBinaryLongExpr extends BMIBinaryExpr { 145 public boolean isLongExprSupported() { 146 return true; 147 } 148 } 149 150 public static class BMIUnaryIntExpr extends BMIUnaryExpr { 151 public boolean isIntExprSupported() { 152 return true; 153 } 154 } 155 156 public static class BMIUnaryLongExpr extends BMIUnaryExpr { 157 public boolean isLongExprSupported() { 158 return true; 159 } 160 } 161 162 public static class BitCountingExpr extends Expr { 163 public boolean isUnaryArgumentSupported() { 164 return true; 165 } 166 } 167 168 public static class BitCountingIntExpr extends BitCountingExpr { 169 public boolean isIntExprSupported() { 170 return true; 171 } 172 } 173 174 public static class BitCountingLongExpr extends BitCountingExpr { 175 public boolean isLongExprSupported() { 176 return true; 177 } 178 } 179 }