Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.max.cri/src/com/oracle/max/cri/ci/CiValueUtil.java @ 5506:56860d3f9f39
More refactorings and renamings in preparation of ci/ri split.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Thu, 07 Jun 2012 18:12:01 +0200 |
parents | 438ab53efdd0 |
children | dc71b06d09f8 |
comparison
equal
deleted
inserted
replaced
5505:28af6dff047f | 5506:56860d3f9f39 |
---|---|
23 package com.oracle.max.cri.ci; | 23 package com.oracle.max.cri.ci; |
24 | 24 |
25 import com.oracle.max.cri.ri.*; | 25 import com.oracle.max.cri.ri.*; |
26 | 26 |
27 public class CiValueUtil { | 27 public class CiValueUtil { |
28 public static boolean isIllegal(CiValue value) { | 28 public static boolean isIllegal(RiValue value) { |
29 assert value != null; | 29 assert value != null; |
30 return value == CiValue.IllegalValue; | 30 return value == RiValue.IllegalValue; |
31 } | 31 } |
32 | 32 |
33 public static boolean isLegal(CiValue value) { | 33 public static boolean isLegal(RiValue value) { |
34 return !isIllegal(value); | 34 return !isIllegal(value); |
35 } | 35 } |
36 | 36 |
37 public static boolean isVirtualObject(CiValue value) { | 37 public static boolean isVirtualObject(RiValue value) { |
38 assert value != null; | 38 assert value != null; |
39 return value instanceof CiVirtualObject; | 39 return value instanceof CiVirtualObject; |
40 } | 40 } |
41 | 41 |
42 public static CiVirtualObject asVirtualObject(CiValue value) { | 42 public static CiVirtualObject asVirtualObject(RiValue value) { |
43 assert value != null; | 43 assert value != null; |
44 return (CiVirtualObject) value; | 44 return (CiVirtualObject) value; |
45 } | 45 } |
46 | 46 |
47 public static boolean isConstant(CiValue value) { | 47 public static boolean isConstant(RiValue value) { |
48 assert value != null; | 48 assert value != null; |
49 return value instanceof RiConstant; | 49 return value instanceof RiConstant; |
50 } | 50 } |
51 | 51 |
52 public static RiConstant asConstant(CiValue value) { | 52 public static RiConstant asConstant(RiValue value) { |
53 assert value != null; | 53 assert value != null; |
54 return (RiConstant) value; | 54 return (RiConstant) value; |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 public static boolean isStackSlot(CiValue value) { | 58 public static boolean isStackSlot(RiValue value) { |
59 assert value != null; | 59 assert value != null; |
60 return value instanceof CiStackSlot; | 60 return value instanceof CiStackSlot; |
61 } | 61 } |
62 | 62 |
63 public static CiStackSlot asStackSlot(CiValue value) { | 63 public static CiStackSlot asStackSlot(RiValue value) { |
64 assert value != null; | 64 assert value != null; |
65 return (CiStackSlot) value; | 65 return (CiStackSlot) value; |
66 } | 66 } |
67 | 67 |
68 public static boolean isAddress(CiValue value) { | 68 public static boolean isAddress(RiValue value) { |
69 assert value != null; | 69 assert value != null; |
70 return value instanceof CiAddress; | 70 return value instanceof CiAddress; |
71 } | 71 } |
72 | 72 |
73 public static CiAddress asAddress(CiValue value) { | 73 public static CiAddress asAddress(RiValue value) { |
74 assert value != null; | 74 assert value != null; |
75 return (CiAddress) value; | 75 return (CiAddress) value; |
76 } | 76 } |
77 | 77 |
78 | 78 |
79 public static boolean isRegister(CiValue value) { | 79 public static boolean isRegister(RiValue value) { |
80 assert value != null; | 80 assert value != null; |
81 return value instanceof CiRegisterValue; | 81 return value instanceof CiRegisterValue; |
82 } | 82 } |
83 | 83 |
84 public static CiRegister asRegister(CiValue value) { | 84 public static CiRegister asRegister(RiValue value) { |
85 assert value != null; | 85 assert value != null; |
86 return ((CiRegisterValue) value).reg; | 86 return ((CiRegisterValue) value).reg; |
87 } | 87 } |
88 | 88 |
89 public static CiRegister asIntReg(CiValue value) { | 89 public static CiRegister asIntReg(RiValue value) { |
90 assert value.kind == RiKind.Int || value.kind == RiKind.Jsr; | 90 assert value.kind == RiKind.Int || value.kind == RiKind.Jsr; |
91 return asRegister(value); | 91 return asRegister(value); |
92 } | 92 } |
93 | 93 |
94 public static CiRegister asLongReg(CiValue value) { | 94 public static CiRegister asLongReg(RiValue value) { |
95 assert value.kind == RiKind.Long : value.kind; | 95 assert value.kind == RiKind.Long : value.kind; |
96 return asRegister(value); | 96 return asRegister(value); |
97 } | 97 } |
98 | 98 |
99 public static CiRegister asObjectReg(CiValue value) { | 99 public static CiRegister asObjectReg(RiValue value) { |
100 assert value.kind == RiKind.Object; | 100 assert value.kind == RiKind.Object; |
101 return asRegister(value); | 101 return asRegister(value); |
102 } | 102 } |
103 | 103 |
104 public static CiRegister asFloatReg(CiValue value) { | 104 public static CiRegister asFloatReg(RiValue value) { |
105 assert value.kind == RiKind.Float; | 105 assert value.kind == RiKind.Float; |
106 return asRegister(value); | 106 return asRegister(value); |
107 } | 107 } |
108 | 108 |
109 public static CiRegister asDoubleReg(CiValue value) { | 109 public static CiRegister asDoubleReg(RiValue value) { |
110 assert value.kind == RiKind.Double; | 110 assert value.kind == RiKind.Double; |
111 return asRegister(value); | 111 return asRegister(value); |
112 } | 112 } |
113 | 113 |
114 | 114 |
115 public static boolean sameRegister(CiValue v1, CiValue v2) { | 115 public static boolean sameRegister(RiValue v1, RiValue v2) { |
116 return isRegister(v1) && isRegister(v2) && asRegister(v1) == asRegister(v2); | 116 return isRegister(v1) && isRegister(v2) && asRegister(v1) == asRegister(v2); |
117 } | 117 } |
118 | 118 |
119 public static boolean sameRegister(CiValue v1, CiValue v2, CiValue v3) { | 119 public static boolean sameRegister(RiValue v1, RiValue v2, RiValue v3) { |
120 return sameRegister(v1, v2) && sameRegister(v1, v3); | 120 return sameRegister(v1, v2) && sameRegister(v1, v3); |
121 } | 121 } |
122 | 122 |
123 public static boolean differentRegisters(CiValue v1, CiValue v2) { | 123 public static boolean differentRegisters(RiValue v1, RiValue v2) { |
124 return !isRegister(v1) || !isRegister(v2) || asRegister(v1) != asRegister(v2); | 124 return !isRegister(v1) || !isRegister(v2) || asRegister(v1) != asRegister(v2); |
125 } | 125 } |
126 | 126 |
127 public static boolean differentRegisters(CiValue v1, CiValue v2, CiValue v3) { | 127 public static boolean differentRegisters(RiValue v1, RiValue v2, RiValue v3) { |
128 return differentRegisters(v1, v2) && differentRegisters(v1, v3) && differentRegisters(v2, v3); | 128 return differentRegisters(v1, v2) && differentRegisters(v1, v3) && differentRegisters(v2, v3); |
129 } | 129 } |
130 } | 130 } |