src/hotspot/share/opto/subnode.hpp
author redestad
Thu, 14 Nov 2019 15:24:35 +0100
changeset 59081 95a99e617f28
parent 54750 1851a532ddfe
permissions -rw-r--r--
8234003: Improve IndexSet iteration Reviewed-by: neliasso, thartmann
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52143
diff changeset
     2
 * Copyright (c) 1997, 2019, 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: 5352
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5352
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: 5352
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
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52143
diff changeset
    25
#ifndef SHARE_OPTO_SUBNODE_HPP
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52143
diff changeset
    26
#define SHARE_OPTO_SUBNODE_HPP
7397
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
//------------------------------SUBNode----------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
// Class SUBTRACTION functionality.  This covers all the usual 'subtract'
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
// behaviors.  Subtract-integer, -float, -double, binary xor, compare-integer,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
// -float, and -double are all inherited from this class.  The compare
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
// functions behave like subtract functions, except that all negative answers
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// are compressed into -1, and all positive answers compressed to 1.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
class SubNode : public Node {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  SubNode( Node *in1, Node *in2 ) : Node(0,in1,in2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
    init_class_id(Class_Sub);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  // Handle algebraic identities here.  If we have an identity, return the Node
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  // we are equivalent to.  We look for "add of zero" as an identity.
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35540
diff changeset
    48
  virtual Node* Identity(PhaseGVN* phase);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  // Compute a new Type for this node.  Basically we just do the pre-check,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  // then call the virtual add() to set the type.
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35540
diff changeset
    52
  virtual const Type* Value(PhaseGVN* phase) const;
24479
20eb4c752fb5 8042786: Proper fix for 8032566
kvn
parents: 22234
diff changeset
    53
  const Type* Value_common( PhaseTransform *phase ) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  // Supplied function returns the subtractend of the inputs.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  // This also type-checks the inputs for sanity.  Guaranteed never to
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  // be passed a TOP or BOTTOM type, these are filtered out by a pre-check.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  virtual const Type *sub( const Type *, const Type * ) const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  // Supplied function to return the additive identity type.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  // This is returned whenever the subtracts inputs are the same.
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
// NOTE: SubINode should be taken away and replaced by add and negate
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
//------------------------------SubINode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
// Subtract 2 integers
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
class SubINode : public SubNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  SubINode( Node *in1, Node *in2 ) : SubNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  virtual const Type *sub( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  const Type *add_id() const { return TypeInt::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  const Type *bottom_type() const { return TypeInt::INT; }
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
//------------------------------SubLNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
// Subtract 2 integers
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
class SubLNode : public SubNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  SubLNode( Node *in1, Node *in2 ) : SubNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  virtual const Type *sub( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  const Type *add_id() const { return TypeLong::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  const Type *bottom_type() const { return TypeLong::LONG; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  virtual uint ideal_reg() const { return Op_RegL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
// NOTE: SubFPNode should be taken away and replaced by add and negate
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
//------------------------------SubFPNode--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
// Subtract 2 floats or doubles
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
class SubFPNode : public SubNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  SubFPNode( Node *in1, Node *in2 ) : SubNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
public:
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35540
diff changeset
   100
  const Type* Value(PhaseGVN* phase) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
// NOTE: SubFNode should be taken away and replaced by add and negate
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
//------------------------------SubFNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
// Subtract 2 doubles
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
class SubFNode : public SubFPNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  SubFNode( Node *in1, Node *in2 ) : SubFPNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  virtual const Type *sub( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  const Type   *add_id() const { return TypeF::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  const Type   *bottom_type() const { return Type::FLOAT; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  virtual uint  ideal_reg() const { return Op_RegF; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
// NOTE: SubDNode should be taken away and replaced by add and negate
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
//------------------------------SubDNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
// Subtract 2 doubles
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
class SubDNode : public SubFPNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  SubDNode( Node *in1, Node *in2 ) : SubFPNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  virtual const Type *sub( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  const Type   *add_id() const { return TypeD::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  const Type   *bottom_type() const { return Type::DOUBLE; }
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
//------------------------------CmpNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
// Compare 2 values, returning condition codes (-1, 0 or 1).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
class CmpNode : public SubNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  CmpNode( Node *in1, Node *in2 ) : SubNode(in1,in2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    init_class_id(Class_Cmp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  }
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35540
diff changeset
   138
  virtual Node* Identity(PhaseGVN* phase);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  const Type *add_id() const { return TypeInt::ZERO; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  const Type *bottom_type() const { return TypeInt::CC; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  virtual uint ideal_reg() const { return Op_RegFlags; }
32084
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   142
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   143
#ifndef PRODUCT
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   144
  // CmpNode and subclasses include all data inputs (until hitting a control
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   145
  // boundary) in their related node set, as well as all outputs until and
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   146
  // including eventual control nodes and their projections.
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   147
  virtual void related(GrowableArray<Node*> *in_rel, GrowableArray<Node*> *out_rel, bool compact) const;
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   148
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
//------------------------------CmpINode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
// Compare 2 signed values, returning condition codes (-1, 0 or 1).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
class CmpINode : public CmpNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  CmpINode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  virtual const Type *sub( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
//------------------------------CmpUNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
// Compare 2 unsigned values (integer or pointer), returning condition codes (-1, 0 or 1).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
class CmpUNode : public CmpNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  CmpUNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  virtual const Type *sub( const Type *, const Type * ) const;
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35540
diff changeset
   168
  const Type* Value(PhaseGVN* phase) const;
13205
5495b63764bf 7181658: CTW: assert(t->meet(t0) == t) failed: Not monotonic
kvn
parents: 9439
diff changeset
   169
  bool is_index_range_check() const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
//------------------------------CmpPNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
// Compare 2 pointer values, returning condition codes (-1, 0 or 1).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
class CmpPNode : public CmpNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  CmpPNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  virtual const Type *sub( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
360
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   182
//------------------------------CmpNNode--------------------------------------
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   183
// Compare 2 narrow oop values, returning condition codes (-1, 0 or 1).
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   184
class CmpNNode : public CmpNode {
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   185
public:
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   186
  CmpNNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   187
  virtual int Opcode() const;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   188
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   189
  virtual const Type *sub( const Type *, const Type * ) const;
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   190
};
21d113ecbf6a 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 1
diff changeset
   191
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
//------------------------------CmpLNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
// Compare 2 long values, returning condition codes (-1, 0 or 1).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
class CmpLNode : public CmpNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  CmpLNode( Node *in1, Node *in2 ) : CmpNode(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 *sub( const Type *, const Type * ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
45965
e29c1363af9a 8173770: Image conversion improvements
thartmann
parents: 38018
diff changeset
   201
//------------------------------CmpULNode---------------------------------------
e29c1363af9a 8173770: Image conversion improvements
thartmann
parents: 38018
diff changeset
   202
// Compare 2 unsigned long values, returning condition codes (-1, 0 or 1).
e29c1363af9a 8173770: Image conversion improvements
thartmann
parents: 38018
diff changeset
   203
class CmpULNode : public CmpNode {
e29c1363af9a 8173770: Image conversion improvements
thartmann
parents: 38018
diff changeset
   204
public:
e29c1363af9a 8173770: Image conversion improvements
thartmann
parents: 38018
diff changeset
   205
  CmpULNode(Node* in1, Node* in2) : CmpNode(in1, in2) { }
e29c1363af9a 8173770: Image conversion improvements
thartmann
parents: 38018
diff changeset
   206
  virtual int Opcode() const;
e29c1363af9a 8173770: Image conversion improvements
thartmann
parents: 38018
diff changeset
   207
  virtual const Type* sub(const Type*, const Type*) const;
e29c1363af9a 8173770: Image conversion improvements
thartmann
parents: 38018
diff changeset
   208
};
e29c1363af9a 8173770: Image conversion improvements
thartmann
parents: 38018
diff changeset
   209
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
//------------------------------CmpL3Node--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
// Compare 2 long values, returning integer value (-1, 0 or 1).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
class CmpL3Node : public CmpLNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  CmpL3Node( Node *in1, Node *in2 ) : CmpLNode(in1,in2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
    // Since it is not consumed by Bools, it is not really a Cmp.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
    init_class_id(Class_Sub);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  virtual int    Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  virtual uint ideal_reg() const { return Op_RegI; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
//------------------------------CmpFNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
// Compare 2 float values, returning condition codes (-1, 0 or 1).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
// This implements the Java bytecode fcmpl, so unordered returns -1.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
// Operands may not commute.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
class CmpFNode : public CmpNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  CmpFNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  virtual const Type *sub( const Type *, const Type * ) const { ShouldNotReachHere(); return NULL; }
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35540
diff changeset
   231
  const Type* Value(PhaseGVN* phase) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
//------------------------------CmpF3Node--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
// Compare 2 float values, returning integer value (-1, 0 or 1).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
// This implements the Java bytecode fcmpl, so unordered returns -1.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
// Operands may not commute.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
class CmpF3Node : public CmpFNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  CmpF3Node( Node *in1, Node *in2 ) : CmpFNode(in1,in2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
    // Since it is not consumed by Bools, it is not really a Cmp.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
    init_class_id(Class_Sub);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  // Since it is not consumed by Bools, it is not really a Cmp.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  virtual uint ideal_reg() const { return Op_RegI; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
//------------------------------CmpDNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
// Compare 2 double values, returning condition codes (-1, 0 or 1).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
// This implements the Java bytecode dcmpl, so unordered returns -1.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
// Operands may not commute.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
class CmpDNode : public CmpNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  CmpDNode( Node *in1, Node *in2 ) : CmpNode(in1,in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  virtual const Type *sub( const Type *, const Type * ) const { ShouldNotReachHere(); return NULL; }
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35540
diff changeset
   259
  const Type* Value(PhaseGVN* phase) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  virtual Node  *Ideal(PhaseGVN *phase, bool can_reshape);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
//------------------------------CmpD3Node--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
// Compare 2 double values, returning integer value (-1, 0 or 1).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
// This implements the Java bytecode dcmpl, so unordered returns -1.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
// Operands may not commute.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
class CmpD3Node : public CmpDNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  CmpD3Node( Node *in1, Node *in2 ) : CmpDNode(in1,in2) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
    // Since it is not consumed by Bools, it is not really a Cmp.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
    init_class_id(Class_Sub);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  virtual uint ideal_reg() const { return Op_RegI; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
//------------------------------BoolTest---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
// Convert condition codes to a boolean test value (0 or -1).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
// We pick the values as 3 bits; the low order 2 bits we compare against the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
// condition codes, the high bit flips the sense of the result.
49373
47b5652f2928 8199283: Remove ValueObj class for allocation subclassing for compiler code
coleenp
parents: 48089
diff changeset
   282
struct BoolTest {
52143
ad6384355aa3 8210215: C2 should optimize trichotomy calculations
thartmann
parents: 51333
diff changeset
   283
  enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, overflow = 2, no_overflow = 6, never = 8, illegal = 9 };
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
  mask _test;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
  BoolTest( mask btm ) : _test(btm) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
  const Type *cc2logical( const Type *CC ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  // Commute the test.  I use a small table lookup.  The table is created as
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  // a simple char array where each element is the ASCII version of a 'mask'
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
  // enum from above.
20289
35d78de0c547 8024924: Intrinsify java.lang.Math.addExact
rbackman
parents: 15752
diff changeset
   290
  mask commute( ) const { return mask("032147658"[_test]-'0'); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  mask negate( ) const { return mask(_test^4); }
20289
35d78de0c547 8024924: Intrinsify java.lang.Math.addExact
rbackman
parents: 15752
diff changeset
   292
  bool is_canonical( ) const { return (_test == BoolTest::ne || _test == BoolTest::lt || _test == BoolTest::le || _test == BoolTest::overflow); }
30183
a6588c0a3259 8073480: C2 should optimize explicit range checks
roland
parents: 27708
diff changeset
   293
  bool is_less( )  const { return _test == BoolTest::lt || _test == BoolTest::le; }
a6588c0a3259 8073480: C2 should optimize explicit range checks
roland
parents: 27708
diff changeset
   294
  bool is_greater( ) const { return _test == BoolTest::gt || _test == BoolTest::ge; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
  void dump_on(outputStream *st) const;
52143
ad6384355aa3 8210215: C2 should optimize trichotomy calculations
thartmann
parents: 51333
diff changeset
   296
  mask merge(BoolTest other) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
//------------------------------BoolNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
// A Node to convert a Condition Codes to a Logical result.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
class BoolNode : public Node {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
  virtual uint hash() const;
54327
a4d19817609c 8157372: C2: Node::cmp() should return bool
jcbeyler
parents: 53244
diff changeset
   303
  virtual bool cmp( const Node &n ) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
  virtual uint size_of() const;
26165
1b175b39dfc1 8043284: Optimize signed integer comparison
thartmann
parents: 24479
diff changeset
   305
1b175b39dfc1 8043284: Optimize signed integer comparison
thartmann
parents: 24479
diff changeset
   306
  // Try to optimize signed integer comparison
1b175b39dfc1 8043284: Optimize signed integer comparison
thartmann
parents: 24479
diff changeset
   307
  Node* fold_cmpI(PhaseGVN* phase, SubNode* cmp, Node* cmp1, int cmp_op,
1b175b39dfc1 8043284: Optimize signed integer comparison
thartmann
parents: 24479
diff changeset
   308
                  int cmp1_op, const TypeInt* cmp2_type);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
  const BoolTest _test;
51333
f6641fcf7b7e 8208670: Compiler changes to allow enabling -Wreorder
tschatzl
parents: 49908
diff changeset
   311
  BoolNode( Node *cc, BoolTest::mask t): Node(0,cc), _test(t) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
    init_class_id(Class_Bool);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
  // Convert an arbitrary int value to a Bool or other suitable predicate.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
  static Node* make_predicate(Node* test_value, PhaseGVN* phase);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
  // Convert self back to an integer value.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
  Node* as_int_value(PhaseGVN* phase);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  // Invert sense of self, returning new Bool.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
  BoolNode* negate(PhaseGVN* phase);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35540
diff changeset
   322
  virtual const Type* Value(PhaseGVN* phase) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
  virtual const Type *bottom_type() const { return TypeInt::BOOL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
  uint match_edge(uint idx) const { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  virtual uint ideal_reg() const { return Op_RegI; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
  bool is_counted_loop_exit_test();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
  virtual void dump_spec(outputStream *st) const;
32084
7743e6943cdf 8004073: Implement C2 Ideal node specific dump() method
mhaupt
parents: 30183
diff changeset
   330
  virtual void related(GrowableArray<Node*> *in_rel, GrowableArray<Node*> *out_rel, bool compact) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
//------------------------------AbsNode----------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
// Abstract class for absolute value.  Mostly used to get a handy wrapper
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
// for finding this pattern in the graph.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
class AbsNode : public Node {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
  AbsNode( Node *value ) : Node(0,value) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
//------------------------------AbsINode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
// Absolute value an integer.  Since a naive graph involves control flow, we
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
// "match" it in the ideal world (so the control flow can be removed).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
class AbsINode : public AbsNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
  AbsINode( Node *in1 ) : AbsNode(in1) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
  const Type *bottom_type() const { return TypeInt::INT; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
  virtual uint ideal_reg() const { return Op_RegI; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
54750
1851a532ddfe 8222074: Enhance auto vectorization for x86
sviswanathan
parents: 54327
diff changeset
   353
//------------------------------AbsLNode---------------------------------------
1851a532ddfe 8222074: Enhance auto vectorization for x86
sviswanathan
parents: 54327
diff changeset
   354
// Absolute value a long.  Since a naive graph involves control flow, we
1851a532ddfe 8222074: Enhance auto vectorization for x86
sviswanathan
parents: 54327
diff changeset
   355
// "match" it in the ideal world (so the control flow can be removed).
1851a532ddfe 8222074: Enhance auto vectorization for x86
sviswanathan
parents: 54327
diff changeset
   356
class AbsLNode : public AbsNode {
1851a532ddfe 8222074: Enhance auto vectorization for x86
sviswanathan
parents: 54327
diff changeset
   357
public:
1851a532ddfe 8222074: Enhance auto vectorization for x86
sviswanathan
parents: 54327
diff changeset
   358
  AbsLNode( Node *in1 ) : AbsNode(in1) {}
1851a532ddfe 8222074: Enhance auto vectorization for x86
sviswanathan
parents: 54327
diff changeset
   359
  virtual int Opcode() const;
1851a532ddfe 8222074: Enhance auto vectorization for x86
sviswanathan
parents: 54327
diff changeset
   360
  const Type *bottom_type() const { return TypeLong::LONG; }
1851a532ddfe 8222074: Enhance auto vectorization for x86
sviswanathan
parents: 54327
diff changeset
   361
  virtual uint ideal_reg() const { return Op_RegL; }
1851a532ddfe 8222074: Enhance auto vectorization for x86
sviswanathan
parents: 54327
diff changeset
   362
};
1851a532ddfe 8222074: Enhance auto vectorization for x86
sviswanathan
parents: 54327
diff changeset
   363
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
//------------------------------AbsFNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
// Absolute value a float, a common float-point idiom with a cheap hardware
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
// implemention on most chips.  Since a naive graph involves control flow, we
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
// "match" it in the ideal world (so the control flow can be removed).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
class AbsFNode : public AbsNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
  AbsFNode( Node *in1 ) : AbsNode(in1) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
  const Type *bottom_type() const { return Type::FLOAT; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
  virtual uint ideal_reg() const { return Op_RegF; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
//------------------------------AbsDNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
// Absolute value a double, a common float-point idiom with a cheap hardware
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
// implemention on most chips.  Since a naive graph involves control flow, we
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
// "match" it in the ideal world (so the control flow can be removed).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
class AbsDNode : public AbsNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
  AbsDNode( Node *in1 ) : AbsNode(in1) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
  const Type *bottom_type() const { return Type::DOUBLE; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
  virtual uint ideal_reg() const { return Op_RegD; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
//------------------------------CmpLTMaskNode----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
// If p < q, return -1 else return 0.  Nice for flow-free idioms.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
class CmpLTMaskNode : public Node {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
  CmpLTMaskNode( Node *p, Node *q ) : Node(0, p, q) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
  const Type *bottom_type() const { return TypeInt::INT; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
  virtual uint ideal_reg() const { return Op_RegI; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
//------------------------------NegNode----------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
class NegNode : public Node {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
  NegNode( Node *in1 ) : Node(0,in1) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
//------------------------------NegFNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
// Negate value a float.  Negating 0.0 returns -0.0, but subtracting from
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
// zero returns +0.0 (per JVM spec on 'fneg' bytecode).  As subtraction
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
// cannot be used to replace negation we have to implement negation as ideal
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
// node; note that negation and addition can replace subtraction.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
class NegFNode : public NegNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
  NegFNode( Node *in1 ) : NegNode(in1) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
  const Type *bottom_type() const { return Type::FLOAT; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
  virtual uint ideal_reg() const { return Op_RegF; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
//------------------------------NegDNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
// Negate value a double.  Negating 0.0 returns -0.0, but subtracting from
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
// zero returns +0.0 (per JVM spec on 'dneg' bytecode).  As subtraction
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
// cannot be used to replace negation we have to implement negation as ideal
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
// node; note that negation and addition can replace subtraction.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
class NegDNode : public NegNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
  NegDNode( Node *in1 ) : NegNode(in1) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
  const Type *bottom_type() const { return Type::DOUBLE; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
  virtual uint ideal_reg() const { return Op_RegD; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
//------------------------------AtanDNode--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
// arcus tangens of a double
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
class AtanDNode : public Node {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
  AtanDNode(Node *c, Node *in1, Node *in2  ) : Node(c, in1, in2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
  const Type *bottom_type() const { return Type::DOUBLE; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
  virtual uint ideal_reg() const { return Op_RegD; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
//------------------------------SqrtDNode--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
// square root a double
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
class SqrtDNode : public Node {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
public:
15752
9e5ee72bd9d2 8007959: Use expensive node logic for more math nodes
roland
parents: 15618
diff changeset
   447
  SqrtDNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
9e5ee72bd9d2 8007959: Use expensive node logic for more math nodes
roland
parents: 15618
diff changeset
   448
    init_flags(Flag_is_expensive);
9e5ee72bd9d2 8007959: Use expensive node logic for more math nodes
roland
parents: 15618
diff changeset
   449
    C->add_expensive_node(this);
9e5ee72bd9d2 8007959: Use expensive node logic for more math nodes
roland
parents: 15618
diff changeset
   450
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
  const Type *bottom_type() const { return Type::DOUBLE; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
  virtual uint ideal_reg() const { return Op_RegD; }
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35540
diff changeset
   454
  virtual const Type* Value(PhaseGVN* phase) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
48089
22c9856fc2c2 8190800: Support vectorization of Math.sqrt() on floats
rlupusoru
parents: 47216
diff changeset
   457
//------------------------------SqrtFNode--------------------------------------
22c9856fc2c2 8190800: Support vectorization of Math.sqrt() on floats
rlupusoru
parents: 47216
diff changeset
   458
// square root a float
22c9856fc2c2 8190800: Support vectorization of Math.sqrt() on floats
rlupusoru
parents: 47216
diff changeset
   459
class SqrtFNode : public Node {
22c9856fc2c2 8190800: Support vectorization of Math.sqrt() on floats
rlupusoru
parents: 47216
diff changeset
   460
public:
22c9856fc2c2 8190800: Support vectorization of Math.sqrt() on floats
rlupusoru
parents: 47216
diff changeset
   461
  SqrtFNode(Compile* C, Node *c, Node *in1) : Node(c, in1) {
22c9856fc2c2 8190800: Support vectorization of Math.sqrt() on floats
rlupusoru
parents: 47216
diff changeset
   462
    init_flags(Flag_is_expensive);
49908
22eb3e22f245 8202179: Compilation fails with assert(n->is_expensive()) failed: expensive nodes with non-null control here only
thartmann
parents: 49373
diff changeset
   463
    if (c != NULL) {
22eb3e22f245 8202179: Compilation fails with assert(n->is_expensive()) failed: expensive nodes with non-null control here only
thartmann
parents: 49373
diff changeset
   464
      // Treat node only as expensive if a control input is set because it might
22eb3e22f245 8202179: Compilation fails with assert(n->is_expensive()) failed: expensive nodes with non-null control here only
thartmann
parents: 49373
diff changeset
   465
      // be created from a SqrtDNode in ConvD2FNode::Ideal() that was found to
22eb3e22f245 8202179: Compilation fails with assert(n->is_expensive()) failed: expensive nodes with non-null control here only
thartmann
parents: 49373
diff changeset
   466
      // be unique and therefore has no control input.
22eb3e22f245 8202179: Compilation fails with assert(n->is_expensive()) failed: expensive nodes with non-null control here only
thartmann
parents: 49373
diff changeset
   467
      C->add_expensive_node(this);
22eb3e22f245 8202179: Compilation fails with assert(n->is_expensive()) failed: expensive nodes with non-null control here only
thartmann
parents: 49373
diff changeset
   468
    }
48089
22c9856fc2c2 8190800: Support vectorization of Math.sqrt() on floats
rlupusoru
parents: 47216
diff changeset
   469
  }
22c9856fc2c2 8190800: Support vectorization of Math.sqrt() on floats
rlupusoru
parents: 47216
diff changeset
   470
  virtual int Opcode() const;
22c9856fc2c2 8190800: Support vectorization of Math.sqrt() on floats
rlupusoru
parents: 47216
diff changeset
   471
  const Type *bottom_type() const { return Type::FLOAT; }
22c9856fc2c2 8190800: Support vectorization of Math.sqrt() on floats
rlupusoru
parents: 47216
diff changeset
   472
  virtual uint ideal_reg() const { return Op_RegF; }
22c9856fc2c2 8190800: Support vectorization of Math.sqrt() on floats
rlupusoru
parents: 47216
diff changeset
   473
  virtual const Type* Value(PhaseGVN* phase) const;
22c9856fc2c2 8190800: Support vectorization of Math.sqrt() on floats
rlupusoru
parents: 47216
diff changeset
   474
};
22c9856fc2c2 8190800: Support vectorization of Math.sqrt() on floats
rlupusoru
parents: 47216
diff changeset
   475
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
//-------------------------------ReverseBytesINode--------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
// reverse bytes of an integer
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
class ReverseBytesINode : public Node {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
  ReverseBytesINode(Node *c, Node *in1) : Node(c, in1) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
  const Type *bottom_type() const { return TypeInt::INT; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
  virtual uint ideal_reg() const { return Op_RegI; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
//-------------------------------ReverseBytesLNode--------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
// reverse bytes of a long
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
class ReverseBytesLNode : public Node {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
  ReverseBytesLNode(Node *c, Node *in1) : Node(c, in1) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
  virtual int Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
  const Type *bottom_type() const { return TypeLong::LONG; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
  virtual uint ideal_reg() const { return Op_RegL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
};
5352
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   495
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   496
//-------------------------------ReverseBytesUSNode--------------------------------
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   497
// reverse bytes of an unsigned short / char
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   498
class ReverseBytesUSNode : public Node {
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   499
public:
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   500
  ReverseBytesUSNode(Node *c, Node *in1) : Node(c, in1) {}
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   501
  virtual int Opcode() const;
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   502
  const Type *bottom_type() const { return TypeInt::CHAR; }
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   503
  virtual uint ideal_reg() const { return Op_RegI; }
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   504
};
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   505
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   506
//-------------------------------ReverseBytesSNode--------------------------------
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   507
// reverse bytes of a short
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   508
class ReverseBytesSNode : public Node {
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   509
public:
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   510
  ReverseBytesSNode(Node *c, Node *in1) : Node(c, in1) {}
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   511
  virtual int Opcode() const;
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   512
  const Type *bottom_type() const { return TypeInt::SHORT; }
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   513
  virtual uint ideal_reg() const { return Op_RegI; }
cee8f7acb7bc 6946040: add intrinsic for short and char reverseBytes
never
parents: 670
diff changeset
   514
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   515
53244
9807daeb47c4 8216167: Update include guards to reflect correct directories
coleenp
parents: 52143
diff changeset
   516
#endif // SHARE_OPTO_SUBNODE_HPP