comparison graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ConstantNode.java @ 5538:e18ba36bfebc

Renamed RiConstant => Constant.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 08 Jun 2012 23:41:02 +0200
parents 426c605c9d3c
children a891c53a295b
comparison
equal deleted inserted replaced
5537:80371cc2256d 5538:e18ba36bfebc
34 * long, float, object reference, address, etc. 34 * long, float, object reference, address, etc.
35 */ 35 */
36 @NodeInfo(shortName = "Const") 36 @NodeInfo(shortName = "Const")
37 public class ConstantNode extends BooleanNode implements LIRLowerable { 37 public class ConstantNode extends BooleanNode implements LIRLowerable {
38 38
39 public final RiConstant value; 39 public final Constant value;
40 40
41 protected ConstantNode(RiConstant value) { 41 protected ConstantNode(Constant value) {
42 super(StampFactory.forConstant(value)); 42 super(StampFactory.forConstant(value));
43 this.value = value; 43 this.value = value;
44 } 44 }
45 45
46 /** 46 /**
47 * Constructs a new ConstantNode representing the specified constant. 47 * Constructs a new ConstantNode representing the specified constant.
48 * @param value the constant 48 * @param value the constant
49 */ 49 */
50 protected ConstantNode(RiConstant value, RiRuntime runtime) { 50 protected ConstantNode(Constant value, RiRuntime runtime) {
51 super(StampFactory.forConstant(value, runtime)); 51 super(StampFactory.forConstant(value, runtime));
52 this.value = value; 52 this.value = value;
53 } 53 }
54 54
55 @Override 55 @Override
63 63
64 private boolean onlyUsedInFrameState() { 64 private boolean onlyUsedInFrameState() {
65 return usages().filter(NodePredicates.isNotA(FrameState.class)).isEmpty(); 65 return usages().filter(NodePredicates.isNotA(FrameState.class)).isEmpty();
66 } 66 }
67 67
68 public static ConstantNode forCiConstant(RiConstant constant, RiRuntime runtime, Graph graph) { 68 public static ConstantNode forCiConstant(Constant constant, RiRuntime runtime, Graph graph) {
69 if (constant.kind == RiKind.Object) { 69 if (constant.kind == RiKind.Object) {
70 return graph.unique(new ConstantNode(constant, runtime)); 70 return graph.unique(new ConstantNode(constant, runtime));
71 } else { 71 } else {
72 return graph.unique(new ConstantNode(constant)); 72 return graph.unique(new ConstantNode(constant));
73 } 73 }
78 * @param d the double value for which to create the instruction 78 * @param d the double value for which to create the instruction
79 * @param graph 79 * @param graph
80 * @return a node for a double constant 80 * @return a node for a double constant
81 */ 81 */
82 public static ConstantNode forDouble(double d, Graph graph) { 82 public static ConstantNode forDouble(double d, Graph graph) {
83 return graph.unique(new ConstantNode(RiConstant.forDouble(d))); 83 return graph.unique(new ConstantNode(Constant.forDouble(d)));
84 } 84 }
85 85
86 /** 86 /**
87 * Returns a node for a float constant. 87 * Returns a node for a float constant.
88 * @param f the float value for which to create the instruction 88 * @param f the float value for which to create the instruction
89 * @param graph 89 * @param graph
90 * @return a node for a float constant 90 * @return a node for a float constant
91 */ 91 */
92 public static ConstantNode forFloat(float f, Graph graph) { 92 public static ConstantNode forFloat(float f, Graph graph) {
93 return graph.unique(new ConstantNode(RiConstant.forFloat(f))); 93 return graph.unique(new ConstantNode(Constant.forFloat(f)));
94 } 94 }
95 95
96 /** 96 /**
97 * Returns a node for an long constant. 97 * Returns a node for an long constant.
98 * @param i the long value for which to create the instruction 98 * @param i the long value for which to create the instruction
99 * @param graph 99 * @param graph
100 * @return a node for an long constant 100 * @return a node for an long constant
101 */ 101 */
102 public static ConstantNode forLong(long i, Graph graph) { 102 public static ConstantNode forLong(long i, Graph graph) {
103 return graph.unique(new ConstantNode(RiConstant.forLong(i))); 103 return graph.unique(new ConstantNode(Constant.forLong(i)));
104 } 104 }
105 105
106 /** 106 /**
107 * Returns a node for an integer constant. 107 * Returns a node for an integer constant.
108 * @param i the integer value for which to create the instruction 108 * @param i the integer value for which to create the instruction
109 * @param graph 109 * @param graph
110 * @return a node for an integer constant 110 * @return a node for an integer constant
111 */ 111 */
112 public static ConstantNode forInt(int i, Graph graph) { 112 public static ConstantNode forInt(int i, Graph graph) {
113 return graph.unique(new ConstantNode(RiConstant.forInt(i))); 113 return graph.unique(new ConstantNode(Constant.forInt(i)));
114 } 114 }
115 115
116 /** 116 /**
117 * Returns a node for a boolean constant. 117 * Returns a node for a boolean constant.
118 * @param i the boolean value for which to create the instruction 118 * @param i the boolean value for which to create the instruction
119 * @param graph 119 * @param graph
120 * @return a node representing the boolean 120 * @return a node representing the boolean
121 */ 121 */
122 public static ConstantNode forBoolean(boolean i, Graph graph) { 122 public static ConstantNode forBoolean(boolean i, Graph graph) {
123 return graph.unique(new ConstantNode(RiConstant.forBoolean(i))); 123 return graph.unique(new ConstantNode(Constant.forBoolean(i)));
124 } 124 }
125 125
126 /** 126 /**
127 * Returns a node for a byte constant. 127 * Returns a node for a byte constant.
128 * @param i the byte value for which to create the instruction 128 * @param i the byte value for which to create the instruction
129 * @param graph 129 * @param graph
130 * @return a node representing the byte 130 * @return a node representing the byte
131 */ 131 */
132 public static ConstantNode forByte(byte i, Graph graph) { 132 public static ConstantNode forByte(byte i, Graph graph) {
133 return graph.unique(new ConstantNode(RiConstant.forByte(i))); 133 return graph.unique(new ConstantNode(Constant.forByte(i)));
134 } 134 }
135 135
136 /** 136 /**
137 * Returns a node for a char constant. 137 * Returns a node for a char constant.
138 * @param i the char value for which to create the instruction 138 * @param i the char value for which to create the instruction
139 * @param graph 139 * @param graph
140 * @return a node representing the char 140 * @return a node representing the char
141 */ 141 */
142 public static ConstantNode forChar(char i, Graph graph) { 142 public static ConstantNode forChar(char i, Graph graph) {
143 return graph.unique(new ConstantNode(RiConstant.forChar(i))); 143 return graph.unique(new ConstantNode(Constant.forChar(i)));
144 } 144 }
145 145
146 /** 146 /**
147 * Returns a node for a short constant. 147 * Returns a node for a short constant.
148 * @param i the short value for which to create the instruction 148 * @param i the short value for which to create the instruction
149 * @param graph 149 * @param graph
150 * @return a node representing the short 150 * @return a node representing the short
151 */ 151 */
152 public static ConstantNode forShort(short i, Graph graph) { 152 public static ConstantNode forShort(short i, Graph graph) {
153 return graph.unique(new ConstantNode(RiConstant.forShort(i))); 153 return graph.unique(new ConstantNode(Constant.forShort(i)));
154 } 154 }
155 155
156 /** 156 /**
157 * Returns a node for an address (jsr/ret address) constant. 157 * Returns a node for an address (jsr/ret address) constant.
158 * @param i the address value for which to create the instruction 158 * @param i the address value for which to create the instruction
159 * @param graph 159 * @param graph
160 * @return a node representing the address 160 * @return a node representing the address
161 */ 161 */
162 public static ConstantNode forJsr(int i, Graph graph) { 162 public static ConstantNode forJsr(int i, Graph graph) {
163 return graph.unique(new ConstantNode(RiConstant.forJsr(i))); 163 return graph.unique(new ConstantNode(Constant.forJsr(i)));
164 } 164 }
165 165
166 /** 166 /**
167 * Returns a node for an object constant. 167 * Returns a node for an object constant.
168 * @param o the object value for which to create the instruction 168 * @param o the object value for which to create the instruction
169 * @param graph 169 * @param graph
170 * @return a node representing the object 170 * @return a node representing the object
171 */ 171 */
172 public static ConstantNode forObject(Object o, RiRuntime runtime, Graph graph) { 172 public static ConstantNode forObject(Object o, RiRuntime runtime, Graph graph) {
173 return graph.unique(new ConstantNode(RiConstant.forObject(o), runtime)); 173 return graph.unique(new ConstantNode(Constant.forObject(o), runtime));
174 } 174 }
175 175
176 public static ConstantNode forIntegerKind(RiKind kind, long value, Graph graph) { 176 public static ConstantNode forIntegerKind(RiKind kind, long value, Graph graph) {
177 switch (kind) { 177 switch (kind) {
178 case Byte: 178 case Byte: