comparison graal/com.oracle.max.cri/src/com/sun/cri/ci/CiRegisterValue.java @ 4169:f5328dda9714

Initial commit of SSA-based spill-all register assignment
author Christian Wimmer <Christian.Wimmer@Oracle.com>
date Wed, 28 Dec 2011 18:13:25 -0800
parents bc8527f3071c
children de7b3e7ae528
comparison
equal deleted inserted replaced
4168:0bc4815d2069 4169:f5328dda9714
26 * Denotes a register that stores a value of a fixed kind. There is exactly one (canonical) instance of {@code 26 * Denotes a register that stores a value of a fixed kind. There is exactly one (canonical) instance of {@code
27 * CiRegisterValue} for each ({@link CiRegister}, {@link CiKind}) pair. Use {@link CiRegister#asValue(CiKind)} to 27 * CiRegisterValue} for each ({@link CiRegister}, {@link CiKind}) pair. Use {@link CiRegister#asValue(CiKind)} to
28 * retrieve the canonical {@link CiRegisterValue} instance for a given (register,kind) pair. 28 * retrieve the canonical {@link CiRegisterValue} instance for a given (register,kind) pair.
29 */ 29 */
30 public final class CiRegisterValue extends CiValue { 30 public final class CiRegisterValue extends CiValue {
31 private static final long serialVersionUID = 7999341472196897163L;
31 32
32 /**
33 *
34 */
35 private static final long serialVersionUID = 7999341472196897163L;
36 /** 33 /**
37 * The register. 34 * The register.
38 */ 35 */
39 public final CiRegister reg; 36 public final CiRegister reg;
40 37
41 /** 38 /**
42 * Should only be called from {@link CiRegister#CiRegister} to ensure canonicalization. 39 * Should only be called from {@link CiRegister#CiRegister} to ensure canonicalization.
43 */ 40 */
44 CiRegisterValue(CiKind kind, CiRegister register) { 41 protected CiRegisterValue(CiKind kind, CiRegister register) {
45 super(kind); 42 super(kind);
46 this.reg = register; 43 this.reg = register;
47 } 44 }
48 45
49 @Override 46 @Override
50 public int hashCode() { 47 public int hashCode() {
51 return kind.ordinal() ^ reg.number; 48 return (reg.number << 4) ^ kind.ordinal();
52 } 49 }
53 50
54 @Override 51 @Override
55 public boolean equals(Object o) { 52 public boolean equals(Object o) {
56 return o == this; 53 return o == this;
63 } 60 }
64 return false; 61 return false;
65 } 62 }
66 63
67 @Override 64 @Override
68 public String name() { 65 public String toString() {
69 return reg.name; 66 return reg.name + kindSuffix();
70 } 67 }
71 68
72 @Override 69 @Override
73 public CiRegister asRegister() { 70 public CiRegister asRegister() {
74 return reg; 71 return reg;