src/hotspot/share/opto/machnode.hpp
author roland
Tue, 24 Apr 2018 15:07:20 -0700
changeset 49877 d84f06a0cae1
parent 47583 2dcbf51d0431
child 51333 f6641fcf7b7e
child 56726 3a9b7a1f9197
permissions -rw-r--r--
8200303: C2 should leverage profiling for lookupswitch/tableswitch Reviewed-by: kvn, thartmann
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
25637
369f62cdfaba 8036588: VerifyFieldClosure fails instanceKlass:3133
drchase
parents: 24923
diff changeset
     2
 * Copyright (c) 1997, 2014, 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: 4751
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4751
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: 4751
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_OPTO_MACHNODE_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_OPTO_MACHNODE_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "opto/callnode.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "opto/matcher.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "opto/multnode.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "opto/node.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#include "opto/regmask.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    33
22853
308672304981 8028767: PPC64: (part 121): smaller shared changes needed to build C2
goetz
parents: 22850
diff changeset
    34
class BiasedLockingCounters;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
class BufferBlob;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
class CodeBuffer;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
class JVMState;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
class MachCallDynamicJavaNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
class MachCallJavaNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
class MachCallLeafNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
class MachCallNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
class MachCallRuntimeNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
class MachCallStaticJavaNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
class MachEpilogNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
class MachIfNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
class MachNullCheckNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
class MachOper;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
class MachProjNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
class MachPrologNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
class MachReturnNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
class MachSafePointNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
class MachSpillCopyNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
class Matcher;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
class PhaseRegAlloc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
class RegMask;
23491
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 22914
diff changeset
    56
