1 /* |
|
2 * Copyright (c) 2002, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 * or visit www.oracle.com if you need additional information or have any |
|
21 * questions. |
|
22 * |
|
23 */ |
|
24 |
|
25 package sun.jvm.hotspot.asm; |
|
26 |
|
27 // address is calculated as (base + (index * scale) + displacement) |
|
28 // optionally index is auto incremented or decremented |
|
29 |
|
30 public abstract class BaseIndexScaleDispAddress extends IndirectAddress { |
|
31 private final Register base, index; |
|
32 private final int scale; |
|
33 private final long disp; |
|
34 private boolean isAutoIncr; |
|
35 private boolean isAutoDecr; |
|
36 |
|
37 public BaseIndexScaleDispAddress(Register base, Register index, long disp, int scale) { |
|
38 this.base = base; |
|
39 this.index = index; |
|
40 this.disp = disp; |
|
41 this.scale = scale; |
|
42 } |
|
43 |
|
44 public BaseIndexScaleDispAddress(Register base, Register index, long disp) { |
|
45 this(base, index, disp, 1); |
|
46 } |
|
47 |
|
48 public BaseIndexScaleDispAddress(Register base, Register index) { |
|
49 this(base, index, 0L, 1); |
|
50 } |
|
51 |
|
52 public BaseIndexScaleDispAddress(Register base, long disp) { |
|
53 this(base, null, disp, 1); |
|
54 } |
|
55 |
|
56 public Register getBase() { |
|
57 return base; |
|
58 } |
|
59 |
|
60 public Register getIndex() { |
|
61 return index; |
|
62 } |
|
63 |
|
64 public int getScale() { |
|
65 return scale; |
|
66 } |
|
67 |
|
68 public long getDisplacement() { |
|
69 return disp; |
|
70 } |
|
71 |
|
72 // is the index auto decremented or incremented? |
|
73 public boolean isAutoIncrement() { |
|
74 return isAutoIncr; |
|
75 } |
|
76 |
|
77 public void setAutoIncrement(boolean value) { |
|
78 isAutoIncr = value; |
|
79 } |
|
80 |
|
81 public boolean isAutoDecrement() { |
|
82 return isAutoDecr; |
|
83 } |
|
84 |
|
85 public void setAutoDecrement(boolean value) { |
|
86 isAutoDecr = value; |
|
87 } |
|
88 } |
|