Mercurial > hg > graal-jvmci-8
diff jvmci/jdk.vm.ci.sparc/src/jdk/vm/ci/sparc/SPARCKind.java @ 22672:1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Thu, 08 Oct 2015 17:28:41 -0700 |
parents | jvmci/jdk.internal.jvmci.sparc/src/jdk/internal/jvmci/sparc/SPARCKind.java@111882d99400 |
children | 5ba5ff0fda9e |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jvmci/jdk.vm.ci.sparc/src/jdk/vm/ci/sparc/SPARCKind.java Thu Oct 08 17:28:41 2015 -0700 @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jdk.vm.ci.sparc; + +import jdk.vm.ci.meta.PlatformKind; + +public enum SPARCKind implements PlatformKind { + BYTE(1), + HWORD(2), + WORD(4), + DWORD(8), + SINGLE(4), + DOUBLE(8), + + V32_BYTE(4, BYTE), + V32_HWORD(4, HWORD), + + V64_BYTE(8, BYTE), + V64_HWORD(8, HWORD), + V64_WORD(8, WORD), + V64_SINGLE(8, SINGLE); + + private final int size; + private final int vectorLength; + + private final SPARCKind scalar; + private final EnumKey<SPARCKind> key = new EnumKey<>(this); + + private SPARCKind(int size) { + this.size = size; + this.scalar = this; + this.vectorLength = 1; + } + + private SPARCKind(int size, SPARCKind scalar) { + this.size = size; + this.scalar = scalar; + + assert size % scalar.size == 0; + this.vectorLength = size / scalar.size; + } + + public SPARCKind getScalar() { + return scalar; + } + + public int getSizeInBytes() { + return size; + } + + public int getSizeInBits() { + return getSizeInBytes() * 8; + } + + public int getVectorLength() { + return vectorLength; + } + + public Key getKey() { + return key; + } + + public boolean isInteger() { + switch (this) { + case BYTE: + case HWORD: + case WORD: + case DWORD: + return true; + default: + return false; + } + } + + public boolean isFloat() { + return !isInteger(); + } + + public char getTypeChar() { + switch (this) { + case BYTE: + return 'b'; + case HWORD: + return 'h'; + case WORD: + return 'w'; + case DWORD: + return 'd'; + case SINGLE: + return 'S'; + case DOUBLE: + case V64_BYTE: + case V64_HWORD: + case V64_WORD: + return 'D'; + default: + return '-'; + } + } +}