class RTMLockingCounters;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
class State;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
//---------------------------MachOper------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
class MachOper : public ResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  // Allocate right next to the MachNodes in the same arena
24923
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24008
diff changeset
    63
  void *operator new(size_t x) throw() {
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24008
diff changeset
    64
    Compile* C = Compile::current();
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24008
diff changeset
    65
    return C->node_arena()->Amalloc_D(x);
9631f7d691dc 8034812: remove IDX_INIT macro hack in Node class
thartmann
parents: 24008
diff changeset
    66
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  // Opcode
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  virtual uint opcode() const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  // Number of input edges.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  // Generally at least 1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  virtual uint num_edges() const { return 1; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  // Array of Register masks
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  virtual const RegMask *in_RegMask(int index) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  // Methods to output the encoding of the operand
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  // Negate conditional branches.  Error for non-branch Nodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  virtual void negate();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  // Return the value requested
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  // result register lookup, corresponding to int_format
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  virtual int  reg(PhaseRegAlloc *ra_, const Node *node)   const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  // input register lookup, corresponding to ext_format
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  virtual int  reg(PhaseRegAlloc *ra_, const Node *node, int idx)   const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  // helpers for MacroAssembler generation from ADLC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  Register  as_Register(PhaseRegAlloc *ra_, const Node *node)   const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    return ::as_Register(reg(ra_, node));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  Register  as_Register(PhaseRegAlloc *ra_, const Node *node, int idx)   const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    return ::as_Register(reg(ra_, node, idx));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  FloatRegister  as_FloatRegister(PhaseRegAlloc *ra_, const Node *node)   const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    return ::as_FloatRegister(reg(ra_, node));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  FloatRegister  as_FloatRegister(PhaseRegAlloc *ra_, const Node *node, int idx)   const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    return ::as_FloatRegister(reg(ra_, node, idx));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
#if defined(IA32) || defined(AMD64)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  XMMRegister  as_XMMRegister(PhaseRegAlloc *ra_, const Node *node)   const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    return ::as_XMMRegister(reg(ra_, node));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  XMMRegister  as_XMMRegister(PhaseRegAlloc *ra_, const Node *node, int idx)   const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
    return ::as_XMMRegister(reg(ra_, node, idx));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
#endif
22860
80a845ab5e4a 8029888: PPC64: (part 219): adl replacement variable CondRegister
goetz
parents: 22856
diff changeset
   110
  // CondRegister reg converter
80a845ab5e4a 8029888: PPC64: (part 219): adl replacement variable CondRegister
goetz
parents: 22856
diff changeset
   111
#if defined(PPC64)
80a845ab5e4a 8029888: PPC64: (part 219): adl replacement variable CondRegister
goetz
parents: 22856
diff changeset
   112
  ConditionRegister as_ConditionRegister(PhaseRegAlloc *ra_, const Node *node) const {
80a845ab5e4a 8029888: PPC64: (part 219): adl replacement variable CondRegister
goetz
parents: 22856
diff changeset
   113
    return ::as_ConditionRegister(reg(ra_, node));
80a845ab5e4a 8029888: PPC64: (part 219): adl replacement variable CondRegister
goetz
parents: 22856
diff changeset
   114
  }
80a845ab5e4a 8029888: PPC64: (part 219): adl replacement variable CondRegister
goetz
parents: 22856
diff changeset
   115
  ConditionRegister as_ConditionRegister(PhaseRegAlloc *ra_, const Node *node, int idx) const {
80a845ab5e4a 8029888: PPC64: (part 219): adl replacement variable CondRegister
goetz
parents: 22856
diff changeset
   116
    return ::as_ConditionRegister(reg(ra_, node, idx));
80a845ab5e4a 8029888: PPC64: (part 219): adl replacement variable CondRegister
goetz
parents: 22856
diff changeset
   117
  }
47583
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   118
  VectorRegister as_VectorRegister(PhaseRegAlloc *ra_, const Node *node) const {
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   119
    return ::as_VectorRegister(reg(ra_, node));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   120
  }
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   121
  VectorRegister as_VectorRegister(PhaseRegAlloc *ra_, const Node *node, int idx) const {
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   122
    return ::as_VectorRegister(reg(ra_, node, idx));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   123
  }
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   124
  VectorSRegister as_VectorSRegister(PhaseRegAlloc *ra_, const Node *node) const {
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   125
    return ::as_VectorSRegister(reg(ra_, node));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   126
  }
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   127
  VectorSRegister as_VectorSRegister(PhaseRegAlloc *ra_, const Node *node, int idx) const {
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   128
    return ::as_VectorSRegister(reg(ra_, node, idx));
2dcbf51d0431 8188139: PPC64: Superword Level Parallelization with VSX
mhorie
parents: 47216
diff changeset
   129
  }
22860
80a845ab5e4a 8029888: PPC64: (part 219): adl replacement variable CondRegister
goetz
parents: 22856
diff changeset
   130
#endif
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  virtual intptr_t  constant() const;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13104
diff changeset
   133
  virtual relocInfo::relocType constant_reloc() const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  virtual jdouble constantD() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  virtual jfloat  constantF() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  virtual jlong   constantL() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  virtual TypeOopPtr *oop() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  virtual int  ccode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  // A zero, default, indicates this value is not needed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  // May need to lookup the base register, as done in int_ and ext_format
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  virtual int  base (PhaseRegAlloc *ra_, const Node *node, int idx) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  virtual int  index(PhaseRegAlloc *ra_, const Node *node, int idx) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  virtual int  scale() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  // Parameters needed to support MEMORY_INTERFACE access to stackSlot
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  virtual int  disp (PhaseRegAlloc *ra_, const Node *node, int idx) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  // Check for PC-Relative displacement
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13104
diff changeset
   147
  virtual relocInfo::relocType disp_reloc() const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  virtual int  constant_disp() const;   // usu. 0, may return Type::OffsetBot
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  virtual int  base_position()  const;  // base edge position, or -1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  virtual int  index_position() const;  // index edge position, or -1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  // Access the TypeKlassPtr of operands with a base==RegI and disp==RegP
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  // Only returns non-null value for i486.ad's indOffset32X
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  virtual const TypePtr *disp_as_type() const { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
  // Return the label
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  virtual Label *label() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  // Return the method's address
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  virtual intptr_t  method() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  // Hash and compare over operands are currently identical
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  virtual uint  hash() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  virtual uint  cmp( const MachOper &oper ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  // Virtual clone, since I do not know how big the MachOper is.
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25637
diff changeset
   167
  virtual MachOper *clone() const = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  // Return ideal Type from simple operands.  Fail for complex operands.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  virtual const Type *type() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  // Set an integer offset if we have one, or error otherwise
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  virtual void set_con( jint c0 ) { ShouldNotReachHere();  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  // Return name of operand
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  virtual const char    *Name() const { return "???";}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  // Methods to output the text version of the operand
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  virtual void int_format(PhaseRegAlloc *,const MachNode *node, outputStream *st) const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  virtual void ext_format(PhaseRegAlloc *,const MachNode *node,int idx, outputStream *st) const=0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  virtual void dump_spec(outputStream *st) const; // Print per-operand info
22844
90f76a40ed8a 8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents: 19696
diff changeset
   184
90f76a40ed8a 8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents: 19696
diff changeset
   185
  // Check whether o is a valid oper.
90f76a40ed8a 8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents: 19696
diff changeset
   186
  static bool notAnOper(const MachOper *o) {
90f76a40ed8a 8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents: 19696
diff changeset
   187
    if (o == NULL)                   return true;
90f76a40ed8a 8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents: 19696
diff changeset
   188
    if (((intptr_t)o & 1) != 0)      return true;
90f76a40ed8a 8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents: 19696
diff changeset
   189
    if (*(address*)o == badAddress)  return true;  // kill by Node::destruct
90f76a40ed8a 8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents: 19696
diff changeset
   190
    return false;
90f76a40ed8a 8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents: 19696
diff changeset
   191
  }
90f76a40ed8a 8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents: 19696
diff changeset
   192
#endif // !PRODUCT
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
//------------------------------MachNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
// Base type for all machine specific nodes.  All node classes generated by the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
// ADLC inherit from this class.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
class MachNode : public Node {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  MachNode() : Node((uint)0), _num_opnds(0), _opnds(NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
    init_class_id(Class_Mach);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  // Required boilerplate
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  virtual uint size_of() const { return sizeof(MachNode); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  virtual int  Opcode() const;          // Always equal to MachNode
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  virtual uint rule() const = 0;        // Machine-specific opcode
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  // Number of inputs which come before the first operand.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  // Generally at least 1, to skip the Control input
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  virtual uint oper_input_base() const { return 1; }
22850
4e69ce7e1101 8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents: 22847
diff changeset
   210
  // Position of constant base node in node's inputs. -1 if
4e69ce7e1101 8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents: 22847
diff changeset
   211
  // no constant base node input.
4e69ce7e1101 8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents: 22847
diff changeset
   212
  virtual uint mach_constant_base_node_input() const { return (uint)-1; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  // Copy inputs and operands to new node of instruction.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  // Called from cisc_version() and short_branch_version().
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  // !!!! The method's body is defined in ad_<arch>.cpp file.
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25637
diff changeset
   217
  void fill_new_machnode(MachNode *n) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  // Return an equivalent instruction using memory for cisc_operand position
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25637
diff changeset
   220
  virtual MachNode *cisc_version(int offset);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  // Modify this instruction's register mask to use stack version for cisc_operand
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  virtual void use_cisc_RegMask();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  // Support for short branches
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  bool may_be_short_branch() const { return (flags() & Flag_may_be_short_branch) != 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
10264
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10255
diff changeset
   227
  // Avoid back to back some instructions on some CPUs.
24008
da7059252295 8038297: Avoid placing CTI immediately following cbcond instruction on T4
iveresov
parents: 23491
diff changeset
   228
  enum AvoidBackToBackFlag { AVOID_NONE = 0,
da7059252295 8038297: Avoid placing CTI immediately following cbcond instruction on T4
iveresov
parents: 23491
diff changeset
   229
                             AVOID_BEFORE = Flag_avoid_back_to_back_before,
da7059252295 8038297: Avoid placing CTI immediately following cbcond instruction on T4
iveresov
parents: 23491
diff changeset
   230
                             AVOID_AFTER = Flag_avoid_back_to_back_after,
da7059252295 8038297: Avoid placing CTI immediately following cbcond instruction on T4
iveresov
parents: 23491
diff changeset
   231
                             AVOID_BEFORE_AND_AFTER = AVOID_BEFORE | AVOID_AFTER };
da7059252295 8038297: Avoid placing CTI immediately following cbcond instruction on T4
iveresov
parents: 23491
diff changeset
   232
da7059252295 8038297: Avoid placing CTI immediately following cbcond instruction on T4
iveresov
parents: 23491
diff changeset
   233
  bool avoid_back_to_back(AvoidBackToBackFlag flag_value) const {
da7059252295 8038297: Avoid placing CTI immediately following cbcond instruction on T4
iveresov
parents: 23491
diff changeset
   234
    return (flags() & flag_value) == flag_value;
da7059252295 8038297: Avoid placing CTI immediately following cbcond instruction on T4
iveresov
parents: 23491
diff changeset
   235
  }
10264
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10255
diff changeset
   236
11196
a310a659c580 7077312: Provide a CALL effect for instruct declaration in the ad file
roland
parents: 10266
diff changeset
   237
  // instruction implemented with a call
a310a659c580 7077312: Provide a CALL effect for instruct declaration in the ad file
roland
parents: 10266
diff changeset
   238
  bool has_call() const { return (flags() & Flag_has_call) != 0; }
a310a659c580 7077312: Provide a CALL effect for instruct declaration in the ad file
roland
parents: 10266
diff changeset
   239
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  // First index in _in[] corresponding to operand, or -1 if there is none
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  int  operand_index(uint operand) const;
22853
308672304981 8028767: PPC64: (part 121): smaller shared changes needed to build C2
goetz
parents: 22850
diff changeset
   242
  int  operand_index(const MachOper *oper) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  // Register class input is expected in
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  virtual const RegMask &in_RegMask(uint) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  // cisc-spillable instructions redefine for use by in_RegMask
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
  virtual const RegMask *cisc_RegMask() const { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  // If this instruction is a 2-address instruction, then return the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  // index of the input which must match the output.  Not nessecary
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  // for instructions which bind the input and output register to the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  // same singleton regiser (e.g., Intel IDIV which binds AX to be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  // both an input and an output).  It is nessecary when the input and
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  // output have choices - but they must use the same choice.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  virtual uint two_adr( ) const { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  // Array of complex operand pointers.  Each corresponds to zero or
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  // more leafs.  Must be set by MachNode constructor to point to an
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  // internal array of MachOpers.  The MachOper array is sized by
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  // specific MachNodes described in the ADL.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  uint _num_opnds;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  MachOper **_opnds;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  uint  num_opnds() const { return _num_opnds; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  // Emit bytes into cbuf
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  virtual void  emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
22844
90f76a40ed8a 8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents: 19696
diff changeset
   268
  // Expand node after register allocation.
90f76a40ed8a 8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents: 19696
diff changeset
   269
  // Node is replaced by several nodes in the postalloc expand phase.
90f76a40ed8a 8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents: 19696
diff changeset
   270
  // Corresponding methods are generated for nodes if they specify
90f76a40ed8a 8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents: 19696
diff changeset
   271
  // postalloc_expand. See block.cpp for more documentation.
90f76a40ed8a 8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents: 19696
diff changeset
   272
  virtual bool requires_postalloc_expand() const { return false; }
90f76a40ed8a 8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents: 19696
diff changeset
   273
  virtual void postalloc_expand(GrowableArray <Node *> *nodes, PhaseRegAlloc *ra_);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  // Size of instruction in bytes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
  virtual uint  size(PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
  // Helper function that computes size by emitting code
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
  virtual uint  emit_size(PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
  // Return the alignment required (in units of relocInfo::addr_unit())
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
  // for this instruction (must be a power of 2)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
  virtual int   alignment_required() const { return 1; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
  // Return the padding (in bytes) to be emitted before this
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
  // instruction to properly align it.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
  virtual int   compute_padding(int current_offset) const { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  // Return number of relocatable values contained in this instruction
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  virtual int   reloc() const { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
22850
4e69ce7e1101 8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents: 22847
diff changeset
   290
  // Return number of words used for double constants in this instruction
4e69ce7e1101 8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents: 22847
diff changeset
   291
  virtual int   ins_num_consts() const { return 0; }
4e69ce7e1101 8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents: 22847
diff changeset
   292
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
  // Hash and compare over operands.  Used to do GVN on machine Nodes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
  virtual uint  hash() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
  virtual uint  cmp( const Node &n ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
  // Expand method for MachNode, replaces nodes representing pseudo
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
  // instructions with a set of nodes which represent real machine
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  // instructions and compute the same value.
4751
9418f690831d 6916644: C2 compiler crash on x86
never
parents: 4566
diff changeset
   300
  virtual MachNode *Expand( State *, Node_List &proj_list, Node* mem ) { return this; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
  // Bottom_type call; value comes from operand0
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
  virtual const class Type *bottom_type() const { return _opnds[0]->type(); }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13104
diff changeset
   304
  virtual uint ideal_reg() const { const Type *t = _opnds[0]->type(); return t == TypeInt::CC ? Op_RegFlags : t->ideal_reg(); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
  // If this is a memory op, return the base pointer and fixed offset.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
  // If there are no such, return NULL.  If there are multiple addresses
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
  // or the address is indeterminate (rare cases) then return (Node*)-1,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
  // which serves as node bottom.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
  // If the offset is not statically determined, set it to Type::OffsetBot.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
  // This method is free to ignore stack slots if that helps.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
  #define TYPE_PTR_SENTINAL  ((const TypePtr*)-1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
  // Passing TYPE_PTR_SENTINAL as adr_type asks for computation of the adr_type if possible
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
  const Node* get_base_and_disp(intptr_t &offset, const TypePtr* &adr_type) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
  // Helper for get_base_and_disp: find the base and index input nodes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
  // Returns the MachOper as determined by memory_operand(), for use, if
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  // needed by the caller. If (MachOper *)-1 is returned, base and index
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
  // are set to NodeSentinel. If (MachOper *) NULL is returned, base and
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
  // index are set to NULL.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
  const MachOper* memory_inputs(Node* &base, Node* &index) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
  // Helper for memory_inputs:  Which operand carries the necessary info?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
  // By default, returns NULL, which means there is no such operand.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  // If it returns (MachOper*)-1, this means there are multiple memories.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
  virtual const MachOper* memory_operand() const { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
  // Call "get_base_and_disp" to decide which category of memory is used here.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
  virtual const class TypePtr *adr_type() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
  // Apply peephole rule(s) to this instruction
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25637
diff changeset
   332
  virtual MachNode *peephole(Block *block, int block_index, PhaseRegAlloc *ra_, int &deleted);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
  // Top-level ideal Opcode matched
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
  virtual int ideal_Opcode()     const { return Op_Node; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
  // Adds the label for the case
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
  virtual void add_case_label( int switch_val, Label* blockLabel);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
  // Set the absolute address for methods
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
  virtual void method_set( intptr_t addr );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
  // Should we clone rather than spill this instruction?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
  bool rematerialize() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
  // Get the pipeline info
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
  static const Pipeline *pipeline_class();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
  virtual const Pipeline *pipeline() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
22856
03ad2cf18166 8029015: PPC64 (part 216): opto: trap based null and range checks
goetz
parents: 22853
diff changeset
   350
  // Returns true if this node is a check that can be implemented with a trap.
03ad2cf18166 8029015: PPC64 (part 216): opto: trap based null and range checks
goetz
parents: 22853
diff changeset
   351
  virtual bool is_TrapBasedCheckNode() const { return false; }
03ad2cf18166 8029015: PPC64 (part 216): opto: trap based null and range checks
goetz
parents: 22853
diff changeset
   352
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
  virtual const char *Name() const = 0; // Machine-specific name
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
  virtual void dump_spec(outputStream *st) const; // Print per-node info
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
  void         dump_format(PhaseRegAlloc *ra, outputStream *st) const; // access to virtual
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
//------------------------------MachIdealNode----------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
// Machine specific versions of nodes that must be defined by user.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
// These are not converted by matcher from ideal nodes to machine nodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
// but are inserted into the code by the compiler.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
class MachIdealNode : public MachNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
  MachIdealNode( ) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
  // Define the following defaults for non-matched machine nodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
  virtual uint oper_input_base() const { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
  virtual uint rule()            const { return 9999999; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
  virtual const class Type *bottom_type() const { return _opnds == NULL ? Type::CONTROL : MachNode::bottom_type(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
//------------------------------MachTypeNode----------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
// Machine Nodes that need to retain a known Type.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
class MachTypeNode : public MachNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
  virtual uint size_of() const { return sizeof(*this); } // Size is bigger
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
public:
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 11196
diff changeset
   379
  MachTypeNode( ) {}
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
  const Type *_bottom_type;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
  virtual const class Type *bottom_type() const { return _bottom_type; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
  virtual void dump_spec(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
//------------------------------MachBreakpointNode----------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
// Machine breakpoint or interrupt Node
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
class MachBreakpointNode : public MachIdealNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
  MachBreakpointNode( ) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
  virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
  virtual uint size(PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
  virtual const char *Name() const { return "Breakpoint"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
  virtual void format( PhaseRegAlloc *, outputStream *st ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
7433
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   402
//------------------------------MachConstantBaseNode--------------------------
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   403
// Machine node that represents the base address of the constant table.
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   404
class MachConstantBaseNode : public MachIdealNode {
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   405
public:
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   406
  static const RegMask& _out_RegMask;  // We need the out_RegMask statically in MachConstantNode::in_RegMask().
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   407
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   408
public:
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   409
  MachConstantBaseNode() : MachIdealNode() {
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   410
    init_class_id(Class_MachConstantBase);
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   411
  }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   412
  virtual const class Type* bottom_type() const { return TypeRawPtr::NOTNULL; }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   413
  virtual uint ideal_reg() const { return Op_RegP; }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   414
  virtual uint oper_input_base() const { return 1; }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   415
22844
90f76a40ed8a 8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents: 19696
diff changeset
   416
  virtual bool requires_postalloc_expand() const;
90f76a40ed8a 8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents: 19696
diff changeset
   417
  virtual void postalloc_expand(GrowableArray <Node *> *nodes, PhaseRegAlloc *ra_);
90f76a40ed8a 8003854: PPC64 (part 115): Introduce PostallocExpand that expands nodes after register allocation
goetz
parents: 19696
diff changeset
   418
7433
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   419
  virtual void emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const;
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   420
  virtual uint size(PhaseRegAlloc* ra_) const;
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   421
  virtual bool pinned() const { return UseRDPCForConstantTableBase; }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   422
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   423
  static const RegMask& static_out_RegMask() { return _out_RegMask; }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   424
  virtual const RegMask& out_RegMask() const { return static_out_RegMask(); }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   425
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   426
#ifndef PRODUCT
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   427
  virtual const char* Name() const { return "MachConstantBaseNode"; }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   428
  virtual void format(PhaseRegAlloc*, outputStream* st) const;
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   429
#endif
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   430
};
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   431
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   432
//------------------------------MachConstantNode-------------------------------
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   433
// Machine node that holds a constant which is stored in the constant table.
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 11196
diff changeset
   434
class MachConstantNode : public MachTypeNode {
7433
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   435
protected:
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   436
  Compile::Constant _constant;  // This node's constant.
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   437
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   438
public:
13104
657b387034fb 7119644: Increase superword's vector size up to 256 bits
kvn
parents: 11196
diff changeset
   439
  MachConstantNode() : MachTypeNode() {
7433
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   440
    init_class_id(Class_MachConstant);
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   441
  }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   442
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   443
  virtual void eval_constant(Compile* C) {
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   444
#ifdef ASSERT
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   445
    tty->print("missing MachConstantNode eval_constant function: ");
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   446
    dump();
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   447
#endif
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   448
    ShouldNotCallThis();
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   449
  }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   450
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   451
  virtual const RegMask &in_RegMask(uint idx) const {
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   452
    if (idx == mach_constant_base_node_input())
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   453
      return MachConstantBaseNode::static_out_RegMask();
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   454
    return MachNode::in_RegMask(idx);
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   455
  }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   456
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   457
  // Input edge of MachConstantBaseNode.
22850
4e69ce7e1101 8028580: PPC64 (part 114/120): Support for Call nodes with constants.
goetz
parents: 22847
diff changeset
   458
  virtual uint mach_constant_base_node_input() const { return req() - 1; }
7433
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   459
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   460
  int  constant_offset();
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   461
  int  constant_offset() const { return ((MachConstantNode*) this)->constant_offset(); }
22847
603ad1f10e16 8028401: PPC (part 117): Improve usability of adlc and format() functionality.
goetz
parents: 22844
diff changeset
   462
  // Unchecked version to avoid assertions in debug output.
603ad1f10e16 8028401: PPC (part 117): Improve usability of adlc and format() functionality.
goetz
parents: 22844
diff changeset
   463
  int  constant_offset_unchecked() const;
7433
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   464
};
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   465
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
//------------------------------MachUEPNode-----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
// Machine Unvalidated Entry Point Node
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
class MachUEPNode : public MachIdealNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
  MachUEPNode( ) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
  virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
  virtual uint size(PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
  virtual const char *Name() const { return "Unvalidated-Entry-Point"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
  virtual void format( PhaseRegAlloc *, outputStream *st ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
//------------------------------MachPrologNode--------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
// Machine function Prolog Node
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
class MachPrologNode : public MachIdealNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
  MachPrologNode( ) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
  virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
  virtual uint size(PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
  virtual int reloc() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
  virtual const char *Name() const { return "Prolog"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
  virtual void format( PhaseRegAlloc *, outputStream *st ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
//------------------------------MachEpilogNode--------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
// Machine function Epilog Node
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
class MachEpilogNode : public MachIdealNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
  MachEpilogNode(bool do_poll = false) : _do_polling(do_poll) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
  virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
  virtual uint size(PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
  virtual int reloc() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
  virtual const Pipeline *pipeline() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
  bool _do_polling;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
  bool do_polling() const { return _do_polling; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
  // Offset of safepoint from the beginning of the node
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
  int safepoint_offset() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
  virtual const char *Name() const { return "Epilog"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
  virtual void format( PhaseRegAlloc *, outputStream *st ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   517
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   518
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   519
489c9b5090e2 Initial load
duke
parents:
diff changeset
   520
//------------------------------MachNopNode-----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   521
// Machine function Nop Node
489c9b5090e2 Initial load
duke
parents:
diff changeset
   522
class MachNopNode : public MachIdealNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   523
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   524
  int _count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   525
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
  MachNopNode( ) : _count(1) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
  MachNopNode( int count ) : _count(count) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
  virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
  virtual uint size(PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
  virtual const class Type *bottom_type() const { return Type::CONTROL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   532
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
  virtual int ideal_Opcode() const { return Op_Con; } // bogus; see output.cpp
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
  virtual const Pipeline *pipeline() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   535
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
  virtual const char *Name() const { return "Nop"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
  virtual void format( PhaseRegAlloc *, outputStream *st ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
  virtual void dump_spec(outputStream *st) const { } // No per-operand info
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   540
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   541
489c9b5090e2 Initial load
duke
parents:
diff changeset
   542
//------------------------------MachSpillCopyNode------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   543
// Machine SpillCopy Node.  Copies 1 or 2 words from any location to any
489c9b5090e2 Initial load
duke
parents:
diff changeset
   544
// location (stack or register).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   545
class MachSpillCopyNode : public MachIdealNode {
22914
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   546
public:
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   547
  enum SpillType {
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   548
    TwoAddress,                        // Inserted when coalescing of a two-address-instruction node and its input fails
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   549
    PhiInput,                          // Inserted when coalescing of a phi node and its input fails
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   550
    DebugUse,                          // Inserted as debug info spills to safepoints in non-frequent blocks
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   551
    LoopPhiInput,                      // Pre-split compares of loop-phis
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   552
    Definition,                        // An lrg marked as spilled will be spilled to memory right after its definition,
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   553
                                       // if in high pressure region or the lrg is bound
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   554
    RegToReg,                          // A register to register move
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   555
    RegToMem,                          // A register to memory move
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   556
    MemToReg,                          // A memory to register move
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   557
    PhiLocationDifferToInputLocation,  // When coalescing phi nodes in PhaseChaitin::Split(), a move spill is inserted if
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   558
                                       // the phi and its input resides at different locations (i.e. reg or mem)
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   559
    BasePointerToMem,                  // Spill base pointer to memory at safepoint
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   560
    InputToRematerialization,          // When rematerializing a node we stretch the inputs live ranges, and they might be
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   561
                                       // stretched beyond a new definition point, therefore we split out new copies instead
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   562
    CallUse,                           // Spill use at a call
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   563
    Bound                              // An lrg marked as spill that is bound and needs to be spilled at a use
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   564
  };
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   565
private:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   566
  const RegMask *_in;           // RegMask for input
489c9b5090e2 Initial load
duke
parents:
diff changeset
   567
  const RegMask *_out;          // RegMask for output
489c9b5090e2 Initial load
duke
parents:
diff changeset
   568
  const Type *_type;
22914
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   569
  const SpillType _spill_type;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   570
public:
22914
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   571
  MachSpillCopyNode(SpillType spill_type, Node *n, const RegMask &in, const RegMask &out ) :
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   572
    MachIdealNode(), _spill_type(spill_type), _in(&in), _out(&out), _type(n->bottom_type()) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   573
    init_class_id(Class_MachSpillCopy);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
    init_flags(Flag_is_Copy);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   575
    add_req(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
    add_req(n);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   578
  virtual uint size_of() const { return sizeof(*this); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   579
  void set_out_RegMask(const RegMask &out) { _out = &out; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   580
  void set_in_RegMask(const RegMask &in) { _in = &in; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   581
  virtual const RegMask &out_RegMask() const { return *_out; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   582
  virtual const RegMask &in_RegMask(uint) const { return *_in; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   583
  virtual const class Type *bottom_type() const { return _type; }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13104
diff changeset
   584
  virtual uint ideal_reg() const { return _type->ideal_reg(); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
  virtual uint oper_input_base() const { return 1; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   586
  uint implementation( CodeBuffer *cbuf, PhaseRegAlloc *ra_, bool do_size, outputStream* st ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   587
489c9b5090e2 Initial load
duke
parents:
diff changeset
   588
  virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   589
  virtual uint size(PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   590
22914
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   591
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   592
#ifndef PRODUCT
34194
213af0859e7e 8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents: 28648
diff changeset
   593
  static const char *spill_type(SpillType st) {
213af0859e7e 8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents: 28648
diff changeset
   594
    switch (st) {
22914
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   595
      case TwoAddress:
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   596
        return "TwoAddressSpillCopy";
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   597
      case PhiInput:
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   598
        return "PhiInputSpillCopy";
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   599
      case DebugUse:
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   600
        return "DebugUseSpillCopy";
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   601
      case LoopPhiInput:
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   602
        return "LoopPhiInputSpillCopy";
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   603
      case Definition:
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   604
        return "DefinitionSpillCopy";
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   605
      case RegToReg:
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   606
        return "RegToRegSpillCopy";
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   607
      case RegToMem:
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   608
        return "RegToMemSpillCopy";
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   609
      case MemToReg:
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   610
        return "MemToRegSpillCopy";
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   611
      case PhiLocationDifferToInputLocation:
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   612
        return "PhiLocationDifferToInputLocationSpillCopy";
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   613
      case BasePointerToMem:
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   614
        return "BasePointerToMemSpillCopy";
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   615
      case InputToRematerialization:
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   616
        return "InputToRematerializationSpillCopy";
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   617
      case CallUse:
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   618
        return "CallUseSpillCopy";
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   619
      case Bound:
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   620
        return "BoundSpillCopy";
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   621
      default:
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   622
        assert(false, "Must have valid spill type");
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   623
        return "MachSpillCopy";
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   624
    }
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   625
  }
0712db174bbb 8032656: Tag the MachSpillCopies with purpose information
adlertz
parents: 22860
diff changeset
   626
34194
213af0859e7e 8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents: 28648
diff changeset
   627
  virtual const char *Name() const {
213af0859e7e 8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents: 28648
diff changeset
   628
    return spill_type(_spill_type);
213af0859e7e 8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents: 28648
diff changeset
   629
  }
213af0859e7e 8141137: C2 fails rematerializing nodes using flag registers.
goetz
parents: 28648
diff changeset
   630
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   631
  virtual void format( PhaseRegAlloc *, outputStream *st ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   632
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   633
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   634
28648
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   635
// MachMergeNode is similar to a PhiNode in a sense it merges multiple values,
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   636
// however it doesn't have a control input and is more like a MergeMem.
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   637
// It is inserted after the register allocation is done to ensure that nodes use single
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   638
// definition of a multidef lrg in a block.
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   639
class MachMergeNode : public MachIdealNode {
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   640
public:
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   641
  MachMergeNode(Node *n1) {
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   642
    init_class_id(Class_MachMerge);
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   643
    add_req(NULL);
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   644
    add_req(n1);
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   645
  }
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   646
  virtual const RegMask &out_RegMask() const { return in(1)->out_RegMask(); }
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   647
  virtual const RegMask &in_RegMask(uint idx) const { return in(1)->in_RegMask(idx); }
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   648
  virtual const class Type *bottom_type() const { return in(1)->bottom_type(); }
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   649
  virtual uint ideal_reg() const { return bottom_type()->ideal_reg(); }
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   650
  virtual uint oper_input_base() const { return 1; }
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   651
  virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const { }
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   652
  virtual uint size(PhaseRegAlloc *ra_) const { return 0; }
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   653
#ifndef PRODUCT
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   654
  virtual const char *Name() const { return "MachMerge"; }
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   655
#endif
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   656
};
102bdbb42723 8068881: SIGBUS in C2 compiled method weblogic.wsee.jaxws.framework.jaxrpc.EnvironmentFactory$SimulatedWsdlDefinitions.<init>
iveresov
parents: 25930
diff changeset
   657
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   658
//------------------------------MachBranchNode--------------------------------
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   659
// Abstract machine branch Node
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   660
class MachBranchNode : public MachIdealNode {
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   661
public:
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   662
  MachBranchNode() : MachIdealNode() {
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   663
    init_class_id(Class_MachBranch);
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   664
  }
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   665
  virtual void label_set(Label* label, uint block_num) = 0;
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   666
  virtual void save_label(Label** label, uint* block_num) = 0;
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   667
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   668
  // Support for short branches
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25637
diff changeset
   669
  virtual MachNode *short_branch_version() { return NULL; }
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   670
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   671
  virtual bool pinned() const { return true; };
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   672
};
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   673
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   674
//------------------------------MachNullChkNode--------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   675
// Machine-dependent null-pointer-check Node.  Points a real MachNode that is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   676
// also some kind of memory op.  Turns the indicated MachNode into a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   677
// conditional branch with good latency on the ptr-not-null path and awful
489c9b5090e2 Initial load
duke
parents:
diff changeset
   678
// latency on the pointer-is-null path.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   679
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   680
class MachNullCheckNode : public MachBranchNode {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   681
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   682
  const uint _vidx;             // Index of memop being tested
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   683
  MachNullCheckNode( Node *ctrl, Node *memop, uint vidx ) : MachBranchNode(), _vidx(vidx) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   684
    init_class_id(Class_MachNullCheck);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   685
    add_req(ctrl);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   686
    add_req(memop);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   687
  }
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   688
  virtual uint size_of() const { return sizeof(*this); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   689
489c9b5090e2 Initial load
duke
parents:
diff changeset
   690
  virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 7433
diff changeset
   691
  virtual void label_set(Label* label, uint block_num);
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   692
  virtual void save_label(Label** label, uint* block_num);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   693
  virtual void negate() { }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   694
  virtual const class Type *bottom_type() const { return TypeTuple::IFBOTH; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   695
  virtual uint ideal_reg() const { return NotAMachineReg; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   696
  virtual const RegMask &in_RegMask(uint) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   697
  virtual const RegMask &out_RegMask() const { return RegMask::Empty; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   698
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   699
  virtual const char *Name() const { return "NullCheck"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   700
  virtual void format( PhaseRegAlloc *, outputStream *st ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   701
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   702
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   703
489c9b5090e2 Initial load
duke
parents:
diff changeset
   704
//------------------------------MachProjNode----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   705
// Machine-dependent Ideal projections (how is that for an oxymoron).  Really
489c9b5090e2 Initial load
duke
parents:
diff changeset
   706
// just MachNodes made by the Ideal world that replicate simple projections
489c9b5090e2 Initial load
duke
parents:
diff changeset
   707
// but with machine-dependent input & output register masks.  Generally
489c9b5090e2 Initial load
duke
parents:
diff changeset
   708
// produced as part of calling conventions.  Normally I make MachNodes as part
489c9b5090e2 Initial load
duke
parents:
diff changeset
   709
// of the Matcher process, but the Matcher is ill suited to issues involving
489c9b5090e2 Initial load
duke
parents:
diff changeset
   710
// frame handling, so frame handling is all done in the Ideal world with
489c9b5090e2 Initial load
duke
parents:
diff changeset
   711
// occasional callbacks to the machine model for important info.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   712
class MachProjNode : public ProjNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   713
public:
10255
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   714
  MachProjNode( Node *multi, uint con, const RegMask &out, uint ideal_reg ) : ProjNode(multi,con), _rout(out), _ideal_reg(ideal_reg) {
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   715
    init_class_id(Class_MachProj);
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   716
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   717
  RegMask _rout;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   718
  const uint  _ideal_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   719
  enum projType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   720
    unmatched_proj = 0,         // Projs for Control, I/O, memory not matched
489c9b5090e2 Initial load
duke
parents:
diff changeset
   721
    fat_proj       = 999        // Projs killing many regs, defined by _rout
489c9b5090e2 Initial load
duke
parents:
diff changeset
   722
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   723
  virtual int   Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   724
  virtual const Type *bottom_type() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   725
  virtual const TypePtr *adr_type() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   726
  virtual const RegMask &in_RegMask(uint) const { return RegMask::Empty; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   727
  virtual const RegMask &out_RegMask() const { return _rout; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   728
  virtual uint  ideal_reg() const { return _ideal_reg; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   729
  // Need size_of() for virtual ProjNode::clone()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   730
  virtual uint  size_of() const { return sizeof(MachProjNode); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   731
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   732
  virtual void dump_spec(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   733
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   734
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   735
489c9b5090e2 Initial load
duke
parents:
diff changeset
   736
//------------------------------MachIfNode-------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   737
// Machine-specific versions of IfNodes
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   738
class MachIfNode : public MachBranchNode {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   739
  virtual uint size_of() const { return sizeof(*this); } // Size is bigger
489c9b5090e2 Initial load
duke
parents:
diff changeset
   740
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   741
  float _prob;                  // Probability branch goes either way
489c9b5090e2 Initial load
duke
parents:
diff changeset
   742
  float _fcnt;                  // Frequency counter
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   743
  MachIfNode() : MachBranchNode() {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   744
    init_class_id(Class_MachIf);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   745
  }
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   746
  // Negate conditional branches.
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   747
  virtual void negate() = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   748
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   749
  virtual void dump_spec(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   750
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   751
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   752
49877
d84f06a0cae1 8200303: C2 should leverage profiling for lookupswitch/tableswitch
roland
parents: 47583
diff changeset
   753
//------------------------------MachJumpNode-----------------------------------
d84f06a0cae1 8200303: C2 should leverage profiling for lookupswitch/tableswitch
roland
parents: 47583
diff changeset
   754
// Machine-specific versions of JumpNodes
d84f06a0cae1 8200303: C2 should leverage profiling for lookupswitch/tableswitch
roland
parents: 47583
diff changeset
   755
class MachJumpNode : public MachConstantNode {
d84f06a0cae1 8200303: C2 should leverage profiling for lookupswitch/tableswitch
roland
parents: 47583
diff changeset
   756
public:
d84f06a0cae1 8200303: C2 should leverage profiling for lookupswitch/tableswitch
roland
parents: 47583
diff changeset
   757
  float* _probs;
d84f06a0cae1 8200303: C2 should leverage profiling for lookupswitch/tableswitch
roland
parents: 47583
diff changeset
   758
  MachJumpNode() : MachConstantNode() {
d84f06a0cae1 8200303: C2 should leverage profiling for lookupswitch/tableswitch
roland
parents: 47583
diff changeset
   759
    init_class_id(Class_MachJump);
d84f06a0cae1 8200303: C2 should leverage profiling for lookupswitch/tableswitch
roland
parents: 47583
diff changeset
   760
  }
d84f06a0cae1 8200303: C2 should leverage profiling for lookupswitch/tableswitch
roland
parents: 47583
diff changeset
   761
};
d84f06a0cae1 8200303: C2 should leverage profiling for lookupswitch/tableswitch
roland
parents: 47583
diff changeset
   762
10255
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   763
//------------------------------MachGotoNode-----------------------------------
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   764
// Machine-specific versions of GotoNodes
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   765
class MachGotoNode : public MachBranchNode {
10255
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   766
public:
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   767
  MachGotoNode() : MachBranchNode() {
10255
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   768
    init_class_id(Class_MachGoto);
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   769
  }
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   770
};
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   771
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   772
//------------------------------MachFastLockNode-------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   773
// Machine-specific versions of FastLockNodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   774
class MachFastLockNode : public MachNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   775
  virtual uint size_of() const { return sizeof(*this); } // Size is bigger
489c9b5090e2 Initial load
duke
parents:
diff changeset
   776
public:
23491
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 22914
diff changeset
   777
  BiasedLockingCounters*        _counters;
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 22914
diff changeset
   778
  RTMLockingCounters*       _rtm_counters; // RTM lock counters for inflated locks
f690330b10b9 8031320: Use Intel RTM instructions for locks
kvn
parents: 22914
diff changeset
   779
  RTMLockingCounters* _stack_rtm_counters; // RTM lock counters for stack locks
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   780
  MachFastLockNode() : MachNode() {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   781
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   782
489c9b5090e2 Initial load
duke
parents:
diff changeset
   783
//------------------------------MachReturnNode--------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   784
// Machine-specific versions of subroutine returns
489c9b5090e2 Initial load
duke
parents:
diff changeset
   785
class MachReturnNode : public MachNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   786
  virtual uint size_of() const; // Size is bigger
489c9b5090e2 Initial load
duke
parents:
diff changeset
   787
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   788
  RegMask *_in_rms;             // Input register masks, set during allocation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   789
  ReallocMark _nesting;         // assertion check for reallocations
489c9b5090e2 Initial load
duke
parents:
diff changeset
   790
  const TypePtr* _adr_type;     // memory effects of call or return
489c9b5090e2 Initial load
duke
parents:
diff changeset
   791
  MachReturnNode() : MachNode() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   792
    init_class_id(Class_MachReturn);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   793
    _adr_type = TypePtr::BOTTOM; // the default: all of memory
489c9b5090e2 Initial load
duke
parents:
diff changeset
   794
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   795
489c9b5090e2 Initial load
duke
parents:
diff changeset
   796
  void set_adr_type(const TypePtr* atp) { _adr_type = atp; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   797
489c9b5090e2 Initial load
duke
parents:
diff changeset
   798
  virtual const RegMask &in_RegMask(uint) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   799
  virtual bool pinned() const { return true; };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   800
  virtual const TypePtr *adr_type() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   801
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   802
489c9b5090e2 Initial load
duke
parents:
diff changeset
   803
//------------------------------MachSafePointNode-----------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   804
// Machine-specific versions of safepoints
489c9b5090e2 Initial load
duke
parents:
diff changeset
   805
class MachSafePointNode : public MachReturnNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   806
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   807
  OopMap*         _oop_map;     // Array of OopMap info (8-bit char) for GC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   808
  JVMState*       _jvms;        // Pointer to list of JVM State Objects
489c9b5090e2 Initial load
duke
parents:
diff changeset
   809
  uint            _jvmadj;      // Extra delta to jvms indexes (mach. args)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   810
  OopMap*         oop_map() const { return _oop_map; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   811
  void            set_oop_map(OopMap* om) { _oop_map = om; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   812
489c9b5090e2 Initial load
duke
parents:
diff changeset
   813
  MachSafePointNode() : MachReturnNode(), _oop_map(NULL), _jvms(NULL), _jvmadj(0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   814
    init_class_id(Class_MachSafePoint);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   815
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   816
489c9b5090e2 Initial load
duke
parents:
diff changeset
   817
  virtual JVMState* jvms() const { return _jvms; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   818
  void set_jvms(JVMState* s) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   819
    _jvms = s;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   820
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   821
  virtual const Type    *bottom_type() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   822
489c9b5090e2 Initial load
duke
parents:
diff changeset
   823
  virtual const RegMask &in_RegMask(uint) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   824
489c9b5090e2 Initial load
duke
parents:
diff changeset
   825
  // Functionality from old debug nodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   826
  Node *returnadr() const { return in(TypeFunc::ReturnAdr); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   827
  Node *frameptr () const { return in(TypeFunc::FramePtr); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   828
489c9b5090e2 Initial load
duke
parents:
diff changeset
   829
  Node *local(const JVMState* jvms, uint idx) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   830
    assert(verify_jvms(jvms), "jvms must match");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   831
    return in(_jvmadj + jvms->locoff() + idx);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   832
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   833
  Node *stack(const JVMState* jvms, uint idx) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   834
    assert(verify_jvms(jvms), "jvms must match");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   835
    return in(_jvmadj + jvms->stkoff() + idx);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   836
 }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   837
  Node *monitor_obj(const JVMState* jvms, uint idx) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   838
    assert(verify_jvms(jvms), "jvms must match");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   839
    return in(_jvmadj + jvms->monitor_obj_offset(idx));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   840
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   841
  Node *monitor_box(const JVMState* jvms, uint idx) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   842
    assert(verify_jvms(jvms), "jvms must match");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   843
    return in(_jvmadj + jvms->monitor_box_offset(idx));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   844
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   845
  void  set_local(const JVMState* jvms, uint idx, Node *c) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   846
    assert(verify_jvms(jvms), "jvms must match");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   847
    set_req(_jvmadj + jvms->locoff() + idx, c);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   848
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   849
  void  set_stack(const JVMState* jvms, uint idx, Node *c) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   850
    assert(verify_jvms(jvms), "jvms must match");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   851
    set_req(_jvmadj + jvms->stkoff() + idx, c);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   852
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   853
  void  set_monitor(const JVMState* jvms, uint idx, Node *c) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   854
    assert(verify_jvms(jvms), "jvms must match");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   855
    set_req(_jvmadj + jvms->monoff() + idx, c);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   856
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   857
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   858
489c9b5090e2 Initial load
duke
parents:
diff changeset
   859
//------------------------------MachCallNode----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   860
// Machine-specific versions of subroutine calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
   861
class MachCallNode : public MachSafePointNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   862
protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   863
  virtual uint hash() const { return NO_HASH; }  // CFG nodes do not hash
489c9b5090e2 Initial load
duke
parents:
diff changeset
   864
  virtual uint cmp( const Node &n ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   865
  virtual uint size_of() const = 0; // Size is bigger
489c9b5090e2 Initial load
duke
parents:
diff changeset
   866
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   867
  const TypeFunc *_tf;        // Function type
489c9b5090e2 Initial load
duke
parents:
diff changeset
   868
  address      _entry_point;  // Address of the method being called
489c9b5090e2 Initial load
duke
parents:
diff changeset
   869
  float        _cnt;          // Estimate of number of times called
489c9b5090e2 Initial load
duke
parents:
diff changeset
   870
  uint         _argsize;      // Size of argument block on stack
489c9b5090e2 Initial load
duke
parents:
diff changeset
   871
489c9b5090e2 Initial load
duke
parents:
diff changeset
   872
  const TypeFunc* tf()        const { return _tf; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   873
  const address entry_point() const { return _entry_point; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   874
  const float   cnt()         const { return _cnt; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   875
  uint argsize()              const { return _argsize; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   876
489c9b5090e2 Initial load
duke
parents:
diff changeset
   877
  void set_tf(const TypeFunc* tf) { _tf = tf; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   878
  void set_entry_point(address p) { _entry_point = p; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   879
  void set_cnt(float c)           { _cnt = c; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   880
  void set_argsize(int s)         { _argsize = s; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   881
489c9b5090e2 Initial load
duke
parents:
diff changeset
   882
  MachCallNode() : MachSafePointNode() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   883
    init_class_id(Class_MachCall);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   884
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   885
489c9b5090e2 Initial load
duke
parents:
diff changeset
   886
  virtual const Type *bottom_type() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   887
  virtual bool  pinned() const { return false; }
35551
36ef3841fb34 8146629: Make phase->is_IterGVN() accessible from Node::Identity and Node::Value
thartmann
parents: 35086
diff changeset
   888
  virtual const Type* Value(PhaseGVN* phase) const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   889
  virtual const RegMask &in_RegMask(uint) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   890
  virtual int ret_addr_offset() { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   891
489c9b5090e2 Initial load
duke
parents:
diff changeset
   892
  bool returns_long() const { return tf()->return_type() == T_LONG; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   893
  bool return_value_is_used() const;
25637
369f62cdfaba 8036588: VerifyFieldClosure fails instanceKlass:3133
drchase
parents: 24923
diff changeset
   894
369f62cdfaba 8036588: VerifyFieldClosure fails instanceKlass:3133
drchase
parents: 24923
diff changeset
   895
  // Similar to cousin class CallNode::returns_pointer
369f62cdfaba 8036588: VerifyFieldClosure fails instanceKlass:3133
drchase
parents: 24923
diff changeset
   896
  bool returns_pointer() const;
369f62cdfaba 8036588: VerifyFieldClosure fails instanceKlass:3133
drchase
parents: 24923
diff changeset
   897
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   898
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   899
  virtual void dump_spec(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   900
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   901
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   902
489c9b5090e2 Initial load
duke
parents:
diff changeset
   903
//------------------------------MachCallJavaNode------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   904
// "Base" class for machine-specific versions of subroutine calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
   905
class MachCallJavaNode : public MachCallNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   906
protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   907
  virtual uint cmp( const Node &n ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   908
  virtual uint size_of() const; // Size is bigger
489c9b5090e2 Initial load
duke
parents:
diff changeset
   909
public:
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 34194
diff changeset
   910
  ciMethod* _method;                 // Method being direct called
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 34194
diff changeset
   911
  bool      _override_symbolic_info; // Override symbolic call site info from bytecode
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 34194
diff changeset
   912
  int       _bci;                    // Byte Code index of call byte code
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 34194
diff changeset
   913
  bool      _optimized_virtual;      // Tells if node is a static call or an optimized virtual
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 34194
diff changeset
   914
  bool      _method_handle_invoke;   // Tells if the call has to preserve SP
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 34194
diff changeset
   915
  MachCallJavaNode() : MachCallNode(), _override_symbolic_info(false) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   916
    init_class_id(Class_MachCallJava);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   917
  }
4566
b363f6ef4068 6829187: compiler optimizations required for JSR 292
twisti
parents: 1
diff changeset
   918
b363f6ef4068 6829187: compiler optimizations required for JSR 292
twisti
parents: 1
diff changeset
   919
  virtual const RegMask &in_RegMask(uint) const;
b363f6ef4068 6829187: compiler optimizations required for JSR 292
twisti
parents: 1
diff changeset
   920
35086
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 34194
diff changeset
   921
  int resolved_method_index(CodeBuffer &cbuf) const {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 34194
diff changeset
   922
    if (_override_symbolic_info) {
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 34194
diff changeset
   923
      // Attach corresponding Method* to the call site, so VM can use it during resolution
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 34194
diff changeset
   924
      // instead of querying symbolic info from bytecode.
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 34194
diff changeset
   925
      assert(_method != NULL, "method should be set");
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 34194
diff changeset
   926
      assert(_method->constant_encoding()->is_method(), "should point to a Method");
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 34194
diff changeset
   927
      return cbuf.oop_recorder()->find_index(_method->constant_encoding());
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 34194
diff changeset
   928
    }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 34194
diff changeset
   929
    return 0; // Use symbolic info from bytecode (resolved_method == NULL).
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 34194
diff changeset
   930
  }
bbf32241d851 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 34194
diff changeset
   931
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   932
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   933
  virtual void dump_spec(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   934
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   935
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   936
489c9b5090e2 Initial load
duke
parents:
diff changeset
   937
//------------------------------MachCallStaticJavaNode------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   938
// Machine-specific versions of monomorphic subroutine calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
   939
class MachCallStaticJavaNode : public MachCallJavaNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   940
  virtual uint cmp( const Node &n ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   941
  virtual uint size_of() const; // Size is bigger
489c9b5090e2 Initial load
duke
parents:
diff changeset
   942
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   943
  const char *_name;            // Runtime wrapper name
489c9b5090e2 Initial load
duke
parents:
diff changeset
   944
  MachCallStaticJavaNode() : MachCallJavaNode() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   945
    init_class_id(Class_MachCallStaticJava);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   946
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   947
489c9b5090e2 Initial load
duke
parents:
diff changeset
   948
  // If this is an uncommon trap, return the request code, else zero.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   949
  int uncommon_trap_request() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   950
489c9b5090e2 Initial load
duke
parents:
diff changeset
   951
  virtual int ret_addr_offset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   952
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   953
  virtual void dump_spec(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   954
  void dump_trap_args(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   955
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   956
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   957
489c9b5090e2 Initial load
duke
parents:
diff changeset
   958
//------------------------------MachCallDynamicJavaNode------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   959
// Machine-specific versions of possibly megamorphic subroutine calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
   960
class MachCallDynamicJavaNode : public MachCallJavaNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   961
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   962
  int _vtable_index;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   963
  MachCallDynamicJavaNode() : MachCallJavaNode() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   964
    init_class_id(Class_MachCallDynamicJava);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   965
    DEBUG_ONLY(_vtable_index = -99);  // throw an assert if uninitialized
489c9b5090e2 Initial load
duke
parents:
diff changeset
   966
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   967
  virtual int ret_addr_offset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   968
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   969
  virtual void dump_spec(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   970
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   971
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   972
489c9b5090e2 Initial load
duke
parents:
diff changeset
   973
//------------------------------MachCallRuntimeNode----------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   974
// Machine-specific versions of subroutine calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
   975
class MachCallRuntimeNode : public MachCallNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   976
  virtual uint cmp( const Node &n ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   977
  virtual uint size_of() const; // Size is bigger
489c9b5090e2 Initial load
duke
parents:
diff changeset
   978
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   979
  const char *_name;            // Printable name, if _method is NULL
489c9b5090e2 Initial load
duke
parents:
diff changeset
   980
  MachCallRuntimeNode() : MachCallNode() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   981
    init_class_id(Class_MachCallRuntime);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   982
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   983
  virtual int ret_addr_offset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   984
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   985
  virtual void dump_spec(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   986
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   987
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   988
489c9b5090e2 Initial load
duke
parents:
diff changeset
   989
class MachCallLeafNode: public MachCallRuntimeNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   990
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   991
  MachCallLeafNode() : MachCallRuntimeNode() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   992
    init_class_id(Class_MachCallLeaf);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   993
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   994
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   995
489c9b5090e2 Initial load
duke
parents:
diff changeset
   996
//------------------------------MachHaltNode-----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   997
// Machine-specific versions of halt nodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   998
class MachHaltNode : public MachReturnNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   999
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1000
  virtual JVMState* jvms() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1001
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1002
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1003
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1004
//------------------------------MachTempNode-----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1005
// Node used by the adlc to construct inputs to represent temporary registers
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1006
class MachTempNode : public MachNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1007
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1008
  MachOper *_opnd_array[1];
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1009
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1010
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1011
  virtual const RegMask &out_RegMask() const { return *_opnds[0]->in_RegMask(0); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1012
  virtual uint rule() const { return 9999999; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1013
  virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1014
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1015
  MachTempNode(MachOper* oper) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1016
    init_class_id(Class_MachTemp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1017
    _num_opnds = 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1018
    _opnds = _opnd_array;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1019
    add_req(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1020
    _opnds[0] = oper;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1021
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1022
  virtual uint size_of() const { return sizeof(MachTempNode); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1023
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1024
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1025
  virtual void format(PhaseRegAlloc *, outputStream *st ) const {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1026
  virtual const char *Name() const { return "MachTemp";}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1027
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1028
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1029
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1030
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1031
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1032
//------------------------------labelOper--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1033
// Machine-independent version of label operand
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1034
class labelOper : public MachOper {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1035
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1036
  virtual uint           num_edges() const { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1037
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1038
  // Supported for fixed size branches
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1039
  Label* _label;                // Label for branch(es)
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1040
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1041
  uint _block_num;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1042
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1043
  labelOper() : _block_num(0), _label(0) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1044
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1045
  labelOper(Label* label, uint block_num) : _label(label), _block_num(block_num) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1046
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1047
  labelOper(labelOper* l) : _label(l->_label) , _block_num(l->_block_num) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1048
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25637
diff changeset
  1049
  virtual MachOper *clone() const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1050
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 7433
diff changeset
  1051
  virtual Label *label() const { assert(_label != NULL, "need Label"); return _label; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1052
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1053
  virtual uint           opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1054
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1055
  virtual uint           hash()   const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1056
  virtual uint           cmp( const MachOper &oper ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1057
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1058
  virtual const char    *Name()   const { return "Label";}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1059
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1060
  virtual void int_format(PhaseRegAlloc *ra, const MachNode *node, outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1061
  virtual void ext_format(PhaseRegAlloc *ra, const MachNode *node, int idx, outputStream *st) const { int_format( ra, node, st ); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1062
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1063
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1064
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1065
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1066
//------------------------------methodOper--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1067
// Machine-independent version of method operand
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1068
class methodOper : public MachOper {
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1069
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1070
  virtual uint           num_edges() const { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1071
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1072
  intptr_t _method;             // Address of method
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1073
  methodOper() :   _method(0) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1074
  methodOper(intptr_t method) : _method(method)  {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1075
25930
eae8b7490d2c 8054033: Remove unused references to Compile*
thartmann
parents: 25637
diff changeset
  1076
  virtual MachOper *clone() const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1077
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1078
  virtual intptr_t method() const { return _method; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1079
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1080
  virtual uint           opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1081
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1082
  virtual uint           hash()   const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1083
  virtual uint           cmp( const MachOper &oper ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1084
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1085
  virtual const char    *Name()   const { return "Method";}
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1086
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1087
  virtual void int_format(PhaseRegAlloc *ra, const MachNode *node, outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1088
  virtual void ext_format(PhaseRegAlloc *ra, const MachNode *node, int idx, outputStream *st) const { int_format( ra, node, st ); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1089
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
  1090
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
  1091
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
  1092
#endif // SHARE_VM_OPTO_MACHNODE_HPP