0
|
1 /*
|
|
2 * Copyright 2002 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.asm.Address;
|
|
28 import sun.jvm.hotspot.asm.BaseIndexScaleDispAddress;
|
|
29
|
|
30 public class SPARCRegisterIndirectAddress extends BaseIndexScaleDispAddress {
|
|
31 protected int addressSpace = -1;
|
|
32
|
|
33 public SPARCRegisterIndirectAddress(SPARCRegister register, int offset) {
|
|
34 super(register, offset);
|
|
35 }
|
|
36
|
|
37 public SPARCRegisterIndirectAddress(SPARCRegister base, SPARCRegister index) {
|
|
38 super(base, index);
|
|
39 }
|
|
40
|
|
41 public int getAddressSpace() {
|
|
42 return addressSpace;
|
|
43 }
|
|
44
|
|
45 public void setAddressSpace(int addressSpace) {
|
|
46 this.addressSpace = addressSpace;
|
|
47 }
|
|
48
|
|
49 public String getAddressWithoutAsi() {
|
|
50 StringBuffer buf = new StringBuffer();
|
|
51 buf.append('[');
|
|
52 buf.append(getBase().toString());
|
|
53 sun.jvm.hotspot.asm.Register register = getIndex();
|
|
54 if (register != null) {
|
|
55 buf.append(" + ");
|
|
56 buf.append(register.toString());
|
|
57 } else {
|
|
58 long disp = getDisplacement();
|
|
59 if (disp < 0) {
|
|
60 buf.append(" - 0x");
|
|
61 disp = -disp;
|
|
62 } else {
|
|
63 buf.append(" + 0x");
|
|
64 }
|
|
65 buf.append(Long.toHexString(disp));
|
|
66 }
|
|
67 buf.append(']');
|
|
68 return buf.toString();
|
|
69 }
|
|
70
|
|
71 public String toString() {
|
|
72 StringBuffer buf = new StringBuffer();
|
|
73 buf.append(getAddressWithoutAsi());
|
|
74 if(addressSpace != -1)
|
|
75 buf.append((new Integer(addressSpace)).toString());
|
|
76 return buf.toString();
|
|
77 }
|
|
78 }
|