comparison agent/src/share/classes/sun/jvm/hotspot/asm/amd64/AMD64Registers.java @ 0:a61af66fc99e jdk7-b24

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children c18cbe5936b8
comparison
equal deleted inserted replaced
-1:000000000000 0:a61af66fc99e
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.*;
28
29 public class AMD64Registers {
30 public static final int NUM_REGISTERS = 16;
31
32 public static final AMD64Register RAX;
33 public static final AMD64Register RCX;
34 public static final AMD64Register RDX;
35 public static final AMD64Register RBX;
36 public static final AMD64Register RSP;
37 public static final AMD64Register RBP;
38 public static final AMD64Register RSI;
39 public static final AMD64Register RDI;
40 public static final AMD64Register R8;
41 public static final AMD64Register R9;
42 public static final AMD64Register R10;
43 public static final AMD64Register R11;
44 public static final AMD64Register R12;
45 public static final AMD64Register R13;
46 public static final AMD64Register R14;
47 public static final AMD64Register R15;
48
49 private static final AMD64Register[] registers;
50
51 static {
52 RAX = new AMD64Register(0, "rax");
53 RCX = new AMD64Register(1, "rcx");
54 RDX = new AMD64Register(2, "rdx");
55 RBX = new AMD64Register(3, "rbx");
56 RSP = new AMD64Register(4, "rsp");
57 RBP = new AMD64Register(5, "rbp");
58 RSI = new AMD64Register(6, "rsi");
59 RDI = new AMD64Register(7, "rdi");
60 R8 = new AMD64Register(8, "r8" );
61 R9 = new AMD64Register(9, "r9" );
62 R10 = new AMD64Register(10,"r10");
63 R11 = new AMD64Register(11,"r11");
64 R12 = new AMD64Register(12,"r12");
65 R13 = new AMD64Register(13,"r13");
66 R14 = new AMD64Register(14,"r14");
67 R15 = new AMD64Register(15,"r15");
68 registers = new AMD64Register[] {
69 RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI,
70 R8, R9, R10, R11, R12, R13, R14, R15
71 };
72 }
73
74 public static int getNumberOfRegisters() {
75 return NUM_REGISTERS;
76 }
77
78 public static AMD64Register getRegister(int regNum) {
79 if (Assert.ASSERTS_ENABLED) {
80 Assert.that(regNum > -1 && regNum < NUM_REGISTERS, "invalid integer register number!");
81 }
82 return registers[regNum];
83 }
84
85 //Return the register name
86 public static String getRegisterName(int regNum) {
87 if (Assert.ASSERTS_ENABLED) {
88 Assert.that(regNum > -1 && regNum < NUM_REGISTERS, "invalid integer register number!");
89 }
90 return registers[regNum].toString();
91 }
92 }