1 /*
   2  * Copyright 2002-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.Assert;
  28 
  29 public class X86FloatRegisters {
  30 
  31    public static int getNumRegisters() {
  32       return NUM_REGISTERS;
  33    }
  34 
  35    public static X86FloatRegister getRegister(int regNum) {
  36       if (Assert.ASSERTS_ENABLED) {
  37          Assert.that(regNum > -1 && regNum < NUM_REGISTERS, "invalid float register number!");
  38       }
  39       return registers[regNum];
  40    }
  41 
  42    public static String getRegisterName(int i) {
  43       return "ST(" + i + ")";
  44    }
  45 
  46    public static final X86FloatRegister ST0;
  47    public static final X86FloatRegister ST1;
  48    public static final X86FloatRegister ST2;
  49    public static final X86FloatRegister ST3;
  50    public static final X86FloatRegister ST4;
  51    public static final X86FloatRegister ST5;
  52    public static final X86FloatRegister ST6;
  53    public static final X86FloatRegister ST7;
  54 
  55    public static final int NUM_REGISTERS = 8;
  56 
  57    private static final X86FloatRegister registers[];
  58 
  59    static {
  60       ST0 = new X86FloatRegister(0);
  61       ST1 = new X86FloatRegister(1);
  62       ST2 = new X86FloatRegister(2);
  63       ST3 = new X86FloatRegister(3);
  64       ST4 = new X86FloatRegister(4);
  65       ST5 = new X86FloatRegister(5);
  66       ST6 = new X86FloatRegister(6);
  67       ST7 = new X86FloatRegister(7);
  68       registers = (new X86FloatRegister[] {
  69          ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7
  70       });
  71    }
  72 }