|
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 |
|
81 //------------------------------ConLNode--------------------------------------- |
|
82 // Simple long constants |
|
83 class ConLNode : public ConNode { |
|
84 public: |
|
85 ConLNode( const TypeLong *t ) : ConNode(t) {} |
|
86 virtual int Opcode() const; |
|
87 |
|
88 // Factory method: |
|
89 static ConLNode* make( Compile *C ,jlong con ) { |
|
90 return new (C, 1) ConLNode( TypeLong::make(con) ); |
|
91 } |
|
92 |
|
93 }; |
|
94 |
|
95 //------------------------------ConFNode--------------------------------------- |
|
96 // Simple float constants |
|
97 class ConFNode : public ConNode { |
|
98 public: |
|
99 ConFNode( const TypeF *t ) : ConNode(t) {} |
|
100 virtual int Opcode() const; |
|
101 |
|
102 // Factory method: |
|
103 static ConFNode* make( Compile *C, float con ) { |
|
104 return new (C, 1) ConFNode( TypeF::make(con) ); |
|
105 } |
|
106 |
|
107 }; |
|
108 |
|
109 //------------------------------ConDNode--------------------------------------- |
|
110 // Simple double constants |
|
111 class ConDNode : public ConNode { |
|
112 public: |
|
113 ConDNode( const TypeD *t ) : ConNode(t) {} |
|
114 virtual int Opcode() const; |
|
115 |
|
116 // Factory method: |
|
117 static ConDNode* make( Compile *C, double con ) { |
|
118 return new (C, 1) ConDNode( TypeD::make(con) ); |
|
119 } |
|
120 |
|
121 }; |
|
122 |
|
123 //------------------------------BinaryNode------------------------------------- |
|
124 // Place holder for the 2 conditional inputs to a CMove. CMove needs 4 |
|
125 // inputs: the Bool (for the lt/gt/eq/ne bits), the flags (result of some |
|
126 // compare), and the 2 values to select between. The Matcher requires a |
|
127 // binary tree so we break it down like this: |
|
128 // (CMove (Binary bol cmp) (Binary src1 src2)) |
|
129 class BinaryNode : public Node { |
|
130 public: |
|
131 BinaryNode( Node *n1, Node *n2 ) : Node(0,n1,n2) { } |
|
132 virtual int Opcode() const; |
|
133 virtual uint ideal_reg() const { return 0; } |
|
134 }; |
|
135 |
|
136 //------------------------------CMoveNode-------------------------------------- |
|
137 // Conditional move |
|
138 class CMoveNode : public TypeNode { |
|
139 public: |
|
140 enum { Control, // When is it safe to do this cmove? |
|
141 Condition, // Condition controlling the cmove |
|
142 IfFalse, // Value if condition is false |
|
143 IfTrue }; // Value if condition is true |
|
144 CMoveNode( Node *bol, Node *left, Node *right, const Type *t ) : TypeNode(t,4) |
|
145 { |
|
146 init_class_id(Class_CMove); |
|
147 // all inputs are nullified in Node::Node(int) |
|
148 // init_req(Control,NULL); |
|
149 init_req(Condition,bol); |
|
150 init_req(IfFalse,left); |
|
151 init_req(IfTrue,right); |
|
152 } |
|
153 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
154 virtual const Type *Value( PhaseTransform *phase ) const; |
|
155 virtual Node *Identity( PhaseTransform *phase ); |
|
156 static CMoveNode *make( Compile *C, Node *c, Node *bol, Node *left, Node *right, const Type *t ); |
|
157 // Helper function to spot cmove graph shapes |
|
158 static Node *is_cmove_id( PhaseTransform *phase, Node *cmp, Node *t, Node *f, BoolNode *b ); |
|
159 }; |
|
160 |
|
161 //------------------------------CMoveDNode------------------------------------- |
|
162 class CMoveDNode : public CMoveNode { |
|
163 public: |
|
164 CMoveDNode( Node *bol, Node *left, Node *right, const Type* t) : CMoveNode(bol,left,right,t){} |
|
165 virtual int Opcode() const; |
|
166 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
167 }; |
|
168 |
|
169 //------------------------------CMoveFNode------------------------------------- |
|
170 class CMoveFNode : public CMoveNode { |
|
171 public: |
|
172 CMoveFNode( Node *bol, Node *left, Node *right, const Type* t ) : CMoveNode(bol,left,right,t) {} |
|
173 virtual int Opcode() const; |
|
174 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
175 }; |
|
176 |
|
177 //------------------------------CMoveINode------------------------------------- |
|
178 class CMoveINode : public CMoveNode { |
|
179 public: |
|
180 CMoveINode( Node *bol, Node *left, Node *right, const TypeInt *ti ) : CMoveNode(bol,left,right,ti){} |
|
181 virtual int Opcode() const; |
|
182 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
183 }; |
|
184 |
|
185 //------------------------------CMoveLNode------------------------------------- |
|
186 class CMoveLNode : public CMoveNode { |
|
187 public: |
|
188 CMoveLNode(Node *bol, Node *left, Node *right, const TypeLong *tl ) : CMoveNode(bol,left,right,tl){} |
|
189 virtual int Opcode() const; |
|
190 }; |
|
191 |
|
192 //------------------------------CMovePNode------------------------------------- |
|
193 class CMovePNode : public CMoveNode { |
|
194 public: |
|
195 CMovePNode( Node *c, Node *bol, Node *left, Node *right, const TypePtr* t ) : CMoveNode(bol,left,right,t) { init_req(Control,c); } |
|
196 virtual int Opcode() const; |
|
197 }; |
|
198 |
|
199 //------------------------------ConstraintCastNode------------------------------------- |
|
200 // cast to a different range |
|
201 class ConstraintCastNode: public TypeNode { |
|
202 public: |
|
203 ConstraintCastNode (Node *n, const Type *t ): TypeNode(t,2) { |
|
204 init_class_id(Class_ConstraintCast); |
|
205 init_req(1, n); |
|
206 } |
|
207 virtual Node *Identity( PhaseTransform *phase ); |
|
208 virtual const Type *Value( PhaseTransform *phase ) const; |
|
209 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
210 virtual int Opcode() const; |
|
211 virtual uint ideal_reg() const = 0; |
|
212 virtual Node *Ideal_DU_postCCP( PhaseCCP * ); |
|
213 }; |
|
214 |
|
215 //------------------------------CastIINode------------------------------------- |
|
216 // cast integer to integer (different range) |
|
217 class CastIINode: public ConstraintCastNode { |
|
218 public: |
|
219 CastIINode (Node *n, const Type *t ): ConstraintCastNode(n,t) {} |
|
220 virtual int Opcode() const; |
|
221 virtual uint ideal_reg() const { return Op_RegI; } |
|
222 }; |
|
223 |
|
224 //------------------------------CastPPNode------------------------------------- |
|
225 // cast pointer to pointer (different type) |
|
226 class CastPPNode: public ConstraintCastNode { |
|
227 public: |
|
228 CastPPNode (Node *n, const Type *t ): ConstraintCastNode(n, t) { |
|
229 // Only CastPP is safe. CastII can cause optimizer loops. |
|
230 init_flags(Flag_is_dead_loop_safe); |
|
231 } |
|
232 virtual int Opcode() const; |
|
233 virtual uint ideal_reg() const { return Op_RegP; } |
|
234 virtual Node *Ideal_DU_postCCP( PhaseCCP * ); |
|
235 }; |
|
236 |
|
237 //------------------------------CheckCastPPNode-------------------------------- |
|
238 // for _checkcast, cast pointer to pointer (different type), without JOIN, |
|
239 class CheckCastPPNode: public TypeNode { |
|
240 public: |
|
241 CheckCastPPNode( Node *c, Node *n, const Type *t ) : TypeNode(t,2) { |
|
242 init_class_id(Class_CheckCastPP); |
|
243 init_flags(Flag_is_dead_loop_safe); |
|
244 init_req(0, c); |
|
245 init_req(1, n); |
|
246 } |
|
247 virtual Node *Identity( PhaseTransform *phase ); |
|
248 virtual const Type *Value( PhaseTransform *phase ) const; |
|
249 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
250 virtual int Opcode() const; |
|
251 virtual uint ideal_reg() const { return Op_RegP; } |
|
252 // No longer remove CheckCast after CCP as it gives me a place to hang |
|
253 // the proper address type - which is required to compute anti-deps. |
|
254 //virtual Node *Ideal_DU_postCCP( PhaseCCP * ); |
|
255 }; |
|
256 |
|
257 //------------------------------Conv2BNode------------------------------------- |
|
258 // Convert int/pointer to a Boolean. Map zero to zero, all else to 1. |
|
259 class Conv2BNode : public Node { |
|
260 public: |
|
261 Conv2BNode( Node *i ) : Node(0,i) {} |
|
262 virtual int Opcode() const; |
|
263 virtual const Type *bottom_type() const { return TypeInt::BOOL; } |
|
264 virtual Node *Identity( PhaseTransform *phase ); |
|
265 virtual const Type *Value( PhaseTransform *phase ) const; |
|
266 virtual uint ideal_reg() const { return Op_RegI; } |
|
267 }; |
|
268 |
|
269 // The conversions operations are all Alpha sorted. Please keep it that way! |
|
270 //------------------------------ConvD2FNode------------------------------------ |
|
271 // Convert double to float |
|
272 class ConvD2FNode : public Node { |
|
273 public: |
|
274 ConvD2FNode( Node *in1 ) : Node(0,in1) {} |
|
275 virtual int Opcode() const; |
|
276 virtual const Type *bottom_type() const { return Type::FLOAT; } |
|
277 virtual const Type *Value( PhaseTransform *phase ) const; |
|
278 virtual Node *Identity( PhaseTransform *phase ); |
|
279 virtual uint ideal_reg() const { return Op_RegF; } |
|
280 }; |
|
281 |
|
282 //------------------------------ConvD2INode------------------------------------ |
|
283 // Convert Double to Integer |
|
284 class ConvD2INode : public Node { |
|
285 public: |
|
286 ConvD2INode( Node *in1 ) : Node(0,in1) {} |
|
287 virtual int Opcode() const; |
|
288 virtual const Type *bottom_type() const { return TypeInt::INT; } |
|
289 virtual const Type *Value( PhaseTransform *phase ) const; |
|
290 virtual Node *Identity( PhaseTransform *phase ); |
|
291 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
292 virtual uint ideal_reg() const { return Op_RegI; } |
|
293 }; |
|
294 |
|
295 //------------------------------ConvD2LNode------------------------------------ |
|
296 // Convert Double to Long |
|
297 class ConvD2LNode : public Node { |
|
298 public: |
|
299 ConvD2LNode( Node *dbl ) : Node(0,dbl) {} |
|
300 virtual int Opcode() const; |
|
301 virtual const Type *bottom_type() const { return TypeLong::LONG; } |
|
302 virtual const Type *Value( PhaseTransform *phase ) const; |
|
303 virtual Node *Identity( PhaseTransform *phase ); |
|
304 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
305 virtual uint ideal_reg() const { return Op_RegL; } |
|
306 }; |
|
307 |
|
308 //------------------------------ConvF2DNode------------------------------------ |
|
309 // Convert Float to a Double. |
|
310 class ConvF2DNode : public Node { |
|
311 public: |
|
312 ConvF2DNode( Node *in1 ) : Node(0,in1) {} |
|
313 virtual int Opcode() const; |
|
314 virtual const Type *bottom_type() const { return Type::DOUBLE; } |
|
315 virtual const Type *Value( PhaseTransform *phase ) const; |
|
316 virtual uint ideal_reg() const { return Op_RegD; } |
|
317 }; |
|
318 |
|
319 //------------------------------ConvF2INode------------------------------------ |
|
320 // Convert float to integer |
|
321 class ConvF2INode : public Node { |
|
322 public: |
|
323 ConvF2INode( Node *in1 ) : Node(0,in1) {} |
|
324 virtual int Opcode() const; |
|
325 virtual const Type *bottom_type() const { return TypeInt::INT; } |
|
326 virtual const Type *Value( PhaseTransform *phase ) const; |
|
327 virtual Node *Identity( PhaseTransform *phase ); |
|
328 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
329 virtual uint ideal_reg() const { return Op_RegI; } |
|
330 }; |
|
331 |
|
332 //------------------------------ConvF2LNode------------------------------------ |
|
333 // Convert float to long |
|
334 class ConvF2LNode : public Node { |
|
335 public: |
|
336 ConvF2LNode( Node *in1 ) : Node(0,in1) {} |
|
337 virtual int Opcode() const; |
|
338 virtual const Type *bottom_type() const { return TypeLong::LONG; } |
|
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_RegL; } |
|
343 }; |
|
344 |
|
345 //------------------------------ConvI2DNode------------------------------------ |
|
346 // Convert Integer to Double |
|
347 class ConvI2DNode : public Node { |
|
348 public: |
|
349 ConvI2DNode( Node *in1 ) : Node(0,in1) {} |
|
350 virtual int Opcode() const; |
|
351 virtual const Type *bottom_type() const { return Type::DOUBLE; } |
|
352 virtual const Type *Value( PhaseTransform *phase ) const; |
|
353 virtual uint ideal_reg() const { return Op_RegD; } |
|
354 }; |
|
355 |
|
356 //------------------------------ConvI2FNode------------------------------------ |
|
357 // Convert Integer to Float |
|
358 class ConvI2FNode : public Node { |
|
359 public: |
|
360 ConvI2FNode( Node *in1 ) : Node(0,in1) {} |
|
361 virtual int Opcode() const; |
|
362 virtual const Type *bottom_type() const { return Type::FLOAT; } |
|
363 virtual const Type *Value( PhaseTransform *phase ) const; |
|
364 virtual Node *Identity( PhaseTransform *phase ); |
|
365 virtual uint ideal_reg() const { return Op_RegF; } |
|
366 }; |
|
367 |
|
368 //------------------------------ConvI2LNode------------------------------------ |
|
369 // Convert integer to long |
|
370 class ConvI2LNode : public TypeNode { |
|
371 public: |
|
372 ConvI2LNode(Node *in1, const TypeLong* t = TypeLong::INT) |
|
373 : TypeNode(t, 2) |
|
374 { init_req(1, in1); } |
|
375 virtual int Opcode() const; |
|
376 virtual const Type *Value( PhaseTransform *phase ) const; |
|
377 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
378 virtual uint ideal_reg() const { return Op_RegL; } |
|
379 }; |
|
380 |
|
381 //------------------------------ConvL2DNode------------------------------------ |
|
382 // Convert Long to Double |
|
383 class ConvL2DNode : public Node { |
|
384 public: |
|
385 ConvL2DNode( Node *in1 ) : Node(0,in1) {} |
|
386 virtual int Opcode() const; |
|
387 virtual const Type *bottom_type() const { return Type::DOUBLE; } |
|
388 virtual const Type *Value( PhaseTransform *phase ) const; |
|
389 virtual uint ideal_reg() const { return Op_RegD; } |
|
390 }; |
|
391 |
|
392 //------------------------------ConvL2FNode------------------------------------ |
|
393 // Convert Long to Float |
|
394 class ConvL2FNode : public Node { |
|
395 public: |
|
396 ConvL2FNode( Node *in1 ) : Node(0,in1) {} |
|
397 virtual int Opcode() const; |
|
398 virtual const Type *bottom_type() const { return Type::FLOAT; } |
|
399 virtual const Type *Value( PhaseTransform *phase ) const; |
|
400 virtual uint ideal_reg() const { return Op_RegF; } |
|
401 }; |
|
402 |
|
403 //------------------------------ConvL2INode------------------------------------ |
|
404 // Convert long to integer |
|
405 class ConvL2INode : public Node { |
|
406 public: |
|
407 ConvL2INode( Node *in1 ) : Node(0,in1) {} |
|
408 virtual int Opcode() const; |
|
409 virtual const Type *bottom_type() const { return TypeInt::INT; } |
|
410 virtual Node *Identity( PhaseTransform *phase ); |
|
411 virtual const Type *Value( PhaseTransform *phase ) const; |
|
412 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
413 virtual uint ideal_reg() const { return Op_RegI; } |
|
414 }; |
|
415 |
|
416 //------------------------------CastX2PNode------------------------------------- |
|
417 // convert a machine-pointer-sized integer to a raw pointer |
|
418 class CastX2PNode : public Node { |
|
419 public: |
|
420 CastX2PNode( Node *n ) : Node(NULL, n) {} |
|
421 virtual int Opcode() const; |
|
422 virtual const Type *Value( PhaseTransform *phase ) const; |
|
423 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
424 virtual Node *Identity( PhaseTransform *phase ); |
|
425 virtual uint ideal_reg() const { return Op_RegP; } |
|
426 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; } |
|
427 }; |
|
428 |
|
429 //------------------------------CastP2XNode------------------------------------- |
|
430 // Used in both 32-bit and 64-bit land. |
|
431 // Used for card-marks and unsafe pointer math. |
|
432 class CastP2XNode : public Node { |
|
433 public: |
|
434 CastP2XNode( Node *ctrl, Node *n ) : Node(ctrl, n) {} |
|
435 virtual int Opcode() const; |
|
436 virtual const Type *Value( PhaseTransform *phase ) const; |
|
437 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); |
|
438 virtual Node *Identity( PhaseTransform *phase ); |
|
439 virtual uint ideal_reg() const { return Op_RegX; } |
|
440 virtual const Type *bottom_type() const { return TypeX_X; } |
|
441 // Return false to keep node from moving away from an associated card mark. |
|
442 virtual bool depends_only_on_test() const { return false; } |
|
443 }; |
|
444 |
|
445 //------------------------------MemMoveNode------------------------------------ |
|
446 // Memory to memory move. Inserted very late, after allocation. |
|
447 class MemMoveNode : public Node { |
|
448 public: |
|
449 MemMoveNode( Node *dst, Node *src ) : Node(0,dst,src) {} |
|
450 virtual int Opcode() const; |
|
451 }; |
|
452 |
|
453 //------------------------------ThreadLocalNode-------------------------------- |
|
454 // Ideal Node which returns the base of ThreadLocalStorage. |
|
455 class ThreadLocalNode : public Node { |
|
456 public: |
|
457 ThreadLocalNode( ) : Node((Node*)Compile::current()->root()) {} |
|
458 virtual int Opcode() const; |
|
459 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM;} |
|
460 virtual uint ideal_reg() const { return Op_RegP; } |
|
461 }; |
|
462 |
|
463 //------------------------------LoadReturnPCNode------------------------------- |
|
464 class LoadReturnPCNode: public Node { |
|
465 public: |
|
466 LoadReturnPCNode(Node *c) : Node(c) { } |
|
467 virtual int Opcode() const; |
|
468 virtual uint ideal_reg() const { return Op_RegP; } |
|
469 }; |
|
470 |
|
471 |
|
472 //-----------------------------RoundFloatNode---------------------------------- |
|
473 class RoundFloatNode: public Node { |
|
474 public: |
|
475 RoundFloatNode(Node* c, Node *in1): Node(c, in1) {} |
|
476 virtual int Opcode() const; |
|
477 virtual const Type *bottom_type() const { return Type::FLOAT; } |
|
478 virtual uint ideal_reg() const { return Op_RegF; } |
|
479 virtual Node *Identity( PhaseTransform *phase ); |
|
480 virtual const Type *Value( PhaseTransform *phase ) const; |
|
481 }; |
|
482 |
|
483 |
|
484 //-----------------------------RoundDoubleNode--------------------------------- |
|
485 class RoundDoubleNode: public Node { |
|
486 public: |
|
487 RoundDoubleNode(Node* c, Node *in1): Node(c, in1) {} |
|
488 virtual int Opcode() const; |
|
489 virtual const Type *bottom_type() const { return Type::DOUBLE; } |
|
490 virtual uint ideal_reg() const { return Op_RegD; } |
|
491 virtual Node *Identity( PhaseTransform *phase ); |
|
492 virtual const Type *Value( PhaseTransform *phase ) const; |
|
493 }; |
|
494 |
|
495 //------------------------------Opaque1Node------------------------------------ |
|
496 // A node to prevent unwanted optimizations. Allows constant folding. |
|
497 // Stops value-numbering, Ideal calls or Identity functions. |
|
498 class Opaque1Node : public Node { |
|
499 virtual uint hash() const ; // { return NO_HASH; } |
|
500 virtual uint cmp( const Node &n ) const; |
|
501 public: |
|
502 Opaque1Node( Node *n ) : Node(0,n) {} |
|
503 // Special version for the pre-loop to hold the original loop limit |
|
504 // which is consumed by range check elimination. |
|
505 Opaque1Node( Node *n, Node* orig_limit ) : Node(0,n,orig_limit) {} |
|
506 Node* original_loop_limit() { return req()==3 ? in(2) : NULL; } |
|
507 virtual int Opcode() const; |
|
508 virtual const Type *bottom_type() const { return TypeInt::INT; } |
|
509 virtual Node *Identity( PhaseTransform *phase ); |
|
510 }; |
|
511 |
|
512 //------------------------------Opaque2Node------------------------------------ |
|
513 // A node to prevent unwanted optimizations. Allows constant folding. Stops |
|
514 // value-numbering, most Ideal calls or Identity functions. This Node is |
|
515 // specifically designed to prevent the pre-increment value of a loop trip |
|
516 // counter from being live out of the bottom of the loop (hence causing the |
|
517 // pre- and post-increment values both being live and thus requiring an extra |
|
518 // temp register and an extra move). If we "accidentally" optimize through |
|
519 // this kind of a Node, we'll get slightly pessimal, but correct, code. Thus |
|
520 // it's OK to be slightly sloppy on optimizations here. |
|
521 class Opaque2Node : public Node { |
|
522 virtual uint hash() const ; // { return NO_HASH; } |
|
523 virtual uint cmp( const Node &n ) const; |
|
524 public: |
|
525 Opaque2Node( Node *n ) : Node(0,n) {} |
|
526 virtual int Opcode() const; |
|
527 virtual const Type *bottom_type() const { return TypeInt::INT; } |
|
528 }; |
|
529 |
|
530 //----------------------PartialSubtypeCheckNode-------------------------------- |
|
531 // The 2nd slow-half of a subtype check. Scan the subklass's 2ndary superklass |
|
532 // array for an instance of the superklass. Set a hidden internal cache on a |
|
533 // hit (cache is checked with exposed code in gen_subtype_check()). Return |
|
534 // not zero for a miss or zero for a hit. |
|
535 class PartialSubtypeCheckNode : public Node { |
|
536 public: |
|
537 PartialSubtypeCheckNode(Node* c, Node* sub, Node* super) : Node(c,sub,super) {} |
|
538 virtual int Opcode() const; |
|
539 virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; } |
|
540 virtual uint ideal_reg() const { return Op_RegP; } |
|
541 }; |
|
542 |
|
543 // |
|
544 class MoveI2FNode : public Node { |
|
545 public: |
|
546 MoveI2FNode( Node *value ) : Node(0,value) {} |
|
547 virtual int Opcode() const; |
|
548 virtual const Type *bottom_type() const { return Type::FLOAT; } |
|
549 virtual uint ideal_reg() const { return Op_RegF; } |
|
550 virtual const Type* Value( PhaseTransform *phase ) const; |
|
551 }; |
|
552 |
|
553 class MoveL2DNode : public Node { |
|
554 public: |
|
555 MoveL2DNode( Node *value ) : Node(0,value) {} |
|
556 virtual int Opcode() const; |
|
557 virtual const Type *bottom_type() const { return Type::DOUBLE; } |
|
558 virtual uint ideal_reg() const { return Op_RegD; } |
|
559 virtual const Type* Value( PhaseTransform *phase ) const; |
|
560 }; |
|
561 |
|
562 class MoveF2INode : public Node { |
|
563 public: |
|
564 MoveF2INode( Node *value ) : Node(0,value) {} |
|
565 virtual int Opcode() const; |
|
566 virtual const Type *bottom_type() const { return TypeInt::INT; } |
|
567 virtual uint ideal_reg() const { return Op_RegI; } |
|
568 virtual const Type* Value( PhaseTransform *phase ) const; |
|
569 }; |
|
570 |
|
571 class MoveD2LNode : public Node { |
|
572 public: |
|
573 MoveD2LNode( Node *value ) : Node(0,value) {} |
|
574 virtual int Opcode() const; |
|
575 virtual const Type *bottom_type() const { return TypeLong::LONG; } |
|
576 virtual uint ideal_reg() const { return Op_RegL; } |
|
577 virtual const Type* Value( PhaseTransform *phase ) const; |
|
578 }; |