comparison jvmci/jdk.vm.ci.code/src/jdk/vm/ci/code/Register.java @ 23393:1d4ce2d19e52

clean up and minimize JVMCI (JDK-8156835)
author Doug Simon <doug.simon@oracle.com>
date Thu, 12 May 2016 20:57:31 +0200
parents ef7d87db544a
children 19432ed40848
comparison
equal deleted inserted replaced
23392:b3a816d3b844 23393:1d4ce2d19e52
45 45
46 public static final Register CallerFrame = new Register(-3, -3, "callerframereg", SPECIAL); 46 public static final Register CallerFrame = new Register(-3, -3, "callerframereg", SPECIAL);
47 47
48 /** 48 /**
49 * The identifier for this register that is unique across all the registers in a 49 * The identifier for this register that is unique across all the registers in a
50 * {@link Architecture}. A valid register has {@code number > 0}. 50 * {@link Architecture}. A valid register has {@code number >= 0}.
51 */ 51 */
52 public final int number; 52 public final int number;
53 53
54 /** 54 /**
55 * The mnemonic of this register. 55 * The mnemonic of this register.
162 * 162 *
163 * @return {@code true} iff this register is valid 163 * @return {@code true} iff this register is valid
164 */ 164 */
165 public boolean isValid() { 165 public boolean isValid() {
166 return number >= 0; 166 return number >= 0;
167 }
168
169 /**
170 * Gets the maximum register {@linkplain #number number} in a given set of registers.
171 *
172 * @param registers the set of registers to process
173 * @return the maximum register number for any register in {@code registers}
174 */
175 public static int maxRegisterNumber(Register[] registers) {
176 int max = Integer.MIN_VALUE;
177 for (Register r : registers) {
178 if (r.number > max) {
179 max = r.number;
180 }
181 }
182 return max;
183 }
184
185 /**
186 * Gets the maximum register {@linkplain #encoding encoding} in a given set of registers.
187 *
188 * @param registers the set of registers to process
189 * @return the maximum register encoding for any register in {@code registers}
190 */
191 public static int maxRegisterEncoding(Register[] registers) {
192 int max = Integer.MIN_VALUE;
193 for (Register r : registers) {
194 if (r.encoding > max) {
195 max = r.encoding;
196 }
197 }
198 return max;
199 } 167 }
200 168
201 @Override 169 @Override
202 public String toString() { 170 public String toString() {
203 return name; 171 return name;