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.amd64;
  26 
  27 import sun.jvm.hotspot.utilities.Assert;
  28 
  29 public class AMD64FloatRegisters {
  30 
  31    public static int getNumRegisters() {
  32       return NUM_REGIXMMERS;
  33    }
  34 
  35    public static AMD64FloatRegister getRegister(int regNum) {
  36       if (Assert.ASSERTS_ENABLED) {
  37          Assert.that(regNum > -1 && regNum < NUM_REGIXMMERS, "invalid float register number!");
  38       }
  39       return registers[regNum];
  40    }
  41 
  42    public static String getRegisterName(int i) {
  43       return "XMM(" + i + ")";
  44    }
  45 
  46    public static final AMD64FloatRegister XMM0;
  47    public static final AMD64FloatRegister XMM1;
  48    public static final AMD64FloatRegister XMM2;
  49    public static final AMD64FloatRegister XMM3;
  50    public static final AMD64FloatRegister XMM4;
  51    public static final AMD64FloatRegister XMM5;
  52    public static final AMD64FloatRegister XMM6;
  53    public static final AMD64FloatRegister XMM7;
  54    public static final AMD64FloatRegister XMM8;
  55    public static final AMD64FloatRegister XMM9;
  56    public static final AMD64FloatRegister XMM10;
  57    public static final AMD64FloatRegister XMM11;
  58    public static final AMD64FloatRegister XMM12;
  59    public static final AMD64FloatRegister XMM13;
  60    public static final AMD64FloatRegister XMM14;
  61    public static final AMD64FloatRegister XMM15;
  62 
  63    public static final int NUM_REGIXMMERS = 16;
  64 
  65    private static final AMD64FloatRegister[] registers;
  66 
  67    static {
  68       XMM0 = new AMD64FloatRegister(0);
  69       XMM1 = new AMD64FloatRegister(1);
  70       XMM2 = new AMD64FloatRegister(2);
  71       XMM3 = new AMD64FloatRegister(3);
  72       XMM4 = new AMD64FloatRegister(4);
  73       XMM5 = new AMD64FloatRegister(5);
  74       XMM6 = new AMD64FloatRegister(6);
  75       XMM7 = new AMD64FloatRegister(7);
  76       XMM8 = new AMD64FloatRegister(8);
  77       XMM9 = new AMD64FloatRegister(9);
  78       XMM10 = new AMD64FloatRegister(10);
  79       XMM11 = new AMD64FloatRegister(11);
  80       XMM12 = new AMD64FloatRegister(12);
  81       XMM13 = new AMD64FloatRegister(13);
  82       XMM14 = new AMD64FloatRegister(14);
  83       XMM15 = new AMD64FloatRegister(15);
  84 
  85       registers = new AMD64FloatRegister[] {
  86                      XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
  87                      XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15
  88                   };
  89    }
  90 }