< prev index next >

src/share/vm/opto/subnode.hpp

Print this page
rev 8739 : 8004073: Implement C2 Ideal node specific dump() method
Summary: add Node::dump_rel() to dump a node and its related nodes (the notion of "related" depends on the node at hand); add Node::dump_comp() to dump a node in compact representation; add Node::dump_rel_comp() to dump a node and its related nodes in compact representation; add the required machinery; extend some C2 IR nodes with compact and related dumping
Reviewed-by:
   1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  44   }
  45 
  46   // Handle algebraic identities here.  If we have an identity, return the Node
  47   // we are equivalent to.  We look for "add of zero" as an identity.
  48   virtual Node *Identity( PhaseTransform *phase );
  49 
  50   // Compute a new Type for this node.  Basically we just do the pre-check,
  51   // then call the virtual add() to set the type.
  52   virtual const Type *Value( PhaseTransform *phase ) const;
  53   const Type* Value_common( PhaseTransform *phase ) const;
  54 
  55   // Supplied function returns the subtractend of the inputs.
  56   // This also type-checks the inputs for sanity.  Guaranteed never to
  57   // be passed a TOP or BOTTOM type, these are filtered out by a pre-check.
  58   virtual const Type *sub( const Type *, const Type * ) const = 0;
  59 
  60   // Supplied function to return the additive identity type.
  61   // This is returned whenever the subtracts inputs are the same.
  62   virtual const Type *add_id() const = 0;
  63 








  64 };
  65 
  66 
  67 // NOTE: SubINode should be taken away and replaced by add and negate
  68 //------------------------------SubINode---------------------------------------
  69 // Subtract 2 integers
  70 class SubINode : public SubNode {
  71 public:
  72   SubINode( Node *in1, Node *in2 ) : SubNode(in1,in2) {}
  73   virtual int Opcode() const;
  74   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
  75   virtual const Type *sub( const Type *, const Type * ) const;
  76   const Type *add_id() const { return TypeInt::ZERO; }
  77   const Type *bottom_type() const { return TypeInt::INT; }
  78   virtual uint ideal_reg() const { return Op_RegI; }
  79 };
  80 
  81 //------------------------------SubLNode---------------------------------------
  82 // Subtract 2 integers
  83 class SubLNode : public SubNode {


 123   SubDNode( Node *in1, Node *in2 ) : SubFPNode(in1,in2) {}
 124   virtual int Opcode() const;
 125   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 126   virtual const Type *sub( const Type *, const Type * ) const;
 127   const Type   *add_id() const { return TypeD::ZERO; }
 128   const Type   *bottom_type() const { return Type::DOUBLE; }
 129   virtual uint  ideal_reg() const { return Op_RegD; }
 130 };
 131 
 132 //------------------------------CmpNode---------------------------------------
 133 // Compare 2 values, returning condition codes (-1, 0 or 1).
 134 class CmpNode : public SubNode {
 135 public:
 136   CmpNode( Node *in1, Node *in2 ) : SubNode(in1,in2) {
 137     init_class_id(Class_Cmp);
 138   }
 139   virtual Node *Identity( PhaseTransform *phase );
 140   const Type *add_id() const { return TypeInt::ZERO; }
 141   const Type *bottom_type() const { return TypeInt::CC; }
 142   virtual uint ideal_reg() const { return Op_RegFlags; }







 143 };
 144 
 145 //------------------------------CmpINode---------------------------------------
 146 // Compare 2 signed values, returning condition codes (-1, 0 or 1).
 147 class CmpINode : public CmpNode {
 148 public:
 149   CmpINode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
 150   virtual int Opcode() const;
 151   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 152   virtual const Type *sub( const Type *, const Type * ) const;
 153 };
 154 
 155 //------------------------------CmpUNode---------------------------------------
 156 // Compare 2 unsigned values (integer or pointer), returning condition codes (-1, 0 or 1).
 157 class CmpUNode : public CmpNode {
 158 public:
 159   CmpUNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
 160   virtual int Opcode() const;
 161   virtual const Type *sub( const Type *, const Type * ) const;
 162   const Type *Value( PhaseTransform *phase ) const;


 294   const BoolTest _test;
 295   BoolNode( Node *cc, BoolTest::mask t): _test(t), Node(0,cc) {
 296     init_class_id(Class_Bool);
 297   }
 298   // Convert an arbitrary int value to a Bool or other suitable predicate.
 299   static Node* make_predicate(Node* test_value, PhaseGVN* phase);
 300   // Convert self back to an integer value.
 301   Node* as_int_value(PhaseGVN* phase);
 302   // Invert sense of self, returning new Bool.
 303   BoolNode* negate(PhaseGVN* phase);
 304   virtual int Opcode() const;
 305   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 306   virtual const Type *Value( PhaseTransform *phase ) const;
 307   virtual const Type *bottom_type() const { return TypeInt::BOOL; }
 308   uint match_edge(uint idx) const { return 0; }
 309   virtual uint ideal_reg() const { return Op_RegI; }
 310 
 311   bool is_counted_loop_exit_test();
 312 #ifndef PRODUCT
 313   virtual void dump_spec(outputStream *st) const;

 314 #endif
 315 };
 316 
 317 //------------------------------AbsNode----------------------------------------
 318 // Abstract class for absolute value.  Mostly used to get a handy wrapper
 319 // for finding this pattern in the graph.
 320 class AbsNode : public Node {
 321 public:
 322   AbsNode( Node *value ) : Node(0,value) {}




 323 };
 324 
 325 //------------------------------AbsINode---------------------------------------
 326 // Absolute value an integer.  Since a naive graph involves control flow, we
 327 // "match" it in the ideal world (so the control flow can be removed).
 328 class AbsINode : public AbsNode {
 329 public:
 330   AbsINode( Node *in1 ) : AbsNode(in1) {}
 331   virtual int Opcode() const;
 332   const Type *bottom_type() const { return TypeInt::INT; }
 333   virtual uint ideal_reg() const { return Op_RegI; }
 334 };
 335 
 336 //------------------------------AbsFNode---------------------------------------
 337 // Absolute value a float, a common float-point idiom with a cheap hardware
 338 // implemention on most chips.  Since a naive graph involves control flow, we
 339 // "match" it in the ideal world (so the control flow can be removed).
 340 class AbsFNode : public AbsNode {
 341 public:
 342   AbsFNode( Node *in1 ) : AbsNode(in1) {}


 356   const Type *bottom_type() const { return Type::DOUBLE; }
 357   virtual uint ideal_reg() const { return Op_RegD; }
 358 };
 359 
 360 
 361 //------------------------------CmpLTMaskNode----------------------------------
 362 // If p < q, return -1 else return 0.  Nice for flow-free idioms.
 363 class CmpLTMaskNode : public Node {
 364 public:
 365   CmpLTMaskNode( Node *p, Node *q ) : Node(0, p, q) {}
 366   virtual int Opcode() const;
 367   const Type *bottom_type() const { return TypeInt::INT; }
 368   virtual uint ideal_reg() const { return Op_RegI; }
 369 };
 370 
 371 
 372 //------------------------------NegNode----------------------------------------
 373 class NegNode : public Node {
 374 public:
 375   NegNode( Node *in1 ) : Node(0,in1) {}




 376 };
 377 
 378 //------------------------------NegFNode---------------------------------------
 379 // Negate value a float.  Negating 0.0 returns -0.0, but subtracting from
 380 // zero returns +0.0 (per JVM spec on 'fneg' bytecode).  As subtraction
 381 // cannot be used to replace negation we have to implement negation as ideal
 382 // node; note that negation and addition can replace subtraction.
 383 class NegFNode : public NegNode {
 384 public:
 385   NegFNode( Node *in1 ) : NegNode(in1) {}
 386   virtual int Opcode() const;
 387   const Type *bottom_type() const { return Type::FLOAT; }
 388   virtual uint ideal_reg() const { return Op_RegF; }
 389 };
 390 
 391 //------------------------------NegDNode---------------------------------------
 392 // Negate value a double.  Negating 0.0 returns -0.0, but subtracting from
 393 // zero returns +0.0 (per JVM spec on 'dneg' bytecode).  As subtraction
 394 // cannot be used to replace negation we have to implement negation as ideal
 395 // node; note that negation and addition can replace subtraction.
 396 class NegDNode : public NegNode {
 397 public:
 398   NegDNode( Node *in1 ) : NegNode(in1) {}
 399   virtual int Opcode() const;
 400   const Type *bottom_type() const { return Type::DOUBLE; }
 401   virtual uint ideal_reg() const { return Op_RegD; }
 402 };
 403 
 404 //------------------------------CosDNode---------------------------------------
 405 // Cosinus of a double
 406 class CosDNode : public Node {
 407 public:
 408   CosDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 409     init_flags(Flag_is_expensive);
 410     C->add_expensive_node(this);
 411   }
 412   virtual int Opcode() const;
 413   const Type *bottom_type() const { return Type::DOUBLE; }
 414   virtual uint ideal_reg() const { return Op_RegD; }
 415   virtual const Type *Value( PhaseTransform *phase ) const;




 416 };
 417 
 418 //------------------------------CosDNode---------------------------------------
 419 // Sinus of a double
 420 class SinDNode : public Node {
 421 public:
 422   SinDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 423     init_flags(Flag_is_expensive);
 424     C->add_expensive_node(this);
 425   }
 426   virtual int Opcode() const;
 427   const Type *bottom_type() const { return Type::DOUBLE; }
 428   virtual uint ideal_reg() const { return Op_RegD; }
 429   virtual const Type *Value( PhaseTransform *phase ) const;




 430 };
 431 
 432 
 433 //------------------------------TanDNode---------------------------------------
 434 // tangens of a double
 435 class TanDNode : public Node {
 436 public:
 437   TanDNode(Compile* C, Node *c,Node *in1) : Node(c, in1) {
 438     init_flags(Flag_is_expensive);
 439     C->add_expensive_node(this);
 440   }
 441   virtual int Opcode() const;
 442   const Type *bottom_type() const { return Type::DOUBLE; }
 443   virtual uint ideal_reg() const { return Op_RegD; }
 444   virtual const Type *Value( PhaseTransform *phase ) const;




 445 };
 446 
 447 
 448 //------------------------------AtanDNode--------------------------------------
 449 // arcus tangens of a double
 450 class AtanDNode : public Node {
 451 public:
 452   AtanDNode(Node *c, Node *in1, Node *in2  ) : Node(c, in1, in2) {}
 453   virtual int Opcode() const;
 454   const Type *bottom_type() const { return Type::DOUBLE; }
 455   virtual uint ideal_reg() const { return Op_RegD; }




 456 };
 457 
 458 
 459 //------------------------------SqrtDNode--------------------------------------
 460 // square root a double
 461 class SqrtDNode : public Node {
 462 public:
 463   SqrtDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 464     init_flags(Flag_is_expensive);
 465     C->add_expensive_node(this);
 466   }
 467   virtual int Opcode() const;
 468   const Type *bottom_type() const { return Type::DOUBLE; }
 469   virtual uint ideal_reg() const { return Op_RegD; }
 470   virtual const Type *Value( PhaseTransform *phase ) const;




 471 };
 472 
 473 //------------------------------ExpDNode---------------------------------------
 474 //  Exponentiate a double
 475 class ExpDNode : public Node {
 476 public:
 477   ExpDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 478     init_flags(Flag_is_expensive);
 479     C->add_expensive_node(this);
 480   }
 481   virtual int Opcode() const;
 482   const Type *bottom_type() const { return Type::DOUBLE; }
 483   virtual uint ideal_reg() const { return Op_RegD; }
 484   virtual const Type *Value( PhaseTransform *phase ) const;




 485 };
 486 
 487 //------------------------------LogDNode---------------------------------------
 488 // Log_e of a double
 489 class LogDNode : public Node {
 490 public:
 491   LogDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 492     init_flags(Flag_is_expensive);
 493     C->add_expensive_node(this);
 494   }
 495   virtual int Opcode() const;
 496   const Type *bottom_type() const { return Type::DOUBLE; }
 497   virtual uint ideal_reg() const { return Op_RegD; }
 498   virtual const Type *Value( PhaseTransform *phase ) const;




 499 };
 500 
 501 //------------------------------Log10DNode---------------------------------------
 502 // Log_10 of a double
 503 class Log10DNode : public Node {
 504 public:
 505   Log10DNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 506     init_flags(Flag_is_expensive);
 507     C->add_expensive_node(this);
 508   }
 509   virtual int Opcode() const;
 510   const Type *bottom_type() const { return Type::DOUBLE; }
 511   virtual uint ideal_reg() const { return Op_RegD; }
 512   virtual const Type *Value( PhaseTransform *phase ) const;




 513 };
 514 
 515 //------------------------------PowDNode---------------------------------------
 516 // Raise a double to a double power
 517 class PowDNode : public Node {
 518 public:
 519   PowDNode(Compile* C, Node *c, Node *in1, Node *in2 ) : Node(c, in1, in2) {
 520     init_flags(Flag_is_expensive);
 521     C->add_expensive_node(this);
 522   }
 523   virtual int Opcode() const;
 524   const Type *bottom_type() const { return Type::DOUBLE; }
 525   virtual uint ideal_reg() const { return Op_RegD; }
 526   virtual const Type *Value( PhaseTransform *phase ) const;




 527 };
 528 
 529 //-------------------------------ReverseBytesINode--------------------------------
 530 // reverse bytes of an integer
 531 class ReverseBytesINode : public Node {
 532 public:
 533   ReverseBytesINode(Node *c, Node *in1) : Node(c, in1) {}
 534   virtual int Opcode() const;
 535   const Type *bottom_type() const { return TypeInt::INT; }
 536   virtual uint ideal_reg() const { return Op_RegI; }
 537 };
 538 
 539 //-------------------------------ReverseBytesLNode--------------------------------
 540 // reverse bytes of a long
 541 class ReverseBytesLNode : public Node {
 542 public:
 543   ReverseBytesLNode(Node *c, Node *in1) : Node(c, in1) {}
 544   virtual int Opcode() const;
 545   const Type *bottom_type() const { return TypeLong::LONG; }
 546   virtual uint ideal_reg() const { return Op_RegL; }


   1 /*
   2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  44   }
  45 
  46   // Handle algebraic identities here.  If we have an identity, return the Node
  47   // we are equivalent to.  We look for "add of zero" as an identity.
  48   virtual Node *Identity( PhaseTransform *phase );
  49 
  50   // Compute a new Type for this node.  Basically we just do the pre-check,
  51   // then call the virtual add() to set the type.
  52   virtual const Type *Value( PhaseTransform *phase ) const;
  53   const Type* Value_common( PhaseTransform *phase ) const;
  54 
  55   // Supplied function returns the subtractend of the inputs.
  56   // This also type-checks the inputs for sanity.  Guaranteed never to
  57   // be passed a TOP or BOTTOM type, these are filtered out by a pre-check.
  58   virtual const Type *sub( const Type *, const Type * ) const = 0;
  59 
  60   // Supplied function to return the additive identity type.
  61   // This is returned whenever the subtracts inputs are the same.
  62   virtual const Type *add_id() const = 0;
  63 
  64 #ifndef PRODUCT
  65   // For most subclasses of SubNode, it makes sense to take the standard
  66   // approach to related nodes computation: take all data inputs until control
  67   // boundaries are hit, and take the outputs till depth 1. This will be varied
  68   // for certain nodes that have a connection to control in themselves (such as
  69   // CmpNode and subclasses).
  70   REL_IN_DATA_OUT_1;
  71 #endif
  72 };
  73 
  74 
  75 // NOTE: SubINode should be taken away and replaced by add and negate
  76 //------------------------------SubINode---------------------------------------
  77 // Subtract 2 integers
  78 class SubINode : public SubNode {
  79 public:
  80   SubINode( Node *in1, Node *in2 ) : SubNode(in1,in2) {}
  81   virtual int Opcode() const;
  82   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
  83   virtual const Type *sub( const Type *, const Type * ) const;
  84   const Type *add_id() const { return TypeInt::ZERO; }
  85   const Type *bottom_type() const { return TypeInt::INT; }
  86   virtual uint ideal_reg() const { return Op_RegI; }
  87 };
  88 
  89 //------------------------------SubLNode---------------------------------------
  90 // Subtract 2 integers
  91 class SubLNode : public SubNode {


 131   SubDNode( Node *in1, Node *in2 ) : SubFPNode(in1,in2) {}
 132   virtual int Opcode() const;
 133   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 134   virtual const Type *sub( const Type *, const Type * ) const;
 135   const Type   *add_id() const { return TypeD::ZERO; }
 136   const Type   *bottom_type() const { return Type::DOUBLE; }
 137   virtual uint  ideal_reg() const { return Op_RegD; }
 138 };
 139 
 140 //------------------------------CmpNode---------------------------------------
 141 // Compare 2 values, returning condition codes (-1, 0 or 1).
 142 class CmpNode : public SubNode {
 143 public:
 144   CmpNode( Node *in1, Node *in2 ) : SubNode(in1,in2) {
 145     init_class_id(Class_Cmp);
 146   }
 147   virtual Node *Identity( PhaseTransform *phase );
 148   const Type *add_id() const { return TypeInt::ZERO; }
 149   const Type *bottom_type() const { return TypeInt::CC; }
 150   virtual uint ideal_reg() const { return Op_RegFlags; }
 151 
 152 #ifndef PRODUCT
 153   // CmpNode and subclasses include all data inputs (until hitting a control
 154   // boundary) in their related node set, as well as all outputs until and
 155   // including eventual control nodes and their projections.
 156   virtual void rel(GrowableArray<Node*> *in_rel, GrowableArray<Node*> *out_rel, bool compact) const;
 157 #endif
 158 };
 159 
 160 //------------------------------CmpINode---------------------------------------
 161 // Compare 2 signed values, returning condition codes (-1, 0 or 1).
 162 class CmpINode : public CmpNode {
 163 public:
 164   CmpINode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
 165   virtual int Opcode() const;
 166   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 167   virtual const Type *sub( const Type *, const Type * ) const;
 168 };
 169 
 170 //------------------------------CmpUNode---------------------------------------
 171 // Compare 2 unsigned values (integer or pointer), returning condition codes (-1, 0 or 1).
 172 class CmpUNode : public CmpNode {
 173 public:
 174   CmpUNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
 175   virtual int Opcode() const;
 176   virtual const Type *sub( const Type *, const Type * ) const;
 177   const Type *Value( PhaseTransform *phase ) const;


 309   const BoolTest _test;
 310   BoolNode( Node *cc, BoolTest::mask t): _test(t), Node(0,cc) {
 311     init_class_id(Class_Bool);
 312   }
 313   // Convert an arbitrary int value to a Bool or other suitable predicate.
 314   static Node* make_predicate(Node* test_value, PhaseGVN* phase);
 315   // Convert self back to an integer value.
 316   Node* as_int_value(PhaseGVN* phase);
 317   // Invert sense of self, returning new Bool.
 318   BoolNode* negate(PhaseGVN* phase);
 319   virtual int Opcode() const;
 320   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 321   virtual const Type *Value( PhaseTransform *phase ) const;
 322   virtual const Type *bottom_type() const { return TypeInt::BOOL; }
 323   uint match_edge(uint idx) const { return 0; }
 324   virtual uint ideal_reg() const { return Op_RegI; }
 325 
 326   bool is_counted_loop_exit_test();
 327 #ifndef PRODUCT
 328   virtual void dump_spec(outputStream *st) const;
 329   virtual void rel(GrowableArray<Node*> *in_rel, GrowableArray<Node*> *out_rel, bool compact) const;
 330 #endif
 331 };
 332 
 333 //------------------------------AbsNode----------------------------------------
 334 // Abstract class for absolute value.  Mostly used to get a handy wrapper
 335 // for finding this pattern in the graph.
 336 class AbsNode : public Node {
 337 public:
 338   AbsNode( Node *value ) : Node(0,value) {}
 339 
 340 #ifndef PRODUCT
 341   REL_IN_DATA_OUT_1;
 342 #endif
 343 };
 344 
 345 //------------------------------AbsINode---------------------------------------
 346 // Absolute value an integer.  Since a naive graph involves control flow, we
 347 // "match" it in the ideal world (so the control flow can be removed).
 348 class AbsINode : public AbsNode {
 349 public:
 350   AbsINode( Node *in1 ) : AbsNode(in1) {}
 351   virtual int Opcode() const;
 352   const Type *bottom_type() const { return TypeInt::INT; }
 353   virtual uint ideal_reg() const { return Op_RegI; }
 354 };
 355 
 356 //------------------------------AbsFNode---------------------------------------
 357 // Absolute value a float, a common float-point idiom with a cheap hardware
 358 // implemention on most chips.  Since a naive graph involves control flow, we
 359 // "match" it in the ideal world (so the control flow can be removed).
 360 class AbsFNode : public AbsNode {
 361 public:
 362   AbsFNode( Node *in1 ) : AbsNode(in1) {}


 376   const Type *bottom_type() const { return Type::DOUBLE; }
 377   virtual uint ideal_reg() const { return Op_RegD; }
 378 };
 379 
 380 
 381 //------------------------------CmpLTMaskNode----------------------------------
 382 // If p < q, return -1 else return 0.  Nice for flow-free idioms.
 383 class CmpLTMaskNode : public Node {
 384 public:
 385   CmpLTMaskNode( Node *p, Node *q ) : Node(0, p, q) {}
 386   virtual int Opcode() const;
 387   const Type *bottom_type() const { return TypeInt::INT; }
 388   virtual uint ideal_reg() const { return Op_RegI; }
 389 };
 390 
 391 
 392 //------------------------------NegNode----------------------------------------
 393 class NegNode : public Node {
 394 public:
 395   NegNode( Node *in1 ) : Node(0,in1) {}
 396 
 397 #ifndef PRODUCT
 398   REL_IN_DATA_OUT_1;
 399 #endif
 400 };
 401 
 402 //------------------------------NegFNode---------------------------------------
 403 // Negate value a float.  Negating 0.0 returns -0.0, but subtracting from
 404 // zero returns +0.0 (per JVM spec on 'fneg' bytecode).  As subtraction
 405 // cannot be used to replace negation we have to implement negation as ideal
 406 // node; note that negation and addition can replace subtraction.
 407 class NegFNode : public NegNode {
 408 public:
 409   NegFNode( Node *in1 ) : NegNode(in1) {}
 410   virtual int Opcode() const;
 411   const Type *bottom_type() const { return Type::FLOAT; }
 412   virtual uint ideal_reg() const { return Op_RegF; }
 413 };
 414 
 415 //------------------------------NegDNode---------------------------------------
 416 // Negate value a double.  Negating 0.0 returns -0.0, but subtracting from
 417 // zero returns +0.0 (per JVM spec on 'dneg' bytecode).  As subtraction
 418 // cannot be used to replace negation we have to implement negation as ideal
 419 // node; note that negation and addition can replace subtraction.
 420 class NegDNode : public NegNode {
 421 public:
 422   NegDNode( Node *in1 ) : NegNode(in1) {}
 423   virtual int Opcode() const;
 424   const Type *bottom_type() const { return Type::DOUBLE; }
 425   virtual uint ideal_reg() const { return Op_RegD; }
 426 };
 427 
 428 //------------------------------CosDNode---------------------------------------
 429 // Cosinus of a double
 430 class CosDNode : public Node {
 431 public:
 432   CosDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 433     init_flags(Flag_is_expensive);
 434     C->add_expensive_node(this);
 435   }
 436   virtual int Opcode() const;
 437   const Type *bottom_type() const { return Type::DOUBLE; }
 438   virtual uint ideal_reg() const { return Op_RegD; }
 439   virtual const Type *Value( PhaseTransform *phase ) const;
 440 
 441 #ifndef PRODUCT
 442   REL_IN_DATA_OUT_1;
 443 #endif
 444 };
 445 
 446 //------------------------------CosDNode---------------------------------------
 447 // Sinus of a double
 448 class SinDNode : public Node {
 449 public:
 450   SinDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 451     init_flags(Flag_is_expensive);
 452     C->add_expensive_node(this);
 453   }
 454   virtual int Opcode() const;
 455   const Type *bottom_type() const { return Type::DOUBLE; }
 456   virtual uint ideal_reg() const { return Op_RegD; }
 457   virtual const Type *Value( PhaseTransform *phase ) const;
 458 
 459 #ifndef PRODUCT
 460   REL_IN_DATA_OUT_1;
 461 #endif
 462 };
 463 
 464 
 465 //------------------------------TanDNode---------------------------------------
 466 // tangens of a double
 467 class TanDNode : public Node {
 468 public:
 469   TanDNode(Compile* C, Node *c,Node *in1) : Node(c, in1) {
 470     init_flags(Flag_is_expensive);
 471     C->add_expensive_node(this);
 472   }
 473   virtual int Opcode() const;
 474   const Type *bottom_type() const { return Type::DOUBLE; }
 475   virtual uint ideal_reg() const { return Op_RegD; }
 476   virtual const Type *Value( PhaseTransform *phase ) const;
 477 
 478 #ifndef PRODUCT
 479   REL_IN_DATA_OUT_1;
 480 #endif
 481 };
 482 
 483 
 484 //------------------------------AtanDNode--------------------------------------
 485 // arcus tangens of a double
 486 class AtanDNode : public Node {
 487 public:
 488   AtanDNode(Node *c, Node *in1, Node *in2  ) : Node(c, in1, in2) {}
 489   virtual int Opcode() const;
 490   const Type *bottom_type() const { return Type::DOUBLE; }
 491   virtual uint ideal_reg() const { return Op_RegD; }
 492 
 493 #ifndef PRODUCT
 494   REL_IN_DATA_OUT_1;
 495 #endif
 496 };
 497 
 498 
 499 //------------------------------SqrtDNode--------------------------------------
 500 // square root a double
 501 class SqrtDNode : public Node {
 502 public:
 503   SqrtDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 504     init_flags(Flag_is_expensive);
 505     C->add_expensive_node(this);
 506   }
 507   virtual int Opcode() const;
 508   const Type *bottom_type() const { return Type::DOUBLE; }
 509   virtual uint ideal_reg() const { return Op_RegD; }
 510   virtual const Type *Value( PhaseTransform *phase ) const;
 511 
 512 #ifndef PRODUCT
 513   REL_IN_DATA_OUT_1;
 514 #endif
 515 };
 516 
 517 //------------------------------ExpDNode---------------------------------------
 518 //  Exponentiate a double
 519 class ExpDNode : public Node {
 520 public:
 521   ExpDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 522     init_flags(Flag_is_expensive);
 523     C->add_expensive_node(this);
 524   }
 525   virtual int Opcode() const;
 526   const Type *bottom_type() const { return Type::DOUBLE; }
 527   virtual uint ideal_reg() const { return Op_RegD; }
 528   virtual const Type *Value( PhaseTransform *phase ) const;
 529 
 530 #ifndef PRODUCT
 531   REL_IN_DATA_OUT_1;
 532 #endif
 533 };
 534 
 535 //------------------------------LogDNode---------------------------------------
 536 // Log_e of a double
 537 class LogDNode : public Node {
 538 public:
 539   LogDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 540     init_flags(Flag_is_expensive);
 541     C->add_expensive_node(this);
 542   }
 543   virtual int Opcode() const;
 544   const Type *bottom_type() const { return Type::DOUBLE; }
 545   virtual uint ideal_reg() const { return Op_RegD; }
 546   virtual const Type *Value( PhaseTransform *phase ) const;
 547 
 548 #ifndef PRODUCT
 549   REL_IN_DATA_OUT_1;
 550 #endif
 551 };
 552 
 553 //------------------------------Log10DNode---------------------------------------
 554 // Log_10 of a double
 555 class Log10DNode : public Node {
 556 public:
 557   Log10DNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 558     init_flags(Flag_is_expensive);
 559     C->add_expensive_node(this);
 560   }
 561   virtual int Opcode() const;
 562   const Type *bottom_type() const { return Type::DOUBLE; }
 563   virtual uint ideal_reg() const { return Op_RegD; }
 564   virtual const Type *Value( PhaseTransform *phase ) const;
 565 
 566 #ifndef PRODUCT
 567   REL_IN_DATA_OUT_1;
 568 #endif
 569 };
 570 
 571 //------------------------------PowDNode---------------------------------------
 572 // Raise a double to a double power
 573 class PowDNode : public Node {
 574 public:
 575   PowDNode(Compile* C, Node *c, Node *in1, Node *in2 ) : Node(c, in1, in2) {
 576     init_flags(Flag_is_expensive);
 577     C->add_expensive_node(this);
 578   }
 579   virtual int Opcode() const;
 580   const Type *bottom_type() const { return Type::DOUBLE; }
 581   virtual uint ideal_reg() const { return Op_RegD; }
 582   virtual const Type *Value( PhaseTransform *phase ) const;
 583 
 584 #ifndef PRODUCT
 585   REL_IN_DATA_OUT_1;
 586 #endif
 587 };
 588 
 589 //-------------------------------ReverseBytesINode--------------------------------
 590 // reverse bytes of an integer
 591 class ReverseBytesINode : public Node {
 592 public:
 593   ReverseBytesINode(Node *c, Node *in1) : Node(c, in1) {}
 594   virtual int Opcode() const;
 595   const Type *bottom_type() const { return TypeInt::INT; }
 596   virtual uint ideal_reg() const { return Op_RegI; }
 597 };
 598 
 599 //-------------------------------ReverseBytesLNode--------------------------------
 600 // reverse bytes of a long
 601 class ReverseBytesLNode : public Node {
 602 public:
 603   ReverseBytesLNode(Node *c, Node *in1) : Node(c, in1) {}
 604   virtual int Opcode() const;
 605   const Type *bottom_type() const { return TypeLong::LONG; }
 606   virtual uint ideal_reg() const { return Op_RegL; }


< prev index next >