hotspot/src/share/vm/opto/castnode.hpp
author iveresov
Thu, 22 Jan 2015 11:25:23 -0800
changeset 28723 0a36120cb225
parent 27708 8a8710cb8fc4
child 30300 4b12a5b40064
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_CASTNODE_HPP
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    26
#define SHARE_VM_OPTO_CASTNODE_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
#include "opto/opcodes.hpp"
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    30
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    31
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    32
//------------------------------ConstraintCastNode-----------------------------
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    33
// cast to a different range
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    34
class ConstraintCastNode: public TypeNode {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    35
  public:
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    36
  ConstraintCastNode (Node *n, const Type *t ): TypeNode(t,2) {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    37
    init_class_id(Class_ConstraintCast);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    38
    init_req(1, n);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    39
  }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    40
  virtual Node *Identity( PhaseTransform *phase );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    41
  virtual const Type *Value( PhaseTransform *phase ) const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    42
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    43
  virtual int Opcode() const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    44
  virtual uint ideal_reg() const = 0;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    45
  virtual Node *Ideal_DU_postCCP( PhaseCCP * );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    46
};
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    47
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    48
//------------------------------CastIINode-------------------------------------
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    49
// cast integer to integer (different range)
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    50
class CastIINode: public ConstraintCastNode {
27708
8a8710cb8fc4 8054478: C2: Incorrectly compiled char[] array access crashes JVM
roland
parents: 23528
diff changeset
    51
  private:
8a8710cb8fc4 8054478: C2: Incorrectly compiled char[] array access crashes JVM
roland
parents: 23528
diff changeset
    52
  // Can this node be removed post CCP or does it carry a required dependency?
8a8710cb8fc4 8054478: C2: Incorrectly compiled char[] array access crashes JVM
roland
parents: 23528
diff changeset
    53
  const bool _carry_dependency;
8a8710cb8fc4 8054478: C2: Incorrectly compiled char[] array access crashes JVM
roland
parents: 23528
diff changeset
    54
8a8710cb8fc4 8054478: C2: Incorrectly compiled char[] array access crashes JVM
roland
parents: 23528
diff changeset
    55
  protected:
8a8710cb8fc4 8054478: C2: Incorrectly compiled char[] array access crashes JVM
roland
parents: 23528
diff changeset
    56
  virtual uint cmp( const Node &n ) const;
8a8710cb8fc4 8054478: C2: Incorrectly compiled char[] array access crashes JVM
roland
parents: 23528
diff changeset
    57
  virtual uint size_of() const;
8a8710cb8fc4 8054478: C2: Incorrectly compiled char[] array access crashes JVM
roland
parents: 23528
diff changeset
    58
23528
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    59
  public:
27708
8a8710cb8fc4 8054478: C2: Incorrectly compiled char[] array access crashes JVM
roland
parents: 23528
diff changeset
    60
  CastIINode(Node *n, const Type *t, bool carry_dependency = false)
8a8710cb8fc4 8054478: C2: Incorrectly compiled char[] array access crashes JVM
roland
parents: 23528
diff changeset
    61
    : ConstraintCastNode(n,t), _carry_dependency(carry_dependency) {}
23528
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    62
  virtual int Opcode() const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    63
  virtual uint ideal_reg() const { return Op_RegI; }
27708
8a8710cb8fc4 8054478: C2: Incorrectly compiled char[] array access crashes JVM
roland
parents: 23528
diff changeset
    64
  virtual Node *Identity( PhaseTransform *phase );
8a8710cb8fc4 8054478: C2: Incorrectly compiled char[] array access crashes JVM
roland
parents: 23528
diff changeset
    65
  virtual const Type *Value( PhaseTransform *phase ) const;
8a8710cb8fc4 8054478: C2: Incorrectly compiled char[] array access crashes JVM
roland
parents: 23528
diff changeset
    66
  virtual Node *Ideal_DU_postCCP( PhaseCCP * );
8a8710cb8fc4 8054478: C2: Incorrectly compiled char[] array access crashes JVM
roland
parents: 23528
diff changeset
    67
#ifndef PRODUCT
8a8710cb8fc4 8054478: C2: Incorrectly compiled char[] array access crashes JVM
roland
parents: 23528
diff changeset
    68
  virtual void dump_spec(outputStream *st) const;
8a8710cb8fc4 8054478: C2: Incorrectly compiled char[] array access crashes JVM
roland
parents: 23528
diff changeset
    69
#endif
23528
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    70
};
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    71
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    72
//------------------------------CastPPNode-------------------------------------
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    73
// cast pointer to pointer (different type)
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    74
class CastPPNode: public ConstraintCastNode {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    75
  public:
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    76
  CastPPNode (Node *n, const Type *t ): ConstraintCastNode(n, t) {}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    77
  virtual int Opcode() const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    78
  virtual uint ideal_reg() const { return Op_RegP; }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    79
  virtual Node *Ideal_DU_postCCP( PhaseCCP * );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    80
};
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    81
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    82
//------------------------------CheckCastPPNode--------------------------------
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    83
// for _checkcast, cast pointer to pointer (different type), without JOIN,
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    84
class CheckCastPPNode: public TypeNode {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    85
  public:
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    86
  CheckCastPPNode( Node *c, Node *n, const Type *t ) : TypeNode(t,2) {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    87
    init_class_id(Class_CheckCastPP);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    88
    init_req(0, c);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    89
    init_req(1, n);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    90
  }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    91
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    92
  virtual Node *Identity( PhaseTransform *phase );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    93
  virtual const Type *Value( PhaseTransform *phase ) const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    94
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    95
  virtual int   Opcode() const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    96
  virtual uint  ideal_reg() const { return Op_RegP; }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    97
  // No longer remove CheckCast after CCP as it gives me a place to hang
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    98
  // the proper address type - which is required to compute anti-deps.
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
    99
  //virtual Node *Ideal_DU_postCCP( PhaseCCP * );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   100
};
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   101
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   102
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   103
//------------------------------CastX2PNode-------------------------------------
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   104
// convert a machine-pointer-sized integer to a raw pointer
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   105
class CastX2PNode : public Node {
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   106
  public:
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   107
  CastX2PNode( Node *n ) : Node(NULL, n) {}
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   108
  virtual int Opcode() const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   109
  virtual const Type *Value( PhaseTransform *phase ) const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   110
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   111
  virtual Node *Identity( PhaseTransform *phase );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   112
  virtual uint ideal_reg() const { return Op_RegP; }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   113
  virtual const Type *bottom_type() const { return TypeRawPtr::BOTTOM; }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   114
};
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   115
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   116
//------------------------------CastP2XNode-------------------------------------
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   117
// Used in both 32-bit and 64-bit land.
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   118
// Used for card-marks and unsafe pointer math.
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   119
class CastP2XNode : 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
  CastP2XNode( Node *ctrl, Node *n ) : Node(ctrl, n) {}
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 *Value( PhaseTransform *phase ) const;
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   124
  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   125
  virtual Node *Identity( PhaseTransform *phase );
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   126
  virtual uint ideal_reg() const { return Op_RegX; }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   127
  virtual const Type *bottom_type() const { return TypeX_X; }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   128
  // Return false to keep node from moving away from an associated card mark.
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   129
  virtual bool depends_only_on_test() const { return false; }
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   130
};
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   131
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   132
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   133
8f1a7f5e8066 8001532: C2 node files refactoring
morris
parents:
diff changeset
   134
#endif // SHARE_VM_OPTO_CASTNODE_HPP