< prev index next >

src/share/vm/opto/addnode.hpp

Print this page




  58   virtual const Type* Value(PhaseGVN* phase) const;
  59 
  60   // Check if this addition involves the additive identity
  61   virtual const Type *add_of_identity( const Type *t1, const Type *t2 ) const;
  62 
  63   // Supplied function returns the sum of the inputs.
  64   // This also type-checks the inputs for sanity.  Guaranteed never to
  65   // be passed a TOP or BOTTOM type, these are filtered out by a pre-check.
  66   virtual const Type *add_ring( const Type *, const Type * ) const = 0;
  67 
  68   // Supplied function to return the additive identity type
  69   virtual const Type *add_id() const = 0;
  70 
  71 };
  72 
  73 //------------------------------AddINode---------------------------------------
  74 // Add 2 integers
  75 class AddINode : public AddNode {
  76 public:
  77   AddINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
  78   virtual int Opcode() const;
  79   virtual const Type *add_ring( const Type *, const Type * ) const;
  80   virtual const Type *add_id() const { return TypeInt::ZERO; }
  81   virtual const Type *bottom_type() const { return TypeInt::INT; }
  82   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
  83   virtual Node* Identity(PhaseGVN* phase);
  84   virtual uint ideal_reg() const { return Op_RegI; }
  85 };
  86 
  87 //------------------------------AddLNode---------------------------------------
  88 // Add 2 longs
  89 class AddLNode : public AddNode {
  90 public:
  91   AddLNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
  92   virtual int Opcode() const;
  93   virtual const Type *add_ring( const Type *, const Type * ) const;
  94   virtual const Type *add_id() const { return TypeLong::ZERO; }
  95   virtual const Type *bottom_type() const { return TypeLong::LONG; }
  96   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
  97   virtual Node* Identity(PhaseGVN* phase);
  98   virtual uint ideal_reg() const { return Op_RegL; }
  99 };
 100 
 101 //------------------------------AddFNode---------------------------------------
 102 // Add 2 floats
 103 class AddFNode : public AddNode {
 104 public:
 105   AddFNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
 106   virtual int Opcode() const;
 107   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 108   virtual const Type *add_of_identity( const Type *t1, const Type *t2 ) const;
 109   virtual const Type *add_ring( const Type *, const Type * ) const;
 110   virtual const Type *add_id() const { return TypeF::ZERO; }
 111   virtual const Type *bottom_type() const { return Type::FLOAT; }
 112   virtual Node* Identity(PhaseGVN* phase) { return this; }
 113   virtual uint ideal_reg() const { return Op_RegF; }
 114 };
 115 
 116 //------------------------------AddDNode---------------------------------------
 117 // Add 2 doubles
 118 class AddDNode : public AddNode {
 119 public:
 120   AddDNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
 121   virtual int Opcode() const;
 122   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 123   virtual const Type *add_of_identity( const Type *t1, const Type *t2 ) const;
 124   virtual const Type *add_ring( const Type *, const Type * ) const;
 125   virtual const Type *add_id() const { return TypeD::ZERO; }
 126   virtual const Type *bottom_type() const { return Type::DOUBLE; }
 127   virtual Node* Identity(PhaseGVN* phase) { return this; }
 128   virtual uint ideal_reg() const { return Op_RegD; }
 129 };
 130 
 131 //------------------------------AddPNode---------------------------------------
 132 // Add pointer plus integer to get pointer.  NOT commutative, really.
 133 // So not really an AddNode.  Lives here, because people associate it with
 134 // an add.
 135 class AddPNode : public Node {
 136 public:
 137   enum { Control,               // When is it safe to do this add?
 138          Base,                  // Base oop, for GC purposes
 139          Address,               // Actually address, derived from base
 140          Offset } ;             // Offset added to address
 141   AddPNode( Node *base, Node *ptr, Node *off ) : Node(0,base,ptr,off) {
 142     init_class_id(Class_AddP);
 143   }
 144   virtual int Opcode() const;
 145   virtual Node* Identity(PhaseGVN* phase);
 146   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 147   virtual const Type* Value(PhaseGVN* phase) const;
 148   virtual const Type *bottom_type() const;
 149   virtual uint  ideal_reg() const { return Op_RegP; }
 150   Node         *base_node() { assert( req() > Base, "Missing base"); return in(Base); }
 151   static Node* Ideal_base_and_offset(Node* ptr, PhaseTransform* phase,
 152                                      // second return value:
 153                                      intptr_t& offset);
 154 
 155   // Collect the AddP offset values into the elements array, giving up
 156   // if there are more than length.
 157   int unpack_offsets(Node* elements[], int length);
 158 
 159   // Do not match base-ptr edge
 160   virtual uint match_edge(uint idx) const;
 161 };
 162 
 163 //------------------------------OrINode----------------------------------------
 164 // Logically OR 2 integers.  Included with the ADD nodes because it inherits
 165 // all the behavior of addition on a ring.
 166 class OrINode : public AddNode {
 167 public:
 168   OrINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
 169   virtual int Opcode() const;
 170   virtual const Type *add_ring( const Type *, const Type * ) const;
 171   virtual const Type *add_id() const { return TypeInt::ZERO; }
 172   virtual const Type *bottom_type() const { return TypeInt::INT; }
 173   virtual Node* Identity(PhaseGVN* phase);
 174   virtual uint ideal_reg() const { return Op_RegI; }
 175 };
 176 
 177 //------------------------------OrLNode----------------------------------------
 178 // Logically OR 2 longs.  Included with the ADD nodes because it inherits
 179 // all the behavior of addition on a ring.
 180 class OrLNode : public AddNode {
 181 public:
 182   OrLNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
 183   virtual int Opcode() const;
 184   virtual const Type *add_ring( const Type *, const Type * ) const;
 185   virtual const Type *add_id() const { return TypeLong::ZERO; }
 186   virtual const Type *bottom_type() const { return TypeLong::LONG; }
 187   virtual Node* Identity(PhaseGVN* phase);
 188   virtual uint ideal_reg() const { return Op_RegL; }
 189 };
 190 
 191 //------------------------------XorINode---------------------------------------
 192 // XOR'ing 2 integers
 193 class XorINode : public AddNode {
 194 public:
 195   XorINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
 196   virtual int Opcode() const;
 197   virtual const Type *add_ring( const Type *, const Type * ) const;
 198   virtual const Type *add_id() const { return TypeInt::ZERO; }
 199   virtual const Type *bottom_type() const { return TypeInt::INT; }
 200   virtual uint ideal_reg() const { return Op_RegI; }
 201 };
 202 
 203 //------------------------------XorINode---------------------------------------
 204 // XOR'ing 2 longs
 205 class XorLNode : public AddNode {
 206 public:
 207   XorLNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
 208   virtual int Opcode() const;
 209   virtual const Type *add_ring( const Type *, const Type * ) const;
 210   virtual const Type *add_id() const { return TypeLong::ZERO; }
 211   virtual const Type *bottom_type() const { return TypeLong::LONG; }
 212   virtual uint ideal_reg() const { return Op_RegL; }
 213 };
 214 
 215 //------------------------------MaxNode----------------------------------------
 216 // Max (or min) of 2 values.  Included with the ADD nodes because it inherits
 217 // all the behavior of addition on a ring.  Only new thing is that we allow
 218 // 2 equal inputs to be equal.
 219 class MaxNode : public AddNode {
 220 public:
 221   MaxNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
 222   virtual int Opcode() const = 0;
 223 };
 224 
 225 //------------------------------MaxINode---------------------------------------
 226 // Maximum of 2 integers.  Included with the ADD nodes because it inherits
 227 // all the behavior of addition on a ring.
 228 class MaxINode : public MaxNode {
 229 public:
 230   MaxINode( Node *in1, Node *in2 ) : MaxNode(in1,in2) {}
 231   virtual int Opcode() const;
 232   virtual const Type *add_ring( const Type *, const Type * ) const;
 233   virtual const Type *add_id() const { return TypeInt::make(min_jint); }
 234   virtual const Type *bottom_type() const { return TypeInt::INT; }
 235   virtual uint ideal_reg() const { return Op_RegI; }
 236 };
 237 
 238 //------------------------------MinINode---------------------------------------
 239 // MINimum of 2 integers.  Included with the ADD nodes because it inherits
 240 // all the behavior of addition on a ring.
 241 class MinINode : public MaxNode {
 242 public:
 243   MinINode( Node *in1, Node *in2 ) : MaxNode(in1,in2) {}
 244   virtual int Opcode() const;
 245   virtual const Type *add_ring( const Type *, const Type * ) const;
 246   virtual const Type *add_id() const { return TypeInt::make(max_jint); }
 247   virtual const Type *bottom_type() const { return TypeInt::INT; }
 248   virtual uint ideal_reg() const { return Op_RegI; }
 249   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 250 };
 251 
 252 #endif // SHARE_VM_OPTO_ADDNODE_HPP


  58   virtual const Type* Value(PhaseGVN* phase) const;
  59 
  60   // Check if this addition involves the additive identity
  61   virtual const Type *add_of_identity( const Type *t1, const Type *t2 ) const;
  62 
  63   // Supplied function returns the sum of the inputs.
  64   // This also type-checks the inputs for sanity.  Guaranteed never to
  65   // be passed a TOP or BOTTOM type, these are filtered out by a pre-check.
  66   virtual const Type *add_ring( const Type *, const Type * ) const = 0;
  67 
  68   // Supplied function to return the additive identity type
  69   virtual const Type *add_id() const = 0;
  70 
  71 };
  72 
  73 //------------------------------AddINode---------------------------------------
  74 // Add 2 integers
  75 class AddINode : public AddNode {
  76 public:
  77   AddINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
  78   virtual uint Opcode() const;
  79   virtual const Type *add_ring( const Type *, const Type * ) const;
  80   virtual const Type *add_id() const { return TypeInt::ZERO; }
  81   virtual const Type *bottom_type() const { return TypeInt::INT; }
  82   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
  83   virtual Node* Identity(PhaseGVN* phase);
  84   virtual uint ideal_reg() const { return Op_RegI; }
  85 };
  86 
  87 //------------------------------AddLNode---------------------------------------
  88 // Add 2 longs
  89 class AddLNode : public AddNode {
  90 public:
  91   AddLNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
  92   virtual uint Opcode() const;
  93   virtual const Type *add_ring( const Type *, const Type * ) const;
  94   virtual const Type *add_id() const { return TypeLong::ZERO; }
  95   virtual const Type *bottom_type() const { return TypeLong::LONG; }
  96   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
  97   virtual Node* Identity(PhaseGVN* phase);
  98   virtual uint ideal_reg() const { return Op_RegL; }
  99 };
 100 
 101 //------------------------------AddFNode---------------------------------------
 102 // Add 2 floats
 103 class AddFNode : public AddNode {
 104 public:
 105   AddFNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
 106   virtual uint Opcode() const;
 107   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 108   virtual const Type *add_of_identity( const Type *t1, const Type *t2 ) const;
 109   virtual const Type *add_ring( const Type *, const Type * ) const;
 110   virtual const Type *add_id() const { return TypeF::ZERO; }
 111   virtual const Type *bottom_type() const { return Type::FLOAT; }
 112   virtual Node* Identity(PhaseGVN* phase) { return this; }
 113   virtual uint ideal_reg() const { return Op_RegF; }
 114 };
 115 
 116 //------------------------------AddDNode---------------------------------------
 117 // Add 2 doubles
 118 class AddDNode : public AddNode {
 119 public:
 120   AddDNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
 121   virtual uint Opcode() const;
 122   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 123   virtual const Type *add_of_identity( const Type *t1, const Type *t2 ) const;
 124   virtual const Type *add_ring( const Type *, const Type * ) const;
 125   virtual const Type *add_id() const { return TypeD::ZERO; }
 126   virtual const Type *bottom_type() const { return Type::DOUBLE; }
 127   virtual Node* Identity(PhaseGVN* phase) { return this; }
 128   virtual uint ideal_reg() const { return Op_RegD; }
 129 };
 130 
 131 //------------------------------AddPNode---------------------------------------
 132 // Add pointer plus integer to get pointer.  NOT commutative, really.
 133 // So not really an AddNode.  Lives here, because people associate it with
 134 // an add.
 135 class AddPNode : public Node {
 136 public:
 137   enum { Control,               // When is it safe to do this add?
 138          Base,                  // Base oop, for GC purposes
 139          Address,               // Actually address, derived from base
 140          Offset } ;             // Offset added to address
 141   AddPNode( Node *base, Node *ptr, Node *off ) : Node(0,base,ptr,off) {
 142     init_class_id(Class_AddP);
 143   }
 144   virtual uint Opcode() const;
 145   virtual Node* Identity(PhaseGVN* phase);
 146   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 147   virtual const Type* Value(PhaseGVN* phase) const;
 148   virtual const Type *bottom_type() const;
 149   virtual uint  ideal_reg() const { return Op_RegP; }
 150   Node         *base_node() { assert( req() > Base, "Missing base"); return in(Base); }
 151   static Node* Ideal_base_and_offset(Node* ptr, PhaseTransform* phase,
 152                                      // second return value:
 153                                      intptr_t& offset);
 154 
 155   // Collect the AddP offset values into the elements array, giving up
 156   // if there are more than length.
 157   int unpack_offsets(Node* elements[], int length);
 158 
 159   // Do not match base-ptr edge
 160   virtual uint match_edge(uint idx) const;
 161 };
 162 
 163 //------------------------------OrINode----------------------------------------
 164 // Logically OR 2 integers.  Included with the ADD nodes because it inherits
 165 // all the behavior of addition on a ring.
 166 class OrINode : public AddNode {
 167 public:
 168   OrINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
 169   virtual uint Opcode() const;
 170   virtual const Type *add_ring( const Type *, const Type * ) const;
 171   virtual const Type *add_id() const { return TypeInt::ZERO; }
 172   virtual const Type *bottom_type() const { return TypeInt::INT; }
 173   virtual Node* Identity(PhaseGVN* phase);
 174   virtual uint ideal_reg() const { return Op_RegI; }
 175 };
 176 
 177 //------------------------------OrLNode----------------------------------------
 178 // Logically OR 2 longs.  Included with the ADD nodes because it inherits
 179 // all the behavior of addition on a ring.
 180 class OrLNode : public AddNode {
 181 public:
 182   OrLNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
 183   virtual uint Opcode() const;
 184   virtual const Type *add_ring( const Type *, const Type * ) const;
 185   virtual const Type *add_id() const { return TypeLong::ZERO; }
 186   virtual const Type *bottom_type() const { return TypeLong::LONG; }
 187   virtual Node* Identity(PhaseGVN* phase);
 188   virtual uint ideal_reg() const { return Op_RegL; }
 189 };
 190 
 191 //------------------------------XorINode---------------------------------------
 192 // XOR'ing 2 integers
 193 class XorINode : public AddNode {
 194 public:
 195   XorINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
 196   virtual uint Opcode() const;
 197   virtual const Type *add_ring( const Type *, const Type * ) const;
 198   virtual const Type *add_id() const { return TypeInt::ZERO; }
 199   virtual const Type *bottom_type() const { return TypeInt::INT; }
 200   virtual uint ideal_reg() const { return Op_RegI; }
 201 };
 202 
 203 //------------------------------XorINode---------------------------------------
 204 // XOR'ing 2 longs
 205 class XorLNode : public AddNode {
 206 public:
 207   XorLNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
 208   virtual uint Opcode() const;
 209   virtual const Type *add_ring( const Type *, const Type * ) const;
 210   virtual const Type *add_id() const { return TypeLong::ZERO; }
 211   virtual const Type *bottom_type() const { return TypeLong::LONG; }
 212   virtual uint ideal_reg() const { return Op_RegL; }
 213 };
 214 
 215 //------------------------------MaxNode----------------------------------------
 216 // Max (or min) of 2 values.  Included with the ADD nodes because it inherits
 217 // all the behavior of addition on a ring.  Only new thing is that we allow
 218 // 2 equal inputs to be equal.
 219 class MaxNode : public AddNode {
 220 public:
 221   MaxNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
 222   virtual uint Opcode() const = 0;
 223 };
 224 
 225 //------------------------------MaxINode---------------------------------------
 226 // Maximum of 2 integers.  Included with the ADD nodes because it inherits
 227 // all the behavior of addition on a ring.
 228 class MaxINode : public MaxNode {
 229 public:
 230   MaxINode( Node *in1, Node *in2 ) : MaxNode(in1,in2) {}
 231   virtual uint Opcode() const;
 232   virtual const Type *add_ring( const Type *, const Type * ) const;
 233   virtual const Type *add_id() const { return TypeInt::make(min_jint); }
 234   virtual const Type *bottom_type() const { return TypeInt::INT; }
 235   virtual uint ideal_reg() const { return Op_RegI; }
 236 };
 237 
 238 //------------------------------MinINode---------------------------------------
 239 // MINimum of 2 integers.  Included with the ADD nodes because it inherits
 240 // all the behavior of addition on a ring.
 241 class MinINode : public MaxNode {
 242 public:
 243   MinINode( Node *in1, Node *in2 ) : MaxNode(in1,in2) {}
 244   virtual uint Opcode() const;
 245   virtual const Type *add_ring( const Type *, const Type * ) const;
 246   virtual const Type *add_id() const { return TypeInt::make(max_jint); }
 247   virtual const Type *bottom_type() const { return TypeInt::INT; }
 248   virtual uint ideal_reg() const { return Op_RegI; }
 249   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 250 };
 251 
 252 #endif // SHARE_VM_OPTO_ADDNODE_HPP
< prev index next >