hotspot/src/share/vm/opto/divnode.hpp
changeset 35551 36ef3841fb34
parent 25930 eae8b7490d2c
equal deleted inserted replaced
35550:633a22d66bd7 35551:36ef3841fb34
    42 // the matcher or runtime system must take care of this.
    42 // the matcher or runtime system must take care of this.
    43 class DivINode : public Node {
    43 class DivINode : public Node {
    44 public:
    44 public:
    45   DivINode( Node *c, Node *dividend, Node *divisor ) : Node(c, dividend, divisor ) {}
    45   DivINode( Node *c, Node *dividend, Node *divisor ) : Node(c, dividend, divisor ) {}
    46   virtual int Opcode() const;
    46   virtual int Opcode() const;
    47   virtual Node *Identity( PhaseTransform *phase );
    47   virtual Node* Identity(PhaseGVN* phase);
    48   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
    48   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
    49   virtual const Type *Value( PhaseTransform *phase ) const;
    49   virtual const Type* Value(PhaseGVN* phase) const;
    50   virtual const Type *bottom_type() const { return TypeInt::INT; }
    50   virtual const Type *bottom_type() const { return TypeInt::INT; }
    51   virtual uint ideal_reg() const { return Op_RegI; }
    51   virtual uint ideal_reg() const { return Op_RegI; }
    52 };
    52 };
    53 
    53 
    54 //------------------------------DivLNode---------------------------------------
    54 //------------------------------DivLNode---------------------------------------
    55 // Long division
    55 // Long division
    56 class DivLNode : public Node {
    56 class DivLNode : public Node {
    57 public:
    57 public:
    58   DivLNode( Node *c, Node *dividend, Node *divisor ) : Node(c, dividend, divisor ) {}
    58   DivLNode( Node *c, Node *dividend, Node *divisor ) : Node(c, dividend, divisor ) {}
    59   virtual int Opcode() const;
    59   virtual int Opcode() const;
    60   virtual Node *Identity( PhaseTransform *phase );
    60   virtual Node* Identity(PhaseGVN* phase);
    61   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
    61   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
    62   virtual const Type *Value( PhaseTransform *phase ) const;
    62   virtual const Type* Value(PhaseGVN* phase) const;
    63   virtual const Type *bottom_type() const { return TypeLong::LONG; }
    63   virtual const Type *bottom_type() const { return TypeLong::LONG; }
    64   virtual uint ideal_reg() const { return Op_RegL; }
    64   virtual uint ideal_reg() const { return Op_RegL; }
    65 };
    65 };
    66 
    66 
    67 //------------------------------DivFNode---------------------------------------
    67 //------------------------------DivFNode---------------------------------------
    68 // Float division
    68 // Float division
    69 class DivFNode : public Node {
    69 class DivFNode : public Node {
    70 public:
    70 public:
    71   DivFNode( Node *c, Node *dividend, Node *divisor ) : Node(c, dividend, divisor) {}
    71   DivFNode( Node *c, Node *dividend, Node *divisor ) : Node(c, dividend, divisor) {}
    72   virtual int Opcode() const;
    72   virtual int Opcode() const;
    73   virtual Node *Identity( PhaseTransform *phase );
    73   virtual Node* Identity(PhaseGVN* phase);
    74   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
    74   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
    75   virtual const Type *Value( PhaseTransform *phase ) const;
    75   virtual const Type* Value(PhaseGVN* phase) const;
    76   virtual const Type *bottom_type() const { return Type::FLOAT; }
    76   virtual const Type *bottom_type() const { return Type::FLOAT; }
    77   virtual uint ideal_reg() const { return Op_RegF; }
    77   virtual uint ideal_reg() const { return Op_RegF; }
    78 };
    78 };
    79 
    79 
    80 //------------------------------DivDNode---------------------------------------
    80 //------------------------------DivDNode---------------------------------------
    81 // Double division
    81 // Double division
    82 class DivDNode : public Node {
    82 class DivDNode : public Node {
    83 public:
    83 public:
    84   DivDNode( Node *c, Node *dividend, Node *divisor ) : Node(c,dividend, divisor) {}
    84   DivDNode( Node *c, Node *dividend, Node *divisor ) : Node(c,dividend, divisor) {}
    85   virtual int Opcode() const;
    85   virtual int Opcode() const;
    86   virtual Node *Identity( PhaseTransform *phase );
    86   virtual Node* Identity(PhaseGVN* phase);
    87   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
    87   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
    88   virtual const Type *Value( PhaseTransform *phase ) const;
    88   virtual const Type* Value(PhaseGVN* phase) const;
    89   virtual const Type *bottom_type() const { return Type::DOUBLE; }
    89   virtual const Type *bottom_type() const { return Type::DOUBLE; }
    90   virtual uint ideal_reg() const { return Op_RegD; }
    90   virtual uint ideal_reg() const { return Op_RegD; }
    91 };
    91 };
    92 
    92 
    93 //------------------------------ModINode---------------------------------------
    93 //------------------------------ModINode---------------------------------------
    94 // Integer modulus
    94 // Integer modulus
    95 class ModINode : public Node {
    95 class ModINode : public Node {
    96 public:
    96 public:
    97   ModINode( Node *c, Node *in1, Node *in2 ) : Node(c,in1, in2) {}
    97   ModINode( Node *c, Node *in1, Node *in2 ) : Node(c,in1, in2) {}
    98   virtual int Opcode() const;
    98   virtual int Opcode() const;
    99   virtual const Type *Value( PhaseTransform *phase ) const;
    99   virtual const Type* Value(PhaseGVN* phase) const;
   100   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   100   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   101   virtual const Type *bottom_type() const { return TypeInt::INT; }
   101   virtual const Type *bottom_type() const { return TypeInt::INT; }
   102   virtual uint ideal_reg() const { return Op_RegI; }
   102   virtual uint ideal_reg() const { return Op_RegI; }
   103 };
   103 };
   104 
   104 
   106 // Long modulus
   106 // Long modulus
   107 class ModLNode : public Node {
   107 class ModLNode : public Node {
   108 public:
   108 public:
   109   ModLNode( Node *c, Node *in1, Node *in2 ) : Node(c,in1, in2) {}
   109   ModLNode( Node *c, Node *in1, Node *in2 ) : Node(c,in1, in2) {}
   110   virtual int Opcode() const;
   110   virtual int Opcode() const;
   111   virtual const Type *Value( PhaseTransform *phase ) const;
   111   virtual const Type* Value(PhaseGVN* phase) const;
   112   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   112   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
   113   virtual const Type *bottom_type() const { return TypeLong::LONG; }
   113   virtual const Type *bottom_type() const { return TypeLong::LONG; }
   114   virtual uint ideal_reg() const { return Op_RegL; }
   114   virtual uint ideal_reg() const { return Op_RegL; }
   115 };
   115 };
   116 
   116 
   118 // Float Modulus
   118 // Float Modulus
   119 class ModFNode : public Node {
   119 class ModFNode : public Node {
   120 public:
   120 public:
   121   ModFNode( Node *c, Node *in1, Node *in2 ) : Node(c,in1, in2) {}
   121   ModFNode( Node *c, Node *in1, Node *in2 ) : Node(c,in1, in2) {}
   122   virtual int Opcode() const;
   122   virtual int Opcode() const;
   123   virtual const Type *Value( PhaseTransform *phase ) const;
   123   virtual const Type* Value(PhaseGVN* phase) const;
   124   virtual const Type *bottom_type() const { return Type::FLOAT; }
   124   virtual const Type *bottom_type() const { return Type::FLOAT; }
   125   virtual uint ideal_reg() const { return Op_RegF; }
   125   virtual uint ideal_reg() const { return Op_RegF; }
   126 };
   126 };
   127 
   127 
   128 //------------------------------ModDNode---------------------------------------
   128 //------------------------------ModDNode---------------------------------------
   129 // Double Modulus
   129 // Double Modulus
   130 class ModDNode : public Node {
   130 class ModDNode : public Node {
   131 public:
   131 public:
   132   ModDNode( Node *c, Node *in1, Node *in2 ) : Node(c, in1, in2) {}
   132   ModDNode( Node *c, Node *in1, Node *in2 ) : Node(c, in1, in2) {}
   133   virtual int Opcode() const;
   133   virtual int Opcode() const;
   134   virtual const Type *Value( PhaseTransform *phase ) const;
   134   virtual const Type* Value(PhaseGVN* phase) const;
   135   virtual const Type *bottom_type() const { return Type::DOUBLE; }
   135   virtual const Type *bottom_type() const { return Type::DOUBLE; }
   136   virtual uint ideal_reg() const { return Op_RegD; }
   136   virtual uint ideal_reg() const { return Op_RegD; }
   137 };
   137 };
   138 
   138 
   139 //------------------------------DivModNode---------------------------------------
   139 //------------------------------DivModNode---------------------------------------
   145   enum {
   145   enum {
   146     div_proj_num =  0,      // quotient
   146     div_proj_num =  0,      // quotient
   147     mod_proj_num =  1       // remainder
   147     mod_proj_num =  1       // remainder
   148   };
   148   };
   149   virtual int Opcode() const;
   149   virtual int Opcode() const;
   150   virtual Node *Identity( PhaseTransform *phase ) { return this; }
   150   virtual Node* Identity(PhaseGVN* phase) { return this; }
   151   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape) { return NULL; }
   151   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape) { return NULL; }
   152   virtual const Type *Value( PhaseTransform *phase ) const { return bottom_type(); }
   152   virtual const Type* Value(PhaseGVN* phase)  const { return bottom_type(); }
   153   virtual uint hash() const { return Node::hash(); }
   153   virtual uint hash() const { return Node::hash(); }
   154   virtual bool is_CFG() const  { return false; }
   154   virtual bool is_CFG() const  { return false; }
   155   virtual uint ideal_reg() const { return NotAMachineReg; }
   155   virtual uint ideal_reg() const { return NotAMachineReg; }
   156 
   156 
   157   ProjNode* div_proj() { return proj_out(div_proj_num); }
   157   ProjNode* div_proj() { return proj_out(div_proj_num); }