hotspot/src/share/vm/opto/addnode.hpp
author brutisso
Mon, 21 Nov 2011 07:47:34 +0100
changeset 11170 7663e46f3a54
parent 7397 5b173b4ca846
child 35551 36ef3841fb34
permissions -rw-r--r--
7110718: -XX:MarkSweepAlwaysCompactCount=0 crashes the JVM Summary: Interpret MarkSweepAlwaysCompactCount < 1 as never do full compaction Reviewed-by: ysr, tonyp, jmasa, johnc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
     2
 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
1
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
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5536
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5536
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5536
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_OPTO_ADDNODE_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_OPTO_ADDNODE_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "opto/node.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "opto/opcodes.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "opto/type.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// Portions of code courtesy of Clifford Click
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
class PhaseTransform;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
//------------------------------AddNode----------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
// Classic Add functionality.  This covers all the usual 'add' behaviors for
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
// an algebraic ring.  Add-integer, add-float, add-double, and binary-or are
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// all inherited from this class.  The various identity values are supplied
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
// by virtual functions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
class AddNode : public Node {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  virtual uint hash() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  AddNode( Node *in1, Node *in2 ) : Node(0,in1,in2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
    init_class_id(Class_Add);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  // Handle algebraic identities here.  If we have an identity, return the Node
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  // we are equivalent to.  We look for "add of zero" as an identity.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  virtual Node *Identity( PhaseTransform *phase );
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  // We also canonicalize the Node, moving constants to the right input,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  // and flatten expressions (so that 1+x+2 becomes x+3).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  // Compute a new Type for this node.  Basically we just do the pre-check,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  // then call the virtual add() to set the type.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  virtual const Type *Value( PhaseTransform *phase ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  // Check if this addition involves the additive identity
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  virtual const Type *add_of_identity( const Type *t1, const Type *t2 ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  // Supplied function returns the sum of the inputs.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  // This also type-checks the inputs for sanity.  Guaranteed never to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  // be passed a TOP or BOTTOM type, these are filtered out by a pre-check.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  virtual const Type *add_ring( const Type *, const Type * ) const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  // Supplied function to return the additive identity type
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  virtual const Type *add_id() const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
//------------------------------AddINode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
// Add 2 integers
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
class AddINode : public AddNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  AddINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  virtual const Type *add_id() const { return TypeInt::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  virtual const Type *bottom_type() const { return TypeInt::INT; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  virtual Node *Identity( PhaseTransform *phase );
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  virtual uint ideal_reg() const { return Op_RegI; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
//------------------------------AddLNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
// Add 2 longs
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
class AddLNode : public AddNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  AddLNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  virtual const Type *add_id() const { return TypeLong::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  virtual const Type *bottom_type() const { return TypeLong::LONG; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  virtual Node *Identity( PhaseTransform *phase );
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  virtual uint ideal_reg() const { return Op_RegL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
//------------------------------AddFNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
// Add 2 floats
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
class AddFNode : public AddNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  AddFNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  virtual const Type *add_of_identity( const Type *t1, const Type *t2 ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  virtual const Type *add_id() const { return TypeF::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  virtual const Type *bottom_type() const { return Type::FLOAT; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  virtual Node *Identity( PhaseTransform *phase ) { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  virtual uint ideal_reg() const { return Op_RegF; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
//------------------------------AddDNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
// Add 2 doubles
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
class AddDNode : public AddNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  AddDNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  virtual const Type *add_of_identity( const Type *t1, const Type *t2 ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  virtual const Type *add_id() const { return TypeD::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  virtual const Type *bottom_type() const { return Type::DOUBLE; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  virtual Node *Identity( PhaseTransform *phase ) { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  virtual uint ideal_reg() const { return Op_RegD; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
//------------------------------AddPNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
// Add pointer plus integer to get pointer.  NOT commutative, really.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
// So not really an AddNode.  Lives here, because people associate it with
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
// an add.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
class AddPNode : public Node {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  enum { Control,               // When is it safe to do this add?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
         Base,                  // Base oop, for GC purposes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
         Address,               // Actually address, derived from base
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
         Offset } ;             // Offset added to address
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  AddPNode( Node *base, Node *ptr, Node *off ) : Node(0,base,ptr,off) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
    init_class_id(Class_AddP);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  virtual Node *Identity( PhaseTransform *phase );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  virtual const Type *Value( PhaseTransform *phase ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  virtual const Type *bottom_type() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  virtual uint  ideal_reg() const { return Op_RegP; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  Node         *base_node() { assert( req() > Base, "Missing base"); return in(Base); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  static Node* Ideal_base_and_offset(Node* ptr, PhaseTransform* phase,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
                                     // second return value:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
                                     intptr_t& offset);
190
e9a0a9dcd4f6 6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents: 1
diff changeset
   154
e9a0a9dcd4f6 6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents: 1
diff changeset
   155
  // Collect the AddP offset values into the elements array, giving up
e9a0a9dcd4f6 6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents: 1
diff changeset
   156
  // if there are more than length.
e9a0a9dcd4f6 6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents: 1
diff changeset
   157
  int unpack_offsets(Node* elements[], int length);
e9a0a9dcd4f6 6395208: Elide autoboxing for calls to HashMap.get(int) and HashMap.get(long)
never
parents: 1
diff changeset
   158
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  // Do not match base-ptr edge
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  virtual uint match_edge(uint idx) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
//------------------------------OrINode----------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
// Logically OR 2 integers.  Included with the ADD nodes because it inherits
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
// all the behavior of addition on a ring.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
class OrINode : public AddNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  OrINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  virtual const Type *add_id() const { return TypeInt::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  virtual const Type *bottom_type() const { return TypeInt::INT; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  virtual Node *Identity( PhaseTransform *phase );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  virtual uint ideal_reg() const { return Op_RegI; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
//------------------------------OrLNode----------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
// Logically OR 2 longs.  Included with the ADD nodes because it inherits
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
// all the behavior of addition on a ring.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
class OrLNode : public AddNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  OrLNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  virtual const Type *add_id() const { return TypeLong::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  virtual const Type *bottom_type() const { return TypeLong::LONG; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  virtual Node *Identity( PhaseTransform *phase );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  virtual uint ideal_reg() const { return Op_RegL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
//------------------------------XorINode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
// XOR'ing 2 integers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
class XorINode : public AddNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  XorINode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  virtual const Type *add_id() const { return TypeInt::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  virtual const Type *bottom_type() const { return TypeInt::INT; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  virtual uint ideal_reg() const { return Op_RegI; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
//------------------------------XorINode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
// XOR'ing 2 longs
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
class XorLNode : public AddNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  XorLNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  virtual const Type *add_id() const { return TypeLong::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  virtual const Type *bottom_type() const { return TypeLong::LONG; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  virtual uint ideal_reg() const { return Op_RegL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
//------------------------------MaxNode----------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
// Max (or min) of 2 values.  Included with the ADD nodes because it inherits
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
// all the behavior of addition on a ring.  Only new thing is that we allow
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
// 2 equal inputs to be equal.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
class MaxNode : public AddNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  MaxNode( Node *in1, Node *in2 ) : AddNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  virtual int Opcode() const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
//------------------------------MaxINode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
// Maximum of 2 integers.  Included with the ADD nodes because it inherits
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
// all the behavior of addition on a ring.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
class MaxINode : public MaxNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  MaxINode( Node *in1, Node *in2 ) : MaxNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  virtual const Type *add_id() const { return TypeInt::make(min_jint); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  virtual const Type *bottom_type() const { return TypeInt::INT; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
  virtual uint ideal_reg() const { return Op_RegI; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
//------------------------------MinINode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
// MINimum of 2 integers.  Included with the ADD nodes because it inherits
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
// all the behavior of addition on a ring.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
class MinINode : public MaxNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  MinINode( Node *in1, Node *in2 ) : MaxNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  virtual const Type *add_ring( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  virtual const Type *add_id() const { return TypeInt::make(max_jint); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  virtual const Type *bottom_type() const { return TypeInt::INT; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
  virtual uint ideal_reg() const { return Op_RegI; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   251
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   252
#endif // SHARE_VM_OPTO_ADDNODE_HPP