Mercurial > hg > truffle
annotate graal/com.oracle.jvmci.code/src/com/oracle/jvmci/code/Register.java @ 21610:f555efead2f2
Fix options in makefile
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Fri, 29 May 2015 20:43:55 -0700 |
parents | 48c1ebd24120 |
children |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
2 * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
18253
diff
changeset
|
23 package com.oracle.jvmci.code; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
18253
diff
changeset
|
25 import com.oracle.jvmci.meta.*; |
5504
452f91ebdb54
Moved RiKind to cri.ri package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5503
diff
changeset
|
26 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
28 * Represents a target machine register. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 */ |
14157 | 30 public final class Register implements Comparable<Register> { |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
31 |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
32 public static final RegisterCategory SPECIAL = new RegisterCategory("SPECIAL"); |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
33 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
34 /** |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 * Invalid register. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 */ |
9426
0f8683ac4009
Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents:
9425
diff
changeset
|
37 public static final Register None = new Register(-1, -1, "noreg", SPECIAL); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
38 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6328
diff
changeset
|
40 * Frame pointer of the current method. All spill slots and outgoing stack-based arguments are |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6328
diff
changeset
|
41 * addressed relative to this register. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
42 */ |
9426
0f8683ac4009
Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents:
9425
diff
changeset
|
43 public static final Register Frame = new Register(-2, -2, "framereg", SPECIAL); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
44 |
9426
0f8683ac4009
Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents:
9425
diff
changeset
|
45 public static final Register CallerFrame = new Register(-3, -3, "callerframereg", SPECIAL); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
46 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6328
diff
changeset
|
48 * The identifier for this register that is unique across all the registers in a |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6328
diff
changeset
|
49 * {@link Architecture}. A valid register has {@code number > 0}. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
50 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
51 public final int number; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
52 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
53 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
54 * The mnemonic of this register. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
55 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
56 public final String name; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
58 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6328
diff
changeset
|
59 * The actual encoding in a target machine instruction for this register, which may or may not |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
6328
diff
changeset
|
60 * be the same as {@link #number}. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
61 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
62 public final int encoding; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
63 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
64 /** |
7804
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
65 * The assembler calls this method to get the register's encoding. |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
66 */ |
7805
0e58445d54df
Integration fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7804
diff
changeset
|
67 public int encoding() { |
7804
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
68 return encoding; |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
69 } |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
70 |
447f9ba1962b
Experimental PTX backend. Contribution by Christian Thalinger.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7530
diff
changeset
|
71 /** |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
72 * A platform specific register category that describes which values can be stored in a |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
73 * register. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
74 */ |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
75 private final RegisterCategory registerCategory; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
76 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
77 /** |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
78 * A platform specific register type that describes which values can be stored in a register. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
79 */ |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
80 public static class RegisterCategory { |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
81 |
16093
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
82 private final String name; |
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
83 |
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
84 private final int referenceMapOffset; |
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
85 private final int referenceMapShift; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
86 |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
87 public RegisterCategory(String name) { |
16093
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
88 this(name, 0, 0); |
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
89 } |
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
90 |
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
91 public RegisterCategory(String name, int referenceMapOffset) { |
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
92 this(name, referenceMapOffset, 0); |
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
93 } |
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
94 |
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
95 public RegisterCategory(String name, int referenceMapOffset, int referenceMapShift) { |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
96 this.name = name; |
16093
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
97 this.referenceMapOffset = referenceMapOffset; |
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
98 this.referenceMapShift = referenceMapShift; |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
99 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
100 |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
101 @Override |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
102 public String toString() { |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
103 return name; |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
104 } |
9631
3c9aeef2702c
Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents:
9509
diff
changeset
|
105 |
3c9aeef2702c
Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents:
9509
diff
changeset
|
106 @Override |
3c9aeef2702c
Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents:
9509
diff
changeset
|
107 public int hashCode() { |
9640
65d7696fb58a
Value: tidy up generated `hashCode()' and `equals()' methods a bit
Bernhard Urban <bernhard.urban@jku.at>
parents:
9631
diff
changeset
|
108 return 23 + name.hashCode(); |
9631
3c9aeef2702c
Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents:
9509
diff
changeset
|
109 } |
3c9aeef2702c
Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents:
9509
diff
changeset
|
110 |
3c9aeef2702c
Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents:
9509
diff
changeset
|
111 @Override |
3c9aeef2702c
Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents:
9509
diff
changeset
|
112 public boolean equals(Object obj) { |
9640
65d7696fb58a
Value: tidy up generated `hashCode()' and `equals()' methods a bit
Bernhard Urban <bernhard.urban@jku.at>
parents:
9631
diff
changeset
|
113 if (obj instanceof RegisterCategory) { |
18253
edb88f5425e6
switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
114 RegisterCategory that = (RegisterCategory) obj; |
edb88f5425e6
switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
115 return this.referenceMapOffset == that.referenceMapOffset && this.referenceMapShift == that.referenceMapShift && this.name.equals(that.name); |
9631
3c9aeef2702c
Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents:
9509
diff
changeset
|
116 } |
9640
65d7696fb58a
Value: tidy up generated `hashCode()' and `equals()' methods a bit
Bernhard Urban <bernhard.urban@jku.at>
parents:
9631
diff
changeset
|
117 return false; |
9631
3c9aeef2702c
Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents:
9509
diff
changeset
|
118 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
119 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
120 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
121 /** |
5774
a1db0ea58b53
Removed left over Ci* prefixed identifiers
Doug Simon <doug.simon@oracle.com>
parents:
5547
diff
changeset
|
122 * Creates a {@link Register} instance. |
16093
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
123 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
124 * @param number unique identifier for the register |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
125 * @param encoding the target machine encoding for the register |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
126 * @param name the mnemonic name for the register |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
127 * @param registerCategory the register category |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
128 */ |
9426
0f8683ac4009
Use register categories to determine spill slot size.
Roland Schatz <roland.schatz@oracle.com>
parents:
9425
diff
changeset
|
129 public Register(int number, int encoding, String name, RegisterCategory registerCategory) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
130 this.number = number; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
131 this.name = name; |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
132 this.registerCategory = registerCategory; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
133 this.encoding = encoding; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
134 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
135 |
9425
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
136 public RegisterCategory getRegisterCategory() { |
3ec29630cfb4
Use register categories instead of register flags.
Roland Schatz <roland.schatz@oracle.com>
parents:
9422
diff
changeset
|
137 return registerCategory; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
138 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
139 |
16114
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
140 /** |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
141 * Get the start index of this register in the {@link ReferenceMap}. |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
142 */ |
16093
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
143 public int getReferenceMapIndex() { |
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
144 return (encoding << registerCategory.referenceMapShift) + registerCategory.referenceMapOffset; |
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
145 } |
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
146 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
147 /** |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
148 * Gets this register as a {@linkplain RegisterValue value} with a specified kind. |
16093
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
149 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
150 * @param kind the specified kind |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
151 * @return the {@link RegisterValue} |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
152 */ |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
153 public RegisterValue asValue(LIRKind kind) { |
9509
688219709f7b
Remove StackSlot and RegisterValue cache.
Roland Schatz <roland.schatz@oracle.com>
parents:
9426
diff
changeset
|
154 return new RegisterValue(kind, this); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
155 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
156 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
157 /** |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
158 * Gets this register as a {@linkplain RegisterValue value} with no particular kind. |
16093
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
159 * |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
160 * @return a {@link RegisterValue} with {@link Kind#Illegal} kind. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
161 */ |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
162 public RegisterValue asValue() { |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
163 return asValue(LIRKind.Illegal); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
164 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
165 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
166 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
167 * Determines if this is a valid register. |
16093
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
168 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
169 * @return {@code true} iff this register is valid |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
170 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
171 public boolean isValid() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
172 return number >= 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
173 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
174 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
175 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
176 * Gets the maximum register {@linkplain #number number} in a given set of registers. |
16093
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
177 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
178 * @param registers the set of registers to process |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
179 * @return the maximum register number for any register in {@code registers} |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
180 */ |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
181 public static int maxRegisterNumber(Register[] registers) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
182 int max = Integer.MIN_VALUE; |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
183 for (Register r : registers) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
184 if (r.number > max) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
185 max = r.number; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
186 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
187 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
188 return max; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
189 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
190 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
191 /** |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
192 * Gets the maximum register {@linkplain #encoding encoding} in a given set of registers. |
16093
39be5bc00046
Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
14157
diff
changeset
|
193 * |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
194 * @param registers the set of registers to process |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
195 * @return the maximum register encoding for any register in {@code registers} |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
196 */ |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
197 public static int maxRegisterEncoding(Register[] registers) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
198 int max = Integer.MIN_VALUE; |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
199 for (Register r : registers) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
200 if (r.encoding > max) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
201 max = r.encoding; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
202 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
203 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
204 return max; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
205 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
206 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
207 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
208 public String toString() { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
209 return name; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
210 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
211 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
212 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5540
diff
changeset
|
213 public int compareTo(Register o) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
214 if (number < o.number) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
215 return -1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
216 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
217 if (number > o.number) { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
218 return 1; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
219 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
220 return 0; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
221 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
222 |
9631
3c9aeef2702c
Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents:
9509
diff
changeset
|
223 @Override |
3c9aeef2702c
Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents:
9509
diff
changeset
|
224 public int hashCode() { |
9666
a886c764ea59
Value: simplify some `equals' and `hashcode' implementations even more
Bernhard Urban <bernhard.urban@jku.at>
parents:
9640
diff
changeset
|
225 return 17 + name.hashCode(); |
9631
3c9aeef2702c
Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents:
9509
diff
changeset
|
226 } |
3c9aeef2702c
Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents:
9509
diff
changeset
|
227 |
3c9aeef2702c
Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents:
9509
diff
changeset
|
228 @Override |
3c9aeef2702c
Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents:
9509
diff
changeset
|
229 public boolean equals(Object obj) { |
9640
65d7696fb58a
Value: tidy up generated `hashCode()' and `equals()' methods a bit
Bernhard Urban <bernhard.urban@jku.at>
parents:
9631
diff
changeset
|
230 if (obj instanceof Register) { |
65d7696fb58a
Value: tidy up generated `hashCode()' and `equals()' methods a bit
Bernhard Urban <bernhard.urban@jku.at>
parents:
9631
diff
changeset
|
231 Register other = (Register) obj; |
9787
3207fae2e2f6
Value: do equals test of `name' as assertion
Bernhard Urban <bernhard.urban@jku.at>
parents:
9666
diff
changeset
|
232 if (number == other.number) { |
3207fae2e2f6
Value: do equals test of `name' as assertion
Bernhard Urban <bernhard.urban@jku.at>
parents:
9666
diff
changeset
|
233 assert name.equals(other.name); |
9666
a886c764ea59
Value: simplify some `equals' and `hashcode' implementations even more
Bernhard Urban <bernhard.urban@jku.at>
parents:
9640
diff
changeset
|
234 assert encoding == other.encoding; |
18253
edb88f5425e6
switch to using use .equals() instead of == when comparing RegisterCaterory objects for equality
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
235 assert registerCategory.equals(other.registerCategory); |
9666
a886c764ea59
Value: simplify some `equals' and `hashcode' implementations even more
Bernhard Urban <bernhard.urban@jku.at>
parents:
9640
diff
changeset
|
236 return true; |
a886c764ea59
Value: simplify some `equals' and `hashcode' implementations even more
Bernhard Urban <bernhard.urban@jku.at>
parents:
9640
diff
changeset
|
237 } |
9631
3c9aeef2702c
Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents:
9509
diff
changeset
|
238 } |
9640
65d7696fb58a
Value: tidy up generated `hashCode()' and `equals()' methods a bit
Bernhard Urban <bernhard.urban@jku.at>
parents:
9631
diff
changeset
|
239 return false; |
9631
3c9aeef2702c
Value: provide proper `hashCode()' and `equals()' implementations
Bernhard Urban <bernhard.urban@jku.at>
parents:
9509
diff
changeset
|
240 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
241 } |