1 /* 2 * Copyright 2003 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 20 * CA 95054 USA or visit www.sun.com if you need additional information or 21 * have any questions. 22 * 23 */ 24 25 package sun.jvm.hotspot.asm.x86; 26 27 import sun.jvm.hotspot.utilities.*; 28 29 /* There are 8 128-bit XMM registers*/ 30 31 public class X86XMMRegisters { 32 33 public static final int NUM_XMM_REGISTERS = 8; 34 35 public static final X86XMMRegister XMM0; 36 public static final X86XMMRegister XMM1; 37 public static final X86XMMRegister XMM2; 38 public static final X86XMMRegister XMM3; 39 public static final X86XMMRegister XMM4; 40 public static final X86XMMRegister XMM5; 41 public static final X86XMMRegister XMM6; 42 public static final X86XMMRegister XMM7; 43 44 private static X86XMMRegister xmmRegisters[]; 45 46 static { 47 //XMM registers 48 XMM0 = new X86XMMRegister(0, "%xmm0"); 49 XMM1 = new X86XMMRegister(1, "%xmm1"); 50 XMM2 = new X86XMMRegister(2, "%xmm2"); 51 XMM3 = new X86XMMRegister(3, "%xmm3"); 52 XMM4 = new X86XMMRegister(4, "%xmm4"); 53 XMM5 = new X86XMMRegister(5, "%xmm5"); 54 XMM6 = new X86XMMRegister(6, "%xmm6"); 55 XMM7 = new X86XMMRegister(7, "%xmm7"); 56 57 xmmRegisters = (new X86XMMRegister[] { 58 XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7 59 }); 60 } 61 62 public static int getNumberOfRegisters() { 63 return NUM_XMM_REGISTERS; 64 } 65 66 //Return the register name 67 public static String getRegisterName(int regNum) { 68 if (Assert.ASSERTS_ENABLED) { 69 Assert.that(regNum > -1 && regNum < NUM_XMM_REGISTERS, "invalid XMM register number!"); 70 } 71 return xmmRegisters[regNum].toString(); 72 } 73 74 public static X86XMMRegister getRegister(int regNum) { 75 if (Assert.ASSERTS_ENABLED) { 76 Assert.that(regNum > -1 && regNum < NUM_XMM_REGISTERS, "invalid XMM register number!"); 77 } 78 return xmmRegisters[regNum]; 79 } 80 }