hotspot/src/share/vm/opto/addnode.hpp
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 1 489c9b5090e2
child 190 e9a0a9dcd4f6
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
// Portions of code courtesy of Clifford Click
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
class PhaseTransform;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
//------------------------------AddNode----------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
// Classic Add functionality.  This covers all the usual 'add' behaviors for
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
// an algebraic ring.  Add-integer, add-float, add-double, and binary-or are
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// all inherited from this class.  The various identity values are supplied
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// by virtual functions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
class AddNode : public Node {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  virtual uint hash() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  AddNode( Node *in1, Node *in2 ) : Node(0,in1,in2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
    init_class_id(Class_Add);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  // Handle algebraic identities here.  If we have an identity, return the Node
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  // we are equivalent to.  We look for "add of zero" as an identity.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  virtual Node *Identity( PhaseTransform *phase );
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  // We also canonicalize the Node, moving constants to the right input,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  // and flatten expressions (so that 1+x+2 becomes x+3).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  // Compute a new Type for this node.  Basically we just do the pre-check,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  // then call the virtual add() to set the type.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  virtual const Type *Value( PhaseTransform *phase ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  // Check if this addition involves the additive identity
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  virtual const Type *add_of_identity( const Type *t1, const Type *t2 ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  // Supplied function returns the sum of the inputs.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  // This also type-checks the inputs for sanity.  Guaranteed never to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  // be passed a TOP or BOTTOM type, these are filtered out by a pre-check.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  virtual const Type *add_ring( const Type *, const Type * ) const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  // Supplied function to return the additive identity type
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  virtual const Type *add_id() const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
//------------------------------AddINode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
// Add 2 integers
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
class AddINode : public AddNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  AddINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  virtual const Type *add_id() const { return TypeInt::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  virtual const Type *bottom_type() const { return TypeInt::INT; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  virtual Node *Identity( PhaseTransform *phase );
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  virtual uint ideal_reg() const { return Op_RegI; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
//------------------------------AddLNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
// Add 2 longs
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
class AddLNode : public AddNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  AddLNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  virtual const Type *add_id() const { return TypeLong::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  virtual const Type *bottom_type() const { return TypeLong::LONG; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  virtual Node *Identity( PhaseTransform *phase );
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  virtual uint ideal_reg() const { return Op_RegL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
//------------------------------AddFNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
// Add 2 floats
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
class AddFNode : public AddNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  AddFNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  virtual const Type *add_of_identity( const Type *t1, const Type *t2 ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  virtual const Type *add_id() const { return TypeF::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  virtual const Type *bottom_type() const { return Type::FLOAT; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  virtual Node *Identity( PhaseTransform *phase ) { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  virtual uint ideal_reg() const { return Op_RegF; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
//------------------------------AddDNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
// Add 2 doubles
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
class AddDNode : public AddNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  AddDNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  virtual const Type *add_of_identity( const Type *t1, const Type *t2 ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  virtual const Type *add_id() const { return TypeD::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  virtual const Type *bottom_type() const { return Type::DOUBLE; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  virtual Node *Identity( PhaseTransform *phase ) { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  virtual uint ideal_reg() const { return Op_RegD; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
//------------------------------AddPNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
// Add pointer plus integer to get pointer.  NOT commutative, really.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
// So not really an AddNode.  Lives here, because people associate it with
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
// an add.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
class AddPNode : public Node {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  enum { Control,               // When is it safe to do this add?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
         Base,                  // Base oop, for GC purposes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
         Address,               // Actually address, derived from base
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
         Offset } ;             // Offset added to address
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  AddPNode( Node *base, Node *ptr, Node *off ) : Node(0,base,ptr,off) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    init_class_id(Class_AddP);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  virtual Node *Identity( PhaseTransform *phase );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  virtual const Type *Value( PhaseTransform *phase ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  virtual const Type *bottom_type() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  virtual uint  ideal_reg() const { return Op_RegP; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  Node         *base_node() { assert( req() > Base, "Missing base"); return in(Base); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  static Node* Ideal_base_and_offset(Node* ptr, PhaseTransform* phase,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
                                     // second return value:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
                                     intptr_t& offset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  // Do not match base-ptr edge
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  virtual uint match_edge(uint idx) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  static const Type *mach_bottom_type(const MachNode* n);  // used by ad_<arch>.hpp
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
//------------------------------OrINode----------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
// Logically OR 2 integers.  Included with the ADD nodes because it inherits
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
// all the behavior of addition on a ring.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
class OrINode : public AddNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  OrINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  virtual const Type *add_id() const { return TypeInt::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  virtual const Type *bottom_type() const { return TypeInt::INT; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  virtual Node *Identity( PhaseTransform *phase );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  virtual uint ideal_reg() const { return Op_RegI; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
//------------------------------OrLNode----------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
// Logically OR 2 longs.  Included with the ADD nodes because it inherits
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
// all the behavior of addition on a ring.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
class OrLNode : public AddNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  OrLNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  virtual const Type *add_id() const { return TypeLong::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  virtual const Type *bottom_type() const { return TypeLong::LONG; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  virtual Node *Identity( PhaseTransform *phase );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  virtual uint ideal_reg() const { return Op_RegL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
//------------------------------XorINode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
// XOR'ing 2 integers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
class XorINode : public AddNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  XorINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  virtual const Type *add_id() const { return TypeInt::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  virtual const Type *bottom_type() const { return TypeInt::INT; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  virtual uint ideal_reg() const { return Op_RegI; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
//------------------------------XorINode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
// XOR'ing 2 longs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
class XorLNode : public AddNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  XorLNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  virtual const Type *add_id() const { return TypeLong::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  virtual const Type *bottom_type() const { return TypeLong::LONG; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
  virtual uint ideal_reg() const { return Op_RegL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
//------------------------------MaxNode----------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
// Max (or min) of 2 values.  Included with the ADD nodes because it inherits
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
// all the behavior of addition on a ring.  Only new thing is that we allow
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
// 2 equal inputs to be equal.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
class MaxNode : public AddNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  MaxNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  virtual int Opcode() const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
//------------------------------MaxINode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
// Maximum of 2 integers.  Included with the ADD nodes because it inherits
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
// all the behavior of addition on a ring.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
class MaxINode : public MaxNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  MaxINode( Node *in1, Node *in2 ) : MaxNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  virtual const Type *add_id() const { return TypeInt::make(min_jint); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  virtual const Type *bottom_type() const { return TypeInt::INT; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  virtual uint ideal_reg() const { return Op_RegI; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
//------------------------------MinINode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
// MINimum of 2 integers.  Included with the ADD nodes because it inherits
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
// all the behavior of addition on a ring.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
class MinINode : public MaxNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  MinINode( Node *in1, Node *in2 ) : MaxNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  virtual const Type *add_id() const { return TypeInt::make(max_jint); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  virtual const Type *bottom_type() const { return TypeInt::INT; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  virtual uint ideal_reg() const { return Op_RegI; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
};