Mercurial > hg > graal-compiler
comparison graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/value/ValueUtil.java @ 3528:6b841b6b2437
First round of refactoring.
author | Thomas Wuerthinger <thomas@wuerthinger.net> |
---|---|
date | Tue, 09 Aug 2011 23:56:10 +0200 |
parents | d90bf514d647 |
children | da773e1b6d9f |
comparison
equal
deleted
inserted
replaced
3527:391302094f86 | 3528:6b841b6b2437 |
---|---|
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 package com.oracle.max.graal.compiler.value; | 23 package com.oracle.max.graal.compiler.value; |
24 | 24 |
25 import com.oracle.max.graal.compiler.ir.*; | 25 import com.oracle.max.graal.compiler.nodes.base.*; |
26 import com.oracle.max.graal.compiler.util.*; | 26 import com.oracle.max.graal.compiler.util.*; |
27 import com.sun.cri.ci.*; | 27 import com.sun.cri.ci.*; |
28 | 28 |
29 | 29 |
30 public class ValueUtil { | 30 public class ValueUtil { |
31 | 31 |
32 public static Value assertKind(CiKind kind, Value x) { | 32 public static ValueNode assertKind(CiKind kind, ValueNode x) { |
33 assert x != null && (x.kind == kind) : "kind=" + kind + ", value=" + x + ((x == null) ? "" : ", value.kind=" + x.kind); | 33 assert x != null && (x.kind == kind) : "kind=" + kind + ", value=" + x + ((x == null) ? "" : ", value.kind=" + x.kind); |
34 return x; | 34 return x; |
35 } | 35 } |
36 | 36 |
37 public static Value assertLong(Value x) { | 37 public static ValueNode assertLong(ValueNode x) { |
38 assert x != null && (x.kind == CiKind.Long); | 38 assert x != null && (x.kind == CiKind.Long); |
39 return x; | 39 return x; |
40 } | 40 } |
41 | 41 |
42 public static Value assertJsr(Value x) { | 42 public static ValueNode assertJsr(ValueNode x) { |
43 assert x != null && (x.kind == CiKind.Jsr); | 43 assert x != null && (x.kind == CiKind.Jsr); |
44 return x; | 44 return x; |
45 } | 45 } |
46 | 46 |
47 public static Value assertInt(Value x) { | 47 public static ValueNode assertInt(ValueNode x) { |
48 assert x != null && (x.kind == CiKind.Int); | 48 assert x != null && (x.kind == CiKind.Int); |
49 return x; | 49 return x; |
50 } | 50 } |
51 | 51 |
52 public static Value assertFloat(Value x) { | 52 public static ValueNode assertFloat(ValueNode x) { |
53 assert x != null && (x.kind == CiKind.Float); | 53 assert x != null && (x.kind == CiKind.Float); |
54 return x; | 54 return x; |
55 } | 55 } |
56 | 56 |
57 public static Value assertObject(Value x) { | 57 public static ValueNode assertObject(ValueNode x) { |
58 assert x != null && (x.kind == CiKind.Object); | 58 assert x != null && (x.kind == CiKind.Object); |
59 return x; | 59 return x; |
60 } | 60 } |
61 | 61 |
62 public static Value assertWord(Value x) { | 62 public static ValueNode assertWord(ValueNode x) { |
63 assert x != null && (x.kind == CiKind.Word); | 63 assert x != null && (x.kind == CiKind.Word); |
64 return x; | 64 return x; |
65 } | 65 } |
66 | 66 |
67 public static Value assertDouble(Value x) { | 67 public static ValueNode assertDouble(ValueNode x) { |
68 assert x != null && (x.kind == CiKind.Double); | 68 assert x != null && (x.kind == CiKind.Double); |
69 return x; | 69 return x; |
70 } | 70 } |
71 | 71 |
72 public static void assertHigh(Value x) { | 72 public static void assertHigh(ValueNode x) { |
73 assert x == null; | 73 assert x == null; |
74 } | 74 } |
75 | 75 |
76 public static boolean typeMismatch(Value x, Value y) { | 76 public static boolean typeMismatch(ValueNode x, ValueNode y) { |
77 return y == null || !Util.archKindsEqual(x, y); | 77 return y == null || !Util.archKindsEqual(x, y); |
78 } | 78 } |
79 | 79 |
80 public static boolean isDoubleWord(Value x) { | 80 public static boolean isDoubleWord(ValueNode x) { |
81 return x != null && x.kind.isDoubleWord(); | 81 return x != null && x.kind.isDoubleWord(); |
82 } | 82 } |
83 | 83 |
84 } | 84 } |