Mercurial > hg > graal-compiler
annotate src/share/vm/opto/connode.hpp @ 126:72f4a668df19
6625997: CastPP, CheckCastPP and Proj nodes are not dead loop safe
Summary: EA and initialization optimizations could bypass these nodes.
Reviewed-by: rasbold, never
author | kvn |
---|---|
date | Wed, 23 Apr 2008 19:09:16 -0700 |
parents | b130b98db9cf |
children | 885ed790ecf0 |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
20 * CA 95054 USA or visit www.sun.com if you need additional information or | |
21 * have any questions. | |
22 * | |
23 */ | |
24 | |
25 class PhaseTransform; | |
26 class MachNode; | |
27 | |
28 //------------------------------ConNode---------------------------------------- | |
29 // Simple constants | |
30 class ConNode : public TypeNode { | |
31 public: | |
32 ConNode( const Type *t ) : TypeNode(t,1) { | |
33 init_req(0, (Node*)Compile::current()->root()); | |
34 init_flags(Flag_is_Con); | |
35 } | |
36 virtual int Opcode() const; | |
37 virtual uint hash() const; | |
38 virtual const RegMask &out_RegMask() const { return RegMask::Empty; } | |
39 virtual const RegMask &in_RegMask(uint) const { return RegMask::Empty; } | |
40 | |
41 // Polymorphic factory method: | |
42 static ConNode* make( Compile* C, const Type *t ); | |
43 }; | |
44 | |
45 //------------------------------ConINode--------------------------------------- | |
46 // Simple integer constants | |
47 class ConINode : public ConNode { | |
48 public: | |
49 ConINode( const TypeInt *t ) : ConNode(t) {} | |
50 virtual int Opcode() const; | |
51 | |
52 // Factory method: | |
53 static ConINode* make( Compile* C, int con ) { | |
54 return new (C, 1) ConINode( TypeInt::make(con) ); | |
55 } | |
56 | |
57 }; | |
58 | |
59 //------------------------------ConPNode--------------------------------------- | |
60 // Simple pointer constants | |
61 class ConPNode : public ConNode { | |
62 public: | |
63 ConPNode( const TypePtr *t ) : ConNode(t) {} | |
64 virtual int Opcode() const; | |
65 | |
66 // Factory methods: | |
67 static ConPNode* make( Compile *C ,address con ) { | |
68 if (con == NULL) | |
69 return new (C, 1) ConPNode( TypePtr::NULL_PTR ) ; | |
70 else | |
71 return new (C, 1) ConPNode( TypeRawPtr::make(con) ); | |
72 } | |
73 | |
74 static ConPNode* make( Compile *C, ciObject* con ) { | |
75 return new (C, 1) ConPNode( TypeOopPtr::make_from_constant(con) ); | |
76 } | |
77 | |
78 }; | |
79 | |
80 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
81 //------------------------------ConNNode-------------------------------------- |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
82 // Simple narrow oop constants |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
83 class ConNNode : public ConNode { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
84 public: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
85 ConNNode( const TypeNarrowOop *t ) : ConNode(t) {} |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
86 virtual int Opcode() const; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
87 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
88 static ConNNode* make( Compile *C, ciObject* con ) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
89 return new (C, 1) ConNNode( TypeNarrowOop::make_from_constant(con) ); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
90 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
91 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
92 }; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
93 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
94 |
0 | 95 //------------------------------ConLNode--------------------------------------- |
96 // Simple long constants | |
97 class ConLNode : public ConNode { | |
98 public: | |
99 ConLNode( const TypeLong *t ) : ConNode(t) {} | |
100 virtual int Opcode() const; | |
101 | |
102 // Factory method: | |
103 static ConLNode* make( Compile *C ,jlong con ) { | |
104 return new (C, 1) ConLNode( TypeLong::make(con) ); | |
105 } | |
106 | |
107 }; | |
108 | |
109 //------------------------------ConFNode--------------------------------------- | |
110 // Simple float constants | |
111 class ConFNode : public ConNode { | |
112 public: | |
113 ConFNode( const TypeF *t ) : ConNode(t) {} | |
114 virtual int Opcode() const; | |
115 | |
116 // Factory method: | |
117 static ConFNode* make( Compile *C, float con ) { | |
118 return new (C, 1) ConFNode( TypeF::make(con) ); | |
119 } | |
120 | |
121 }; | |
122 | |
123 //------------------------------ConDNode--------------------------------------- | |
124 // Simple double constants | |
125 class ConDNode : public ConNode { | |
126 public: | |
127 ConDNode( const TypeD *t ) : ConNode(t) {} | |
128 virtual int Opcode() const; | |
129 | |
130 // Factory method: | |
131 static ConDNode* make( Compile *C, double con ) { | |
132 return new (C, 1) ConDNode( TypeD::make(con) ); | |
133 } | |
134 | |
135 }; | |
136 | |
137 //------------------------------BinaryNode------------------------------------- | |
138 // Place holder for the 2 conditional inputs to a CMove. CMove needs 4 | |
139 // inputs: the Bool (for the lt/gt/eq/ne bits), the flags (result of some | |
140 // compare), and the 2 values to select between. The Matcher requires a | |
141 // binary tree so we break it down like this: | |
142 // (CMove (Binary bol cmp) (Binary src1 src2)) | |
143 class BinaryNode : public Node { | |
144 public: | |
145 BinaryNode( Node *n1, Node *n2 ) : Node(0,n1,n2) { } | |
146 virtual int Opcode() const; | |
147 virtual uint ideal_reg() const { return 0; } | |
148 }; | |
149 | |
150 //------------------------------CMoveNode-------------------------------------- | |
151 // Conditional move | |
152 class CMoveNode : public TypeNode { | |
153 public: | |
154 enum { Control, // When is it safe to do this cmove? | |
155 Condition, // Condition controlling the cmove | |
156 IfFalse, // Value if condition is false | |
157 IfTrue }; // Value if condition is true | |
158 CMoveNode( Node *bol, Node *left, Node *right, const Type *t ) : TypeNode(t,4) | |
159 { | |
160 init_class_id(Class_CMove); | |
161 // all inputs are nullified in Node::Node(int) | |
162 // init_req(Control,NULL); | |
163 init_req(Condition,bol); | |
164 init_req(IfFalse,left); | |
165 init_req(IfTrue,right); | |
166 } | |
167 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
168 virtual const Type *Value( PhaseTransform *phase ) const; | |
169 virtual Node *Identity( PhaseTransform *phase ); | |
170 static CMoveNode *make( Compile *C, Node *c, Node *bol, Node *left, Node *right, const Type *t ); | |
171 // Helper function to spot cmove graph shapes | |
172 static Node *is_cmove_id( PhaseTransform *phase, Node *cmp, Node *t, Node *f, BoolNode *b ); | |
173 }; | |
174 | |
175 //------------------------------CMoveDNode------------------------------------- | |
176 class CMoveDNode : public CMoveNode { | |
177 public: | |
178 CMoveDNode( Node *bol, Node *left, Node *right, const Type* t) : CMoveNode(bol,left,right,t){} | |
179 virtual int Opcode() const; | |
180 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
181 }; | |
182 | |
183 //------------------------------CMoveFNode------------------------------------- | |
184 class CMoveFNode : public CMoveNode { | |
185 public: | |
186 CMoveFNode( Node *bol, Node *left, Node *right, const Type* t ) : CMoveNode(bol,left,right,t) {} | |
187 virtual int Opcode() const; | |
188 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
189 }; | |
190 | |
191 //------------------------------CMoveINode------------------------------------- | |
192 class CMoveINode : public CMoveNode { | |
193 public: | |
194 CMoveINode( Node *bol, Node *left, Node *right, const TypeInt *ti ) : CMoveNode(bol,left,right,ti){} | |
195 virtual int Opcode() const; | |
196 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
197 }; | |
198 | |
199 //------------------------------CMoveLNode------------------------------------- | |
200 class CMoveLNode : public CMoveNode { | |
201 public: | |
202 CMoveLNode(Node *bol, Node *left, Node *right, const TypeLong *tl ) : CMoveNode(bol,left,right,tl){} | |
203 virtual int Opcode() const; | |
204 }; | |
205 | |
206 //------------------------------CMovePNode------------------------------------- | |
207 class CMovePNode : public CMoveNode { | |
208 public: | |
209 CMovePNode( Node *c, Node *bol, Node *left, Node *right, const TypePtr* t ) : CMoveNode(bol,left,right,t) { init_req(Control,c); } | |
210 virtual int Opcode() const; | |
211 }; | |
212 | |
213 //------------------------------ConstraintCastNode------------------------------------- | |
214 // cast to a different range | |
215 class ConstraintCastNode: public TypeNode { | |
216 public: | |
217 ConstraintCastNode (Node *n, const Type *t ): TypeNode(t,2) { | |
218 init_class_id(Class_ConstraintCast); | |
219 init_req(1, n); | |
220 } | |
221 virtual Node *Identity( PhaseTransform *phase ); | |
222 virtual const Type *Value( PhaseTransform *phase ) const; | |
223 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
224 virtual int Opcode() const; | |
225 virtual uint ideal_reg() const = 0; | |
226 virtual Node *Ideal_DU_postCCP( PhaseCCP * ); | |
227 }; | |
228 | |
229 //------------------------------CastIINode------------------------------------- | |
230 // cast integer to integer (different range) | |
231 class CastIINode: public ConstraintCastNode { | |
232 public: | |
233 CastIINode (Node *n, const Type *t ): ConstraintCastNode(n,t) {} | |
234 virtual int Opcode() const; | |
235 virtual uint ideal_reg() const { return Op_RegI; } | |
236 }; | |
237 | |
238 //------------------------------CastPPNode------------------------------------- | |
239 // cast pointer to pointer (different type) | |
240 class CastPPNode: public ConstraintCastNode { | |
241 public: | |
126
72f4a668df19
6625997: CastPP, CheckCastPP and Proj nodes are not dead loop safe
kvn
parents:
124
diff
changeset
|
242 CastPPNode (Node *n, const Type *t ): ConstraintCastNode(n, t) {} |
0 | 243 virtual int Opcode() const; |
244 virtual uint ideal_reg() const { return Op_RegP; } | |
245 virtual Node *Ideal_DU_postCCP( PhaseCCP * ); | |
246 }; | |
247 | |
248 //------------------------------CheckCastPPNode-------------------------------- | |
249 // for _checkcast, cast pointer to pointer (different type), without JOIN, | |
250 class CheckCastPPNode: public TypeNode { | |
251 public: | |
252 CheckCastPPNode( Node *c, Node *n, const Type *t ) : TypeNode(t,2) { | |
253 init_class_id(Class_CheckCastPP); | |
254 init_req(0, c); | |
255 init_req(1, n); | |
256 } | |
126
72f4a668df19
6625997: CastPP, CheckCastPP and Proj nodes are not dead loop safe
kvn
parents:
124
diff
changeset
|
257 |
0 | 258 virtual Node *Identity( PhaseTransform *phase ); |
259 virtual const Type *Value( PhaseTransform *phase ) const; | |
260 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
261 virtual int Opcode() const; | |
262 virtual uint ideal_reg() const { return Op_RegP; } | |
263 // No longer remove CheckCast after CCP as it gives me a place to hang | |
264 // the proper address type - which is required to compute anti-deps. | |
265 //virtual Node *Ideal_DU_postCCP( PhaseCCP * ); | |
266 }; | |
267 | |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
268 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
269 //------------------------------EncodeP-------------------------------- |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
270 // Encodes an oop pointers into its compressed form |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
271 // Takes an extra argument which is the real heap base as a long which |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
272 // may be useful for code generation in the backend. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
273 class EncodePNode : public TypeNode { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
274 public: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
275 EncodePNode(Node* value, const Type* type): |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
276 TypeNode(type, 2) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
277 init_req(0, NULL); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
278 init_req(1, value); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
279 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
280 virtual int Opcode() const; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
281 virtual Node *Identity( PhaseTransform *phase ); |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
282 virtual const Type *Value( PhaseTransform *phase ) const; |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
283 virtual uint ideal_reg() const { return Op_RegN; } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
284 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
285 static Node* encode(PhaseGVN* phase, Node* value); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
286 }; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
287 |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
288 //------------------------------DecodeN-------------------------------- |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
289 // Converts a narrow oop into a real oop ptr. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
290 // Takes an extra argument which is the real heap base as a long which |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
291 // may be useful for code generation in the backend. |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
292 class DecodeNNode : public TypeNode { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
293 public: |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
294 DecodeNNode(Node* value, const Type* type): |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
295 TypeNode(type, 2) { |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
296 init_req(0, NULL); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
297 init_req(1, value); |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
298 } |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
299 virtual int Opcode() const; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
300 virtual Node *Identity( PhaseTransform *phase ); |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
301 virtual const Type *Value( PhaseTransform *phase ) const; |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
302 virtual uint ideal_reg() const { return Op_RegP; } |
124
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
303 |
b130b98db9cf
6689060: Escape Analysis does not work with Compressed Oops
kvn
parents:
113
diff
changeset
|
304 static Node* decode(PhaseGVN* phase, Node* value); |
113
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
305 }; |
ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
0
diff
changeset
|
306 |
0 | 307 //------------------------------Conv2BNode------------------------------------- |
308 // Convert int/pointer to a Boolean. Map zero to zero, all else to 1. | |
309 class Conv2BNode : public Node { | |
310 public: | |
311 Conv2BNode( Node *i ) : Node(0,i) {} | |
312 virtual int Opcode() const; | |
313 virtual const Type *bottom_type() const { return TypeInt::BOOL; } | |
314 virtual Node *Identity( PhaseTransform *phase ); | |
315 virtual const Type *Value( PhaseTransform *phase ) const; | |
316 virtual uint ideal_reg() const { return Op_RegI; } | |
317 }; | |
318 | |
319 // The conversions operations are all Alpha sorted. Please keep it that way! | |
320 //------------------------------ConvD2FNode------------------------------------ | |
321 // Convert double to float | |
322 class ConvD2FNode : public Node { | |
323 public: | |
324 ConvD2FNode( Node *in1 ) : Node(0,in1) {} | |
325 virtual int Opcode() const; | |
326 virtual const Type *bottom_type() const { return Type::FLOAT; } | |
327 virtual const Type *Value( PhaseTransform *phase ) const; | |
328 virtual Node *Identity( PhaseTransform *phase ); | |
329 virtual uint ideal_reg() const { return Op_RegF; } | |
330 }; | |
331 | |
332 //------------------------------ConvD2INode------------------------------------ | |
333 // Convert Double to Integer | |
334 class ConvD2INode : public Node { | |
335 public: | |
336 ConvD2INode( Node *in1 ) : Node(0,in1) {} | |
337 virtual int Opcode() const; | |
338 virtual const Type *bottom_type() const { return TypeInt::INT; } | |
339 virtual const Type *Value( PhaseTransform *phase ) const; | |
340 virtual Node *Identity( PhaseTransform *phase ); | |
341 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
342 virtual uint ideal_reg() const { return Op_RegI; } | |
343 }; | |
344 | |
345 //------------------------------ConvD2LNode------------------------------------ | |
346 // Convert Double to Long | |
347 class ConvD2LNode : public Node { | |
348 public: | |
349 ConvD2LNode( Node *dbl ) : Node(0,dbl) {} | |
350 virtual int Opcode() const; | |
351 virtual const Type *bottom_type() const { return TypeLong::LONG; } | |
352 virtual const Type *Value( PhaseTransform *phase ) const; | |
353 virtual Node *Identity( PhaseTransform *phase ); | |
354 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
355 virtual uint ideal_reg() const { return Op_RegL; } | |
356 }; | |
357 | |
358 //------------------------------ConvF2DNode------------------------------------ | |
359 // Convert Float to a Double. | |
360 class ConvF2DNode : public Node { | |
361 public: | |
362 ConvF2DNode( Node *in1 ) : Node(0,in1) {} | |
363 virtual int Opcode() const; | |
364 virtual const Type *bottom_type() const { return Type::DOUBLE; } | |
365 virtual const Type *Value( PhaseTransform *phase ) const; | |
366 virtual uint ideal_reg() const { return Op_RegD; } | |
367 }; | |
368 | |
369 //------------------------------ConvF2INode------------------------------------ | |
370 // Convert float to integer | |
371 class ConvF2INode : public Node { | |
372 public: | |
373 ConvF2INode( Node *in1 ) : Node(0,in1) {} | |
374 virtual int Opcode() const; | |
375 virtual const Type *bottom_type() const { return TypeInt::INT; } | |
376 virtual const Type *Value( PhaseTransform *phase ) const; | |
377 virtual Node *Identity( PhaseTransform *phase ); | |
378 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
379 virtual uint ideal_reg() const { return Op_RegI; } | |
380 }; | |
381 | |
382 //------------------------------ConvF2LNode------------------------------------ | |
383 // Convert float to long | |
384 class ConvF2LNode : public Node { | |
385 public: | |
386 ConvF2LNode( Node *in1 ) : Node(0,in1) {} | |
387 virtual int Opcode() const; | |
388 virtual const Type *bottom_type() const { return TypeLong::LONG; } | |
389 virtual const Type *Value( PhaseTransform *phase ) const; | |
390 virtual Node *Identity( PhaseTransform *phase ); | |
391 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
392 virtual uint ideal_reg() const { return Op_RegL; } | |
393 }; | |
394 | |
395 //------------------------------ConvI2DNode------------------------------------ | |
396 // Convert Integer to Double | |
397 class ConvI2DNode : public Node { | |
398 public: | |
399 ConvI2DNode( Node *in1 ) : Node(0,in1) {} | |
400 virtual int Opcode() const; | |
401 virtual const Type *bottom_type() const { return Type::DOUBLE; } | |
402 virtual const Type *Value( PhaseTransform *phase ) const; | |
403 virtual uint ideal_reg() const { return Op_RegD; } | |
404 }; | |
405 | |
406 //------------------------------ConvI2FNode------------------------------------ | |
407 // Convert Integer to Float | |
408 class ConvI2FNode : public Node { | |
409 public: | |
410 ConvI2FNode( Node *in1 ) : Node(0,in1) {} | |
411 virtual int Opcode() const; | |
412 virtual const Type *bottom_type() const { return Type::FLOAT; } | |
413 virtual const Type *Value( PhaseTransform *phase ) const; | |
414 virtual Node *Identity( PhaseTransform *phase ); | |
415 virtual uint ideal_reg() const { return Op_RegF; } | |
416 }; | |
417 | |
418 //------------------------------ConvI2LNode------------------------------------ | |
419 // Convert integer to long | |
420 class ConvI2LNode : public TypeNode { | |
421 public: | |
422 ConvI2LNode(Node *in1, const TypeLong* t = TypeLong::INT) | |
423 : TypeNode(t, 2) | |
424 { init_req(1, in1); } | |
425 virtual int Opcode() const; | |
426 virtual const Type *Value( PhaseTransform *phase ) const; | |
427 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
428 virtual uint ideal_reg() const { return Op_RegL; } | |
429 }; | |
430 | |
431 //------------------------------ConvL2DNode------------------------------------ | |
432 // Convert Long to Double | |
433 class ConvL2DNode : public Node { | |
434 public: | |
435 ConvL2DNode( Node *in1 ) : Node(0,in1) {} | |
436 virtual int Opcode() const; | |
437 virtual const Type *bottom_type() const { return Type::DOUBLE; } | |
438 virtual const Type *Value( PhaseTransform *phase ) const; | |
439 virtual uint ideal_reg() const { return Op_RegD; } | |
440 }; | |
441 | |
442 //------------------------------ConvL2FNode------------------------------------ | |
443 // Convert Long to Float | |
444 class ConvL2FNode : public Node { | |
445 public: | |
446 ConvL2FNode( Node *in1 ) : Node(0,in1) {} | |
447 virtual int Opcode() const; | |
448 virtual const Type *bottom_type() const { return Type::FLOAT; } | |
449 virtual const Type *Value( PhaseTransform *phase ) const; | |
450 virtual uint ideal_reg() const { return Op_RegF; } | |
451 }; | |
452 | |
453 //------------------------------ConvL2INode------------------------------------ | |
454 // Convert long to integer | |
455 class ConvL2INode : public Node { | |
456 public: | |
457 ConvL2INode( Node *in1 ) : Node(0,in1) {} | |
458 virtual int Opcode() const; | |
459 virtual const Type *bottom_type() const { return TypeInt::INT; } | |
460 virtual Node *Identity( PhaseTransform *phase ); | |
461 virtual const Type *Value( PhaseTransform *phase ) const; | |
462 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
463 virtual uint ideal_reg() const { return Op_RegI; } | |
464 }; | |
465 | |
466 //------------------------------CastX2PNode------------------------------------- | |
467 // convert a machine-pointer-sized integer to a raw pointer | |
468 class CastX2PNode : public Node { | |
469 public: | |
470 CastX2PNode( Node *n ) : Node(NULL, n) {} | |
471 virtual int Opcode() const; | |
472 virtual const Type *Value( PhaseTransform *phase ) const; | |
473 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
474 virtual Node *Identity( PhaseTransform *phase ); | |
475 virtual uint ideal_reg() const { return Op_RegP; } | |
476 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; } | |
477 }; | |
478 | |
479 //------------------------------CastP2XNode------------------------------------- | |
480 // Used in both 32-bit and 64-bit land. | |
481 // Used for card-marks and unsafe pointer math. | |
482 class CastP2XNode : public Node { | |
483 public: | |
484 CastP2XNode( Node *ctrl, Node *n ) : Node(ctrl, n) {} | |
485 virtual int Opcode() const; | |
486 virtual const Type *Value( PhaseTransform *phase ) const; | |
487 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); | |
488 virtual Node *Identity( PhaseTransform *phase ); | |
489 virtual uint ideal_reg() const { return Op_RegX; } | |
490 virtual const Type *bottom_type() const { return TypeX_X; } | |
491 // Return false to keep node from moving away from an associated card mark. | |
492 virtual bool depends_only_on_test() const { return false; } | |
493 }; | |
494 | |
495 //------------------------------MemMoveNode------------------------------------ | |
496 // Memory to memory move. Inserted very late, after allocation. | |
497 class MemMoveNode : public Node { | |
498 public: | |
499 MemMoveNode( Node *dst, Node *src ) : Node(0,dst,src) {} | |
500 virtual int Opcode() const; | |
501 }; | |
502 | |
503 //------------------------------ThreadLocalNode-------------------------------- | |
504 // Ideal Node which returns the base of ThreadLocalStorage. | |
505 class ThreadLocalNode : public Node { | |
506 public: | |
507 ThreadLocalNode( ) : Node((Node*)Compile::current()->root()) {} | |
508 virtual int Opcode() const; | |
509 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM;} | |
510 virtual uint ideal_reg() const { return Op_RegP; } | |
511 }; | |
512 | |
513 //------------------------------LoadReturnPCNode------------------------------- | |
514 class LoadReturnPCNode: public Node { | |
515 public: | |
516 LoadReturnPCNode(Node *c) : Node(c) { } | |
517 virtual int Opcode() const; | |
518 virtual uint ideal_reg() const { return Op_RegP; } | |
519 }; | |
520 | |
521 | |
522 //-----------------------------RoundFloatNode---------------------------------- | |
523 class RoundFloatNode: public Node { | |
524 public: | |
525 RoundFloatNode(Node* c, Node *in1): Node(c, in1) {} | |
526 virtual int Opcode() const; | |
527 virtual const Type *bottom_type() const { return Type::FLOAT; } | |
528 virtual uint ideal_reg() const { return Op_RegF; } | |
529 virtual Node *Identity( PhaseTransform *phase ); | |
530 virtual const Type *Value( PhaseTransform *phase ) const; | |
531 }; | |
532 | |
533 | |
534 //-----------------------------RoundDoubleNode--------------------------------- | |
535 class RoundDoubleNode: public Node { | |
536 public: | |
537 RoundDoubleNode(Node* c, Node *in1): Node(c, in1) {} | |
538 virtual int Opcode() const; | |
539 virtual const Type *bottom_type() const { return Type::DOUBLE; } | |
540 virtual uint ideal_reg() const { return Op_RegD; } | |
541 virtual Node *Identity( PhaseTransform *phase ); | |
542 virtual const Type *Value( PhaseTransform *phase ) const; | |
543 }; | |
544 | |
545 //------------------------------Opaque1Node------------------------------------ | |
546 // A node to prevent unwanted optimizations. Allows constant folding. | |
547 // Stops value-numbering, Ideal calls or Identity functions. | |
548 class Opaque1Node : public Node { | |
549 virtual uint hash() const ; // { return NO_HASH; } | |
550 virtual uint cmp( const Node &n ) const; | |
551 public: | |
552 Opaque1Node( Node *n ) : Node(0,n) {} | |
553 // Special version for the pre-loop to hold the original loop limit | |
554 // which is consumed by range check elimination. | |
555 Opaque1Node( Node *n, Node* orig_limit ) : Node(0,n,orig_limit) {} | |
556 Node* original_loop_limit() { return req()==3 ? in(2) : NULL; } | |
557 virtual int Opcode() const; | |
558 virtual const Type *bottom_type() const { return TypeInt::INT; } | |
559 virtual Node *Identity( PhaseTransform *phase ); | |
560 }; | |
561 | |
562 //------------------------------Opaque2Node------------------------------------ | |
563 // A node to prevent unwanted optimizations. Allows constant folding. Stops | |
564 // value-numbering, most Ideal calls or Identity functions. This Node is | |
565 // specifically designed to prevent the pre-increment value of a loop trip | |
566 // counter from being live out of the bottom of the loop (hence causing the | |
567 // pre- and post-increment values both being live and thus requiring an extra | |
568 // temp register and an extra move). If we "accidentally" optimize through | |
569 // this kind of a Node, we'll get slightly pessimal, but correct, code. Thus | |
570 // it's OK to be slightly sloppy on optimizations here. | |
571 class Opaque2Node : public Node { | |
572 virtual uint hash() const ; // { return NO_HASH; } | |
573 virtual uint cmp( const Node &n ) const; | |
574 public: | |
575 Opaque2Node( Node *n ) : Node(0,n) {} | |
576 virtual int Opcode() const; | |
577 virtual const Type *bottom_type() const { return TypeInt::INT; } | |
578 }; | |
579 | |
580 //----------------------PartialSubtypeCheckNode-------------------------------- | |
581 // The 2nd slow-half of a subtype check. Scan the subklass's 2ndary superklass | |
582 // array for an instance of the superklass. Set a hidden internal cache on a | |
583 // hit (cache is checked with exposed code in gen_subtype_check()). Return | |
584 // not zero for a miss or zero for a hit. | |
585 class PartialSubtypeCheckNode : public Node { | |
586 public: | |
587 PartialSubtypeCheckNode(Node* c, Node* sub, Node* super) : Node(c,sub,super) {} | |
588 virtual int Opcode() const; | |
589 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; } | |
590 virtual uint ideal_reg() const { return Op_RegP; } | |
591 }; | |
592 | |
593 // | |
594 class MoveI2FNode : public Node { | |
595 public: | |
596 MoveI2FNode( Node *value ) : Node(0,value) {} | |
597 virtual int Opcode() const; | |
598 virtual const Type *bottom_type() const { return Type::FLOAT; } | |
599 virtual uint ideal_reg() const { return Op_RegF; } | |
600 virtual const Type* Value( PhaseTransform *phase ) const; | |
601 }; | |
602 | |
603 class MoveL2DNode : public Node { | |
604 public: | |
605 MoveL2DNode( Node *value ) : Node(0,value) {} | |
606 virtual int Opcode() const; | |
607 virtual const Type *bottom_type() const { return Type::DOUBLE; } | |
608 virtual uint ideal_reg() const { return Op_RegD; } | |
609 virtual const Type* Value( PhaseTransform *phase ) const; | |
610 }; | |
611 | |
612 class MoveF2INode : public Node { | |
613 public: | |
614 MoveF2INode( Node *value ) : Node(0,value) {} | |
615 virtual int Opcode() const; | |
616 virtual const Type *bottom_type() const { return TypeInt::INT; } | |
617 virtual uint ideal_reg() const { return Op_RegI; } | |
618 virtual const Type* Value( PhaseTransform *phase ) const; | |
619 }; | |
620 | |
621 class MoveD2LNode : public Node { | |
622 public: | |
623 MoveD2LNode( Node *value ) : Node(0,value) {} | |
624 virtual int Opcode() const; | |
625 virtual const Type *bottom_type() const { return TypeLong::LONG; } | |
626 virtual uint ideal_reg() const { return Op_RegL; } | |
627 virtual const Type* Value( PhaseTransform *phase ) const; | |
628 }; |