comparison agent/src/share/classes/sun/jvm/hotspot/asm/sparc/SPARCRegisters.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 2000-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.sparc;
26
27 import sun.jvm.hotspot.utilities.*;
28
29 public class SPARCRegisters {
30
31 public static final SPARCRegister G0;
32 public static final SPARCRegister G1;
33 public static final SPARCRegister G2;
34 public static final SPARCRegister G3;
35 public static final SPARCRegister G4;
36 public static final SPARCRegister G5;
37 public static final SPARCRegister G6;
38 public static final SPARCRegister G7;
39 public static final SPARCRegister O0;
40 public static final SPARCRegister O1;
41 public static final SPARCRegister O2;
42 public static final SPARCRegister O3;
43 public static final SPARCRegister O4;
44 public static final SPARCRegister O5;
45 public static final SPARCRegister O6;
46 public static final SPARCRegister O7;
47 public static final SPARCRegister L0;
48 public static final SPARCRegister L1;
49 public static final SPARCRegister L2;
50 public static final SPARCRegister L3;
51 public static final SPARCRegister L4;
52 public static final SPARCRegister L5;
53 public static final SPARCRegister L6;
54 public static final SPARCRegister L7;
55 public static final SPARCRegister I0;
56 public static final SPARCRegister I1;
57 public static final SPARCRegister I2;
58 public static final SPARCRegister I3;
59 public static final SPARCRegister I4;
60 public static final SPARCRegister I5;
61 public static final SPARCRegister I6;
62 public static final SPARCRegister I7;
63
64 private static String registerNames[];
65 public static final int NUM_REGISTERS = 32;
66 private static SPARCRegister registers[];
67
68 static {
69 G0 = new SPARCRegister(0);
70 G1 = new SPARCRegister(1);
71 G2 = new SPARCRegister(2);
72 G3 = new SPARCRegister(3);
73 G4 = new SPARCRegister(4);
74 G5 = new SPARCRegister(5);
75 G6 = new SPARCRegister(6);
76 G7 = new SPARCRegister(7);
77 O0 = new SPARCRegister(8);
78 O1 = new SPARCRegister(9);
79 O2 = new SPARCRegister(10);
80 O3 = new SPARCRegister(11);
81 O4 = new SPARCRegister(12);
82 O5 = new SPARCRegister(13);
83 O6 = new SPARCRegister(14);
84 O7 = new SPARCRegister(15);
85 L0 = new SPARCRegister(16);
86 L1 = new SPARCRegister(17);
87 L2 = new SPARCRegister(18);
88 L3 = new SPARCRegister(19);
89 L4 = new SPARCRegister(20);
90 L5 = new SPARCRegister(21);
91 L6 = new SPARCRegister(22);
92 L7 = new SPARCRegister(23);
93 I0 = new SPARCRegister(24);
94 I1 = new SPARCRegister(25);
95 I2 = new SPARCRegister(26);
96 I3 = new SPARCRegister(27);
97 I4 = new SPARCRegister(28);
98 I5 = new SPARCRegister(29);
99 I6 = new SPARCRegister(30);
100 I7 = new SPARCRegister(31);
101 registerNames = new String[NUM_REGISTERS];
102 registerNames[G0.getNumber()] = "%g0";
103 registerNames[G1.getNumber()] = "%g1";
104 registerNames[G2.getNumber()] = "%g2";
105 registerNames[G3.getNumber()] = "%g3";
106 registerNames[G4.getNumber()] = "%g4";
107 registerNames[G5.getNumber()] = "%g5";
108 registerNames[G6.getNumber()] = "%g6";
109 registerNames[G7.getNumber()] = "%g7";
110 registerNames[O0.getNumber()] = "%o0";
111 registerNames[O1.getNumber()] = "%o1";
112 registerNames[O2.getNumber()] = "%o2";
113 registerNames[O3.getNumber()] = "%o3";
114 registerNames[O4.getNumber()] = "%o4";
115 registerNames[O5.getNumber()] = "%o5";
116 registerNames[O6.getNumber()] = "%sp";
117 registerNames[O7.getNumber()] = "%o7";
118 registerNames[I0.getNumber()] = "%i0";
119 registerNames[I1.getNumber()] = "%i1";
120 registerNames[I2.getNumber()] = "%i2";
121 registerNames[I3.getNumber()] = "%i3";
122 registerNames[I4.getNumber()] = "%i4";
123 registerNames[I5.getNumber()] = "%i5";
124 registerNames[I6.getNumber()] = "%fp";
125 registerNames[I7.getNumber()] = "%i7";
126 registerNames[L0.getNumber()] = "%l0";
127 registerNames[L1.getNumber()] = "%l1";
128 registerNames[L2.getNumber()] = "%l2";
129 registerNames[L3.getNumber()] = "%l3";
130 registerNames[L4.getNumber()] = "%l4";
131 registerNames[L5.getNumber()] = "%l5";
132 registerNames[L6.getNumber()] = "%l6";
133 registerNames[L7.getNumber()] = "%l7";
134 registers = (new SPARCRegister[] {
135 G0, G1, G2, G3, G4, G5, G6, G7, O0, O1,
136 O2, O3, O4, O5, O6, O7, L0, L1, L2, L3,
137 L4, L5, L6, L7, I0, I1, I2, I3, I4, I5,
138 I6, I7
139 });
140 }
141
142 public static final SPARCRegister FP = I6;
143 public static final SPARCRegister SP = O6;
144
145 // Interpreter frames
146
147 public static final SPARCRegister Lesp = L0; // expression stack pointer
148 public static final SPARCRegister Lbcp = L1; // pointer to next bytecode
149 public static final SPARCRegister Lmethod = L2;
150 public static final SPARCRegister Llocals = L3;
151 public static final SPARCRegister Lmonitors = L4;
152 public static final SPARCRegister Lbyte_code = L5;
153 public static final SPARCRegister Lscratch = L5;
154 public static final SPARCRegister Lscratch2 = L6;
155 public static final SPARCRegister LcpoolCache = L6; // constant pool cache
156
157 public static final SPARCRegister OparamAddr = O0; // Callers Parameter area address
158 public static final SPARCRegister IsavedSP = I5; // Saved SP before bumping for locals
159 public static final SPARCRegister IsizeCalleeParms = I4; // Saved size of Callee parms used to pop arguments
160 public static final SPARCRegister IdispatchAddress = I3; // Register which saves the dispatch address for each bytecode
161 public static final SPARCRegister IdispatchTables = I2; // Base address of the bytecode dispatch tables
162
163
164 /** Prefer to use this instead of the constant above */
165 public static int getNumRegisters() {
166 return NUM_REGISTERS;
167 }
168
169
170 public static String getRegisterName(int regNum) {
171 if (regNum < 0 || regNum >= NUM_REGISTERS) {
172 return "[Illegal register " + regNum + "]";
173 }
174
175 if (Assert.ASSERTS_ENABLED) {
176 Assert.that(regNum > -1 && regNum < NUM_REGISTERS, "invalid integer register number!");
177 }
178
179 return registerNames[regNum];
180 }
181
182 public static SPARCRegister getRegister(int regNum) {
183 if (Assert.ASSERTS_ENABLED) {
184 Assert.that(regNum > -1 && regNum < NUM_REGISTERS, "invalid integer register number!");
185 }
186
187 return registers[regNum];
188 }
189 }