< prev index next >

src/share/vm/opto/subnode.hpp

Print this page




  28 #include "opto/node.hpp"
  29 #include "opto/opcodes.hpp"
  30 #include "opto/type.hpp"
  31 
  32 // Portions of code courtesy of Clifford Click
  33 
  34 //------------------------------SUBNode----------------------------------------
  35 // Class SUBTRACTION functionality.  This covers all the usual 'subtract'
  36 // behaviors.  Subtract-integer, -float, -double, binary xor, compare-integer,
  37 // -float, and -double are all inherited from this class.  The compare
  38 // functions behave like subtract functions, except that all negative answers
  39 // are compressed into -1, and all positive answers compressed to 1.
  40 class SubNode : public Node {
  41 public:
  42   SubNode( Node *in1, Node *in2 ) : Node(0,in1,in2) {
  43     init_class_id(Class_Sub);
  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 // NOTE: SubINode should be taken away and replaced by add and negate
  67 //------------------------------SubINode---------------------------------------
  68 // Subtract 2 integers
  69 class SubINode : public SubNode {
  70 public:
  71   SubINode( Node *in1, Node *in2 ) : SubNode(in1,in2) {}
  72   virtual int Opcode() const;


  80 //------------------------------SubLNode---------------------------------------
  81 // Subtract 2 integers
  82 class SubLNode : public SubNode {
  83 public:
  84   SubLNode( Node *in1, Node *in2 ) : SubNode(in1,in2) {}
  85   virtual int Opcode() const;
  86   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
  87   virtual const Type *sub( const Type *, const Type * ) const;
  88   const Type *add_id() const { return TypeLong::ZERO; }
  89   const Type *bottom_type() const { return TypeLong::LONG; }
  90   virtual uint ideal_reg() const { return Op_RegL; }
  91 };
  92 
  93 // NOTE: SubFPNode should be taken away and replaced by add and negate
  94 //------------------------------SubFPNode--------------------------------------
  95 // Subtract 2 floats or doubles
  96 class SubFPNode : public SubNode {
  97 protected:
  98   SubFPNode( Node *in1, Node *in2 ) : SubNode(in1,in2) {}
  99 public:
 100   const Type *Value( PhaseTransform *phase ) const;
 101 };
 102 
 103 // NOTE: SubFNode should be taken away and replaced by add and negate
 104 //------------------------------SubFNode---------------------------------------
 105 // Subtract 2 doubles
 106 class SubFNode : public SubFPNode {
 107 public:
 108   SubFNode( Node *in1, Node *in2 ) : SubFPNode(in1,in2) {}
 109   virtual int Opcode() const;
 110   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 111   virtual const Type *sub( const Type *, const Type * ) const;
 112   const Type   *add_id() const { return TypeF::ZERO; }
 113   const Type   *bottom_type() const { return Type::FLOAT; }
 114   virtual uint  ideal_reg() const { return Op_RegF; }
 115 };
 116 
 117 // NOTE: SubDNode should be taken away and replaced by add and negate
 118 //------------------------------SubDNode---------------------------------------
 119 // Subtract 2 doubles
 120 class SubDNode : public SubFPNode {
 121 public:
 122   SubDNode( Node *in1, Node *in2 ) : SubFPNode(in1,in2) {}
 123   virtual int Opcode() const;
 124   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 125   virtual const Type *sub( const Type *, const Type * ) const;
 126   const Type   *add_id() const { return TypeD::ZERO; }
 127   const Type   *bottom_type() const { return Type::DOUBLE; }
 128   virtual uint  ideal_reg() const { return Op_RegD; }
 129 };
 130 
 131 //------------------------------CmpNode---------------------------------------
 132 // Compare 2 values, returning condition codes (-1, 0 or 1).
 133 class CmpNode : public SubNode {
 134 public:
 135   CmpNode( Node *in1, Node *in2 ) : SubNode(in1,in2) {
 136     init_class_id(Class_Cmp);
 137   }
 138   virtual Node *Identity( PhaseTransform *phase );
 139   const Type *add_id() const { return TypeInt::ZERO; }
 140   const Type *bottom_type() const { return TypeInt::CC; }
 141   virtual uint ideal_reg() const { return Op_RegFlags; }
 142 
 143 #ifndef PRODUCT
 144   // CmpNode and subclasses include all data inputs (until hitting a control
 145   // boundary) in their related node set, as well as all outputs until and
 146   // including eventual control nodes and their projections.
 147   virtual void related(GrowableArray<Node*> *in_rel, GrowableArray<Node*> *out_rel, bool compact) const;
 148 #endif
 149 };
 150 
 151 //------------------------------CmpINode---------------------------------------
 152 // Compare 2 signed values, returning condition codes (-1, 0 or 1).
 153 class CmpINode : public CmpNode {
 154 public:
 155   CmpINode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
 156   virtual int Opcode() const;
 157   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 158   virtual const Type *sub( const Type *, const Type * ) const;
 159 };
 160 
 161 //------------------------------CmpUNode---------------------------------------
 162 // Compare 2 unsigned values (integer or pointer), returning condition codes (-1, 0 or 1).
 163 class CmpUNode : public CmpNode {
 164 public:
 165   CmpUNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
 166   virtual int Opcode() const;
 167   virtual const Type *sub( const Type *, const Type * ) const;
 168   const Type *Value( PhaseTransform *phase ) const;
 169   bool is_index_range_check() const;
 170 };
 171 
 172 //------------------------------CmpPNode---------------------------------------
 173 // Compare 2 pointer values, returning condition codes (-1, 0 or 1).
 174 class CmpPNode : public CmpNode {
 175 public:
 176   CmpPNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
 177   virtual int Opcode() const;
 178   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 179   virtual const Type *sub( const Type *, const Type * ) const;
 180 };
 181 
 182 //------------------------------CmpNNode--------------------------------------
 183 // Compare 2 narrow oop values, returning condition codes (-1, 0 or 1).
 184 class CmpNNode : public CmpNode {
 185 public:
 186   CmpNNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
 187   virtual int Opcode() const;
 188   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);


 202 // Compare 2 long values, returning integer value (-1, 0 or 1).
 203 class CmpL3Node : public CmpLNode {
 204 public:
 205   CmpL3Node( Node *in1, Node *in2 ) : CmpLNode(in1,in2) {
 206     // Since it is not consumed by Bools, it is not really a Cmp.
 207     init_class_id(Class_Sub);
 208   }
 209   virtual int    Opcode() const;
 210   virtual uint ideal_reg() const { return Op_RegI; }
 211 };
 212 
 213 //------------------------------CmpFNode---------------------------------------
 214 // Compare 2 float values, returning condition codes (-1, 0 or 1).
 215 // This implements the Java bytecode fcmpl, so unordered returns -1.
 216 // Operands may not commute.
 217 class CmpFNode : public CmpNode {
 218 public:
 219   CmpFNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
 220   virtual int Opcode() const;
 221   virtual const Type *sub( const Type *, const Type * ) const { ShouldNotReachHere(); return NULL; }
 222   const Type *Value( PhaseTransform *phase ) const;
 223 };
 224 
 225 //------------------------------CmpF3Node--------------------------------------
 226 // Compare 2 float values, returning integer value (-1, 0 or 1).
 227 // This implements the Java bytecode fcmpl, so unordered returns -1.
 228 // Operands may not commute.
 229 class CmpF3Node : public CmpFNode {
 230 public:
 231   CmpF3Node( Node *in1, Node *in2 ) : CmpFNode(in1,in2) {
 232     // Since it is not consumed by Bools, it is not really a Cmp.
 233     init_class_id(Class_Sub);
 234   }
 235   virtual int Opcode() const;
 236   // Since it is not consumed by Bools, it is not really a Cmp.
 237   virtual uint ideal_reg() const { return Op_RegI; }
 238 };
 239 
 240 
 241 //------------------------------CmpDNode---------------------------------------
 242 // Compare 2 double values, returning condition codes (-1, 0 or 1).
 243 // This implements the Java bytecode dcmpl, so unordered returns -1.
 244 // Operands may not commute.
 245 class CmpDNode : public CmpNode {
 246 public:
 247   CmpDNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
 248   virtual int Opcode() const;
 249   virtual const Type *sub( const Type *, const Type * ) const { ShouldNotReachHere(); return NULL; }
 250   const Type *Value( PhaseTransform *phase ) const;
 251   virtual Node  *Ideal(PhaseGVN *phase, bool can_reshape);
 252 };
 253 
 254 //------------------------------CmpD3Node--------------------------------------
 255 // Compare 2 double values, returning integer value (-1, 0 or 1).
 256 // This implements the Java bytecode dcmpl, so unordered returns -1.
 257 // Operands may not commute.
 258 class CmpD3Node : public CmpDNode {
 259 public:
 260   CmpD3Node( Node *in1, Node *in2 ) : CmpDNode(in1,in2) {
 261     // Since it is not consumed by Bools, it is not really a Cmp.
 262     init_class_id(Class_Sub);
 263   }
 264   virtual int Opcode() const;
 265   virtual uint ideal_reg() const { return Op_RegI; }
 266 };
 267 
 268 
 269 //------------------------------BoolTest---------------------------------------
 270 // Convert condition codes to a boolean test value (0 or -1).


 292   virtual uint hash() const;
 293   virtual uint cmp( const Node &n ) const;
 294   virtual uint size_of() const;
 295 
 296   // Try to optimize signed integer comparison
 297   Node* fold_cmpI(PhaseGVN* phase, SubNode* cmp, Node* cmp1, int cmp_op,
 298                   int cmp1_op, const TypeInt* cmp2_type);
 299 public:
 300   const BoolTest _test;
 301   BoolNode( Node *cc, BoolTest::mask t): _test(t), Node(0,cc) {
 302     init_class_id(Class_Bool);
 303   }
 304   // Convert an arbitrary int value to a Bool or other suitable predicate.
 305   static Node* make_predicate(Node* test_value, PhaseGVN* phase);
 306   // Convert self back to an integer value.
 307   Node* as_int_value(PhaseGVN* phase);
 308   // Invert sense of self, returning new Bool.
 309   BoolNode* negate(PhaseGVN* phase);
 310   virtual int Opcode() const;
 311   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 312   virtual const Type *Value( PhaseTransform *phase ) const;
 313   virtual const Type *bottom_type() const { return TypeInt::BOOL; }
 314   uint match_edge(uint idx) const { return 0; }
 315   virtual uint ideal_reg() const { return Op_RegI; }
 316 
 317   bool is_counted_loop_exit_test();
 318 #ifndef PRODUCT
 319   virtual void dump_spec(outputStream *st) const;
 320   virtual void related(GrowableArray<Node*> *in_rel, GrowableArray<Node*> *out_rel, bool compact) const;
 321 #endif
 322 };
 323 
 324 //------------------------------AbsNode----------------------------------------
 325 // Abstract class for absolute value.  Mostly used to get a handy wrapper
 326 // for finding this pattern in the graph.
 327 class AbsNode : public Node {
 328 public:
 329   AbsNode( Node *value ) : Node(0,value) {}
 330 };
 331 
 332 //------------------------------AbsINode---------------------------------------


 402 // node; note that negation and addition can replace subtraction.
 403 class NegDNode : public NegNode {
 404 public:
 405   NegDNode( Node *in1 ) : NegNode(in1) {}
 406   virtual int Opcode() const;
 407   const Type *bottom_type() const { return Type::DOUBLE; }
 408   virtual uint ideal_reg() const { return Op_RegD; }
 409 };
 410 
 411 //------------------------------CosDNode---------------------------------------
 412 // Cosinus of a double
 413 class CosDNode : public Node {
 414 public:
 415   CosDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 416     init_flags(Flag_is_expensive);
 417     C->add_expensive_node(this);
 418   }
 419   virtual int Opcode() const;
 420   const Type *bottom_type() const { return Type::DOUBLE; }
 421   virtual uint ideal_reg() const { return Op_RegD; }
 422   virtual const Type *Value( PhaseTransform *phase ) const;
 423 };
 424 
 425 //------------------------------CosDNode---------------------------------------
 426 // Sinus of a double
 427 class SinDNode : public Node {
 428 public:
 429   SinDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 430     init_flags(Flag_is_expensive);
 431     C->add_expensive_node(this);
 432   }
 433   virtual int Opcode() const;
 434   const Type *bottom_type() const { return Type::DOUBLE; }
 435   virtual uint ideal_reg() const { return Op_RegD; }
 436   virtual const Type *Value( PhaseTransform *phase ) const;
 437 };
 438 
 439 
 440 //------------------------------TanDNode---------------------------------------
 441 // tangens of a double
 442 class TanDNode : public Node {
 443 public:
 444   TanDNode(Compile* C, Node *c,Node *in1) : Node(c, in1) {
 445     init_flags(Flag_is_expensive);
 446     C->add_expensive_node(this);
 447   }
 448   virtual int Opcode() const;
 449   const Type *bottom_type() const { return Type::DOUBLE; }
 450   virtual uint ideal_reg() const { return Op_RegD; }
 451   virtual const Type *Value( PhaseTransform *phase ) const;
 452 };
 453 
 454 
 455 //------------------------------AtanDNode--------------------------------------
 456 // arcus tangens of a double
 457 class AtanDNode : public Node {
 458 public:
 459   AtanDNode(Node *c, Node *in1, Node *in2  ) : Node(c, in1, in2) {}
 460   virtual int Opcode() const;
 461   const Type *bottom_type() const { return Type::DOUBLE; }
 462   virtual uint ideal_reg() const { return Op_RegD; }
 463 };
 464 
 465 
 466 //------------------------------SqrtDNode--------------------------------------
 467 // square root a double
 468 class SqrtDNode : public Node {
 469 public:
 470   SqrtDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 471     init_flags(Flag_is_expensive);
 472     C->add_expensive_node(this);
 473   }
 474   virtual int Opcode() const;
 475   const Type *bottom_type() const { return Type::DOUBLE; }
 476   virtual uint ideal_reg() const { return Op_RegD; }
 477   virtual const Type *Value( PhaseTransform *phase ) const;
 478 };
 479 
 480 //------------------------------Log10DNode---------------------------------------
 481 // Log_10 of a double
 482 class Log10DNode : public Node {
 483 public:
 484   Log10DNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 485     init_flags(Flag_is_expensive);
 486     C->add_expensive_node(this);
 487   }
 488   virtual int Opcode() const;
 489   const Type *bottom_type() const { return Type::DOUBLE; }
 490   virtual uint ideal_reg() const { return Op_RegD; }
 491   virtual const Type *Value( PhaseTransform *phase ) const;
 492 };
 493 
 494 //-------------------------------ReverseBytesINode--------------------------------
 495 // reverse bytes of an integer
 496 class ReverseBytesINode : public Node {
 497 public:
 498   ReverseBytesINode(Node *c, Node *in1) : Node(c, in1) {}
 499   virtual int Opcode() const;
 500   const Type *bottom_type() const { return TypeInt::INT; }
 501   virtual uint ideal_reg() const { return Op_RegI; }
 502 };
 503 
 504 //-------------------------------ReverseBytesLNode--------------------------------
 505 // reverse bytes of a long
 506 class ReverseBytesLNode : public Node {
 507 public:
 508   ReverseBytesLNode(Node *c, Node *in1) : Node(c, in1) {}
 509   virtual int Opcode() const;
 510   const Type *bottom_type() const { return TypeLong::LONG; }
 511   virtual uint ideal_reg() const { return Op_RegL; }




  28 #include "opto/node.hpp"
  29 #include "opto/opcodes.hpp"
  30 #include "opto/type.hpp"
  31 
  32 // Portions of code courtesy of Clifford Click
  33 
  34 //------------------------------SUBNode----------------------------------------
  35 // Class SUBTRACTION functionality.  This covers all the usual 'subtract'
  36 // behaviors.  Subtract-integer, -float, -double, binary xor, compare-integer,
  37 // -float, and -double are all inherited from this class.  The compare
  38 // functions behave like subtract functions, except that all negative answers
  39 // are compressed into -1, and all positive answers compressed to 1.
  40 class SubNode : public Node {
  41 public:
  42   SubNode( Node *in1, Node *in2 ) : Node(0,in1,in2) {
  43     init_class_id(Class_Sub);
  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(PhaseGVN* 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(PhaseGVN* 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 // NOTE: SubINode should be taken away and replaced by add and negate
  67 //------------------------------SubINode---------------------------------------
  68 // Subtract 2 integers
  69 class SubINode : public SubNode {
  70 public:
  71   SubINode( Node *in1, Node *in2 ) : SubNode(in1,in2) {}
  72   virtual int Opcode() const;


  80 //------------------------------SubLNode---------------------------------------
  81 // Subtract 2 integers
  82 class SubLNode : public SubNode {
  83 public:
  84   SubLNode( Node *in1, Node *in2 ) : SubNode(in1,in2) {}
  85   virtual int Opcode() const;
  86   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
  87   virtual const Type *sub( const Type *, const Type * ) const;
  88   const Type *add_id() const { return TypeLong::ZERO; }
  89   const Type *bottom_type() const { return TypeLong::LONG; }
  90   virtual uint ideal_reg() const { return Op_RegL; }
  91 };
  92 
  93 // NOTE: SubFPNode should be taken away and replaced by add and negate
  94 //------------------------------SubFPNode--------------------------------------
  95 // Subtract 2 floats or doubles
  96 class SubFPNode : public SubNode {
  97 protected:
  98   SubFPNode( Node *in1, Node *in2 ) : SubNode(in1,in2) {}
  99 public:
 100   const Type* Value(PhaseGVN* phase) const;
 101 };
 102 
 103 // NOTE: SubFNode should be taken away and replaced by add and negate
 104 //------------------------------SubFNode---------------------------------------
 105 // Subtract 2 doubles
 106 class SubFNode : public SubFPNode {
 107 public:
 108   SubFNode( Node *in1, Node *in2 ) : SubFPNode(in1,in2) {}
 109   virtual int Opcode() const;
 110   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 111   virtual const Type *sub( const Type *, const Type * ) const;
 112   const Type   *add_id() const { return TypeF::ZERO; }
 113   const Type   *bottom_type() const { return Type::FLOAT; }
 114   virtual uint  ideal_reg() const { return Op_RegF; }
 115 };
 116 
 117 // NOTE: SubDNode should be taken away and replaced by add and negate
 118 //------------------------------SubDNode---------------------------------------
 119 // Subtract 2 doubles
 120 class SubDNode : public SubFPNode {
 121 public:
 122   SubDNode( Node *in1, Node *in2 ) : SubFPNode(in1,in2) {}
 123   virtual int Opcode() const;
 124   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 125   virtual const Type *sub( const Type *, const Type * ) const;
 126   const Type   *add_id() const { return TypeD::ZERO; }
 127   const Type   *bottom_type() const { return Type::DOUBLE; }
 128   virtual uint  ideal_reg() const { return Op_RegD; }
 129 };
 130 
 131 //------------------------------CmpNode---------------------------------------
 132 // Compare 2 values, returning condition codes (-1, 0 or 1).
 133 class CmpNode : public SubNode {
 134 public:
 135   CmpNode( Node *in1, Node *in2 ) : SubNode(in1,in2) {
 136     init_class_id(Class_Cmp);
 137   }
 138   virtual Node* Identity(PhaseGVN* phase);
 139   const Type *add_id() const { return TypeInt::ZERO; }
 140   const Type *bottom_type() const { return TypeInt::CC; }
 141   virtual uint ideal_reg() const { return Op_RegFlags; }
 142 
 143 #ifndef PRODUCT
 144   // CmpNode and subclasses include all data inputs (until hitting a control
 145   // boundary) in their related node set, as well as all outputs until and
 146   // including eventual control nodes and their projections.
 147   virtual void related(GrowableArray<Node*> *in_rel, GrowableArray<Node*> *out_rel, bool compact) const;
 148 #endif
 149 };
 150 
 151 //------------------------------CmpINode---------------------------------------
 152 // Compare 2 signed values, returning condition codes (-1, 0 or 1).
 153 class CmpINode : public CmpNode {
 154 public:
 155   CmpINode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
 156   virtual int Opcode() const;
 157   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 158   virtual const Type *sub( const Type *, const Type * ) const;
 159 };
 160 
 161 //------------------------------CmpUNode---------------------------------------
 162 // Compare 2 unsigned values (integer or pointer), returning condition codes (-1, 0 or 1).
 163 class CmpUNode : public CmpNode {
 164 public:
 165   CmpUNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
 166   virtual int Opcode() const;
 167   virtual const Type *sub( const Type *, const Type * ) const;
 168   const Type* Value(PhaseGVN* phase) const;
 169   bool is_index_range_check() const;
 170 };
 171 
 172 //------------------------------CmpPNode---------------------------------------
 173 // Compare 2 pointer values, returning condition codes (-1, 0 or 1).
 174 class CmpPNode : public CmpNode {
 175 public:
 176   CmpPNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
 177   virtual int Opcode() const;
 178   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 179   virtual const Type *sub( const Type *, const Type * ) const;
 180 };
 181 
 182 //------------------------------CmpNNode--------------------------------------
 183 // Compare 2 narrow oop values, returning condition codes (-1, 0 or 1).
 184 class CmpNNode : public CmpNode {
 185 public:
 186   CmpNNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
 187   virtual int Opcode() const;
 188   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);


 202 // Compare 2 long values, returning integer value (-1, 0 or 1).
 203 class CmpL3Node : public CmpLNode {
 204 public:
 205   CmpL3Node( Node *in1, Node *in2 ) : CmpLNode(in1,in2) {
 206     // Since it is not consumed by Bools, it is not really a Cmp.
 207     init_class_id(Class_Sub);
 208   }
 209   virtual int    Opcode() const;
 210   virtual uint ideal_reg() const { return Op_RegI; }
 211 };
 212 
 213 //------------------------------CmpFNode---------------------------------------
 214 // Compare 2 float values, returning condition codes (-1, 0 or 1).
 215 // This implements the Java bytecode fcmpl, so unordered returns -1.
 216 // Operands may not commute.
 217 class CmpFNode : public CmpNode {
 218 public:
 219   CmpFNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
 220   virtual int Opcode() const;
 221   virtual const Type *sub( const Type *, const Type * ) const { ShouldNotReachHere(); return NULL; }
 222   const Type* Value(PhaseGVN* phase) const;
 223 };
 224 
 225 //------------------------------CmpF3Node--------------------------------------
 226 // Compare 2 float values, returning integer value (-1, 0 or 1).
 227 // This implements the Java bytecode fcmpl, so unordered returns -1.
 228 // Operands may not commute.
 229 class CmpF3Node : public CmpFNode {
 230 public:
 231   CmpF3Node( Node *in1, Node *in2 ) : CmpFNode(in1,in2) {
 232     // Since it is not consumed by Bools, it is not really a Cmp.
 233     init_class_id(Class_Sub);
 234   }
 235   virtual int Opcode() const;
 236   // Since it is not consumed by Bools, it is not really a Cmp.
 237   virtual uint ideal_reg() const { return Op_RegI; }
 238 };
 239 
 240 
 241 //------------------------------CmpDNode---------------------------------------
 242 // Compare 2 double values, returning condition codes (-1, 0 or 1).
 243 // This implements the Java bytecode dcmpl, so unordered returns -1.
 244 // Operands may not commute.
 245 class CmpDNode : public CmpNode {
 246 public:
 247   CmpDNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
 248   virtual int Opcode() const;
 249   virtual const Type *sub( const Type *, const Type * ) const { ShouldNotReachHere(); return NULL; }
 250   const Type* Value(PhaseGVN* phase) const;
 251   virtual Node  *Ideal(PhaseGVN *phase, bool can_reshape);
 252 };
 253 
 254 //------------------------------CmpD3Node--------------------------------------
 255 // Compare 2 double values, returning integer value (-1, 0 or 1).
 256 // This implements the Java bytecode dcmpl, so unordered returns -1.
 257 // Operands may not commute.
 258 class CmpD3Node : public CmpDNode {
 259 public:
 260   CmpD3Node( Node *in1, Node *in2 ) : CmpDNode(in1,in2) {
 261     // Since it is not consumed by Bools, it is not really a Cmp.
 262     init_class_id(Class_Sub);
 263   }
 264   virtual int Opcode() const;
 265   virtual uint ideal_reg() const { return Op_RegI; }
 266 };
 267 
 268 
 269 //------------------------------BoolTest---------------------------------------
 270 // Convert condition codes to a boolean test value (0 or -1).


 292   virtual uint hash() const;
 293   virtual uint cmp( const Node &n ) const;
 294   virtual uint size_of() const;
 295 
 296   // Try to optimize signed integer comparison
 297   Node* fold_cmpI(PhaseGVN* phase, SubNode* cmp, Node* cmp1, int cmp_op,
 298                   int cmp1_op, const TypeInt* cmp2_type);
 299 public:
 300   const BoolTest _test;
 301   BoolNode( Node *cc, BoolTest::mask t): _test(t), Node(0,cc) {
 302     init_class_id(Class_Bool);
 303   }
 304   // Convert an arbitrary int value to a Bool or other suitable predicate.
 305   static Node* make_predicate(Node* test_value, PhaseGVN* phase);
 306   // Convert self back to an integer value.
 307   Node* as_int_value(PhaseGVN* phase);
 308   // Invert sense of self, returning new Bool.
 309   BoolNode* negate(PhaseGVN* phase);
 310   virtual int Opcode() const;
 311   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 312   virtual const Type* Value(PhaseGVN* phase) const;
 313   virtual const Type *bottom_type() const { return TypeInt::BOOL; }
 314   uint match_edge(uint idx) const { return 0; }
 315   virtual uint ideal_reg() const { return Op_RegI; }
 316 
 317   bool is_counted_loop_exit_test();
 318 #ifndef PRODUCT
 319   virtual void dump_spec(outputStream *st) const;
 320   virtual void related(GrowableArray<Node*> *in_rel, GrowableArray<Node*> *out_rel, bool compact) const;
 321 #endif
 322 };
 323 
 324 //------------------------------AbsNode----------------------------------------
 325 // Abstract class for absolute value.  Mostly used to get a handy wrapper
 326 // for finding this pattern in the graph.
 327 class AbsNode : public Node {
 328 public:
 329   AbsNode( Node *value ) : Node(0,value) {}
 330 };
 331 
 332 //------------------------------AbsINode---------------------------------------


 402 // node; note that negation and addition can replace subtraction.
 403 class NegDNode : public NegNode {
 404 public:
 405   NegDNode( Node *in1 ) : NegNode(in1) {}
 406   virtual int Opcode() const;
 407   const Type *bottom_type() const { return Type::DOUBLE; }
 408   virtual uint ideal_reg() const { return Op_RegD; }
 409 };
 410 
 411 //------------------------------CosDNode---------------------------------------
 412 // Cosinus of a double
 413 class CosDNode : public Node {
 414 public:
 415   CosDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 416     init_flags(Flag_is_expensive);
 417     C->add_expensive_node(this);
 418   }
 419   virtual int Opcode() const;
 420   const Type *bottom_type() const { return Type::DOUBLE; }
 421   virtual uint ideal_reg() const { return Op_RegD; }
 422   virtual const Type* Value(PhaseGVN* phase) const;
 423 };
 424 
 425 //------------------------------CosDNode---------------------------------------
 426 // Sinus of a double
 427 class SinDNode : public Node {
 428 public:
 429   SinDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 430     init_flags(Flag_is_expensive);
 431     C->add_expensive_node(this);
 432   }
 433   virtual int Opcode() const;
 434   const Type *bottom_type() const { return Type::DOUBLE; }
 435   virtual uint ideal_reg() const { return Op_RegD; }
 436   virtual const Type* Value(PhaseGVN* phase) const;
 437 };
 438 
 439 
 440 //------------------------------TanDNode---------------------------------------
 441 // tangens of a double
 442 class TanDNode : public Node {
 443 public:
 444   TanDNode(Compile* C, Node *c,Node *in1) : Node(c, in1) {
 445     init_flags(Flag_is_expensive);
 446     C->add_expensive_node(this);
 447   }
 448   virtual int Opcode() const;
 449   const Type *bottom_type() const { return Type::DOUBLE; }
 450   virtual uint ideal_reg() const { return Op_RegD; }
 451   virtual const Type* Value(PhaseGVN* phase) const;
 452 };
 453 
 454 
 455 //------------------------------AtanDNode--------------------------------------
 456 // arcus tangens of a double
 457 class AtanDNode : public Node {
 458 public:
 459   AtanDNode(Node *c, Node *in1, Node *in2  ) : Node(c, in1, in2) {}
 460   virtual int Opcode() const;
 461   const Type *bottom_type() const { return Type::DOUBLE; }
 462   virtual uint ideal_reg() const { return Op_RegD; }
 463 };
 464 
 465 
 466 //------------------------------SqrtDNode--------------------------------------
 467 // square root a double
 468 class SqrtDNode : public Node {
 469 public:
 470   SqrtDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 471     init_flags(Flag_is_expensive);
 472     C->add_expensive_node(this);
 473   }
 474   virtual int Opcode() const;
 475   const Type *bottom_type() const { return Type::DOUBLE; }
 476   virtual uint ideal_reg() const { return Op_RegD; }
 477   virtual const Type* Value(PhaseGVN* phase) const;
 478 };
 479 
 480 //------------------------------Log10DNode---------------------------------------
 481 // Log_10 of a double
 482 class Log10DNode : public Node {
 483 public:
 484   Log10DNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
 485     init_flags(Flag_is_expensive);
 486     C->add_expensive_node(this);
 487   }
 488   virtual int Opcode() const;
 489   const Type *bottom_type() const { return Type::DOUBLE; }
 490   virtual uint ideal_reg() const { return Op_RegD; }
 491   virtual const Type* Value(PhaseGVN* phase) const;
 492 };
 493 
 494 //-------------------------------ReverseBytesINode--------------------------------
 495 // reverse bytes of an integer
 496 class ReverseBytesINode : public Node {
 497 public:
 498   ReverseBytesINode(Node *c, Node *in1) : Node(c, in1) {}
 499   virtual int Opcode() const;
 500   const Type *bottom_type() const { return TypeInt::INT; }
 501   virtual uint ideal_reg() const { return Op_RegI; }
 502 };
 503 
 504 //-------------------------------ReverseBytesLNode--------------------------------
 505 // reverse bytes of a long
 506 class ReverseBytesLNode : public Node {
 507 public:
 508   ReverseBytesLNode(Node *c, Node *in1) : Node(c, in1) {}
 509   virtual int Opcode() const;
 510   const Type *bottom_type() const { return TypeLong::LONG; }
 511   virtual uint ideal_reg() const { return Op_RegL; }


< prev index next >