hotspot/src/share/vm/opto/movenode.hpp
author iveresov
Thu, 22 Jan 2015 11:25:23 -0800
changeset 28723 0a36120cb225
parent 25930 eae8b7490d2c
child 32084 7743e6943cdf
permissions -rw-r--r--
8071302: assert(!_reg_node[reg_lo] || edge_from_to(_reg_node[reg_lo], def)) failed: after block local Summary: Add merge nodes to node to block mapping Reviewed-by: kvn, vlivanov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23528
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     1
/*
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     4
 *
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     8
 *
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    13
 * accompanied this code).
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    14
 *
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    18
 *
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    21
 * questions.
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    22
 *
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    23
 */
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    24
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    25
#ifndef SHARE_VM_OPTO_MOVENODE_HPP
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    26
#define SHARE_VM_OPTO_MOVENODE_HPP
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    27
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    28
#include "opto/node.hpp"
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    29
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    30
//------------------------------CMoveNode--------------------------------------
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    31
// Conditional move
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    32
class CMoveNode : public TypeNode {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    33
  public:
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    34
  enum { Control,               // When is it safe to do this cmove?
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    35
    Condition,             // Condition controlling the cmove
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    36
    IfFalse,               // Value if condition is false
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    37
    IfTrue };              // Value if condition is true
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    38
  CMoveNode( Node *bol, Node *left, Node *right, const Type *t ) : TypeNode(t,4)
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    39
  {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    40
    init_class_id(Class_CMove);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    41
    // all inputs are nullified in Node::Node(int)
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    42
    // init_req(Control,NULL);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    43
    init_req(Condition,bol);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    44
    init_req(IfFalse,left);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    45
    init_req(IfTrue,right);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    46
  }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    47
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    48
  virtual const Type *Value( PhaseTransform *phase ) const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    49
  virtual Node *Identity( PhaseTransform *phase );
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 23528
diff changeset
    50
  static CMoveNode *make(Node *c, Node *bol, Node *left, Node *right, const Type *t);
23528
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    51
  // Helper function to spot cmove graph shapes
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    52
  static Node *is_cmove_id( PhaseTransform *phase, Node *cmp, Node *t, Node *f, BoolNode *b );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    53
};
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    54
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    55
//------------------------------CMoveDNode-------------------------------------
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    56
class CMoveDNode : public CMoveNode {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    57
  public:
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    58
  CMoveDNode( Node *bol, Node *left, Node *right, const Type* t) : CMoveNode(bol,left,right,t){}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    59
  virtual int Opcode() const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    60
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    61
};
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    62
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    63
//------------------------------CMoveFNode-------------------------------------
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    64
class CMoveFNode : public CMoveNode {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    65
  public:
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    66
  CMoveFNode( Node *bol, Node *left, Node *right, const Type* t ) : CMoveNode(bol,left,right,t) {}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    67
  virtual int Opcode() const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    68
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    69
};
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    70
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    71
//------------------------------CMoveINode-------------------------------------
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    72
class CMoveINode : public CMoveNode {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    73
  public:
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    74
  CMoveINode( Node *bol, Node *left, Node *right, const TypeInt *ti ) : CMoveNode(bol,left,right,ti){}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    75
  virtual int Opcode() const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    76
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    77
};
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    78
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    79
//------------------------------CMoveLNode-------------------------------------
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    80
class CMoveLNode : public CMoveNode {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    81
  public:
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    82
  CMoveLNode(Node *bol, Node *left, Node *right, const TypeLong *tl ) : CMoveNode(bol,left,right,tl){}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    83
  virtual int Opcode() const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    84
};
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    85
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    86
//------------------------------CMovePNode-------------------------------------
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    87
class CMovePNode : public CMoveNode {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    88
  public:
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    89
  CMovePNode( Node *c, Node *bol, Node *left, Node *right, const TypePtr* t ) : CMoveNode(bol,left,right,t) { init_req(Control,c); }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    90
  virtual int Opcode() const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    91
};
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    92
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    93
//------------------------------CMoveNNode-------------------------------------
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    94
class CMoveNNode : public CMoveNode {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    95
  public:
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    96
  CMoveNNode( Node *c, Node *bol, Node *left, Node *right, const Type* t ) : CMoveNode(bol,left,right,t) { init_req(Control,c); }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    97
  virtual int Opcode() const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    98
};
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    99
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   100
//
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   101
class MoveI2FNode : public Node {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   102
  public:
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   103
  MoveI2FNode( Node *value ) : Node(0,value) {}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   104
  virtual int Opcode() const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   105
  virtual const Type *bottom_type() const { return Type::FLOAT; }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   106
  virtual uint ideal_reg() const { return Op_RegF; }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   107
  virtual const Type* Value( PhaseTransform *phase ) const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   108
};
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   109
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   110
class MoveL2DNode : public Node {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   111
  public:
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   112
  MoveL2DNode( Node *value ) : Node(0,value) {}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   113
  virtual int Opcode() const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   114
  virtual const Type *bottom_type() const { return Type::DOUBLE; }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   115
  virtual uint ideal_reg() const { return Op_RegD; }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   116
  virtual const Type* Value( PhaseTransform *phase ) const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   117
};
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   118
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   119
class MoveF2INode : public Node {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   120
  public:
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   121
  MoveF2INode( Node *value ) : Node(0,value) {}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   122
  virtual int Opcode() const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   123
  virtual const Type *bottom_type() const { return TypeInt::INT; }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   124
  virtual uint ideal_reg() const { return Op_RegI; }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   125
  virtual const Type* Value( PhaseTransform *phase ) const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   126
};
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   127
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   128
class MoveD2LNode : public Node {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   129
  public:
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   130
  MoveD2LNode( Node *value ) : Node(0,value) {}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   131
  virtual int Opcode() const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   132
  virtual const Type *bottom_type() const { return TypeLong::LONG; }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   133
  virtual uint ideal_reg() const { return Op_RegL; }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   134
  virtual const Type* Value( PhaseTransform *phase ) const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   135
};
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   136
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   137
//------------------------------BinaryNode-------------------------------------
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   138
// Place holder for the 2 conditional inputs to a CMove.  CMove needs 4
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   139
// inputs: the Bool (for the lt/gt/eq/ne bits), the flags (result of some
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   140
// compare), and the 2 values to select between.  The Matcher requires a
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   141
// binary tree so we break it down like this:
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   142
//     (CMove (Binary bol cmp) (Binary src1 src2))
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   143
class BinaryNode : public Node {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   144
  public:
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   145
  BinaryNode( Node *n1, Node *n2 ) : Node(0,n1,n2) { }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   146
  virtual int Opcode() const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   147
  virtual uint ideal_reg() const { return 0; }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   148
};
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   149
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   150
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   151
#endif // SHARE_VM_OPTO_MOVENODE_HPP
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   152