hotspot/src/share/vm/opto/machnode.hpp
author kvn
Tue, 16 Aug 2011 11:53:57 -0700
changeset 10266 2ea344c79e33
parent 10264 6879f93d268d
child 11196 a310a659c580
permissions -rw-r--r--
7079317: Incorrect branch's destination block in PrintoOptoAssembly output Summary: save/restore label and block in scratch_emit_size() Reviewed-by: never
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 4751
diff changeset
     2
 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 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
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
class BufferBlob;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
class CodeBuffer;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
class JVMState;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
class MachCallDynamicJavaNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
class MachCallJavaNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
class MachCallLeafNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
class MachCallNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
class MachCallRuntimeNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
class MachCallStaticJavaNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
class MachEpilogNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
class MachIfNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
class MachNullCheckNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
class MachOper;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
class MachProjNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
class MachPrologNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
class MachReturnNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
class MachSafePointNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
class MachSpillCopyNode;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
class Matcher;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
class PhaseRegAlloc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
class RegMask;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
class State;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
//---------------------------MachOper------------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
class MachOper : public ResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  // Allocate right next to the MachNodes in the same arena
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  void *operator new( size_t x, Compile* C ) { return C->node_arena()->Amalloc_D(x); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  // Opcode
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  virtual uint opcode() const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  // Number of input edges.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  // Generally at least 1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  virtual uint num_edges() const { return 1; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  // Array of Register masks
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  virtual const RegMask *in_RegMask(int index) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  // Methods to output the encoding of the operand
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  // Negate conditional branches.  Error for non-branch Nodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  virtual void negate();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  // Return the value requested
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  // result register lookup, corresponding to int_format
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  virtual int  reg(PhaseRegAlloc *ra_, const Node *node)   const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  // input register lookup, corresponding to ext_format
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  virtual int  reg(PhaseRegAlloc *ra_, const Node *node, int idx)   const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  // helpers for MacroAssembler generation from ADLC
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  Register  as_Register(PhaseRegAlloc *ra_, const Node *node)   const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
    return ::as_Register(reg(ra_, node));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  Register  as_Register(PhaseRegAlloc *ra_, const Node *node, int idx)   const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    return ::as_Register(reg(ra_, node, idx));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  FloatRegister  as_FloatRegister(PhaseRegAlloc *ra_, const Node *node)   const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
    return ::as_FloatRegister(reg(ra_, node));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  FloatRegister  as_FloatRegister(PhaseRegAlloc *ra_, const Node *node, int idx)   const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
    return ::as_FloatRegister(reg(ra_, node, idx));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
#if defined(IA32) || defined(AMD64)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  XMMRegister  as_XMMRegister(PhaseRegAlloc *ra_, const Node *node)   const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    return ::as_XMMRegister(reg(ra_, node));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  XMMRegister  as_XMMRegister(PhaseRegAlloc *ra_, const Node *node, int idx)   const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
    return ::as_XMMRegister(reg(ra_, node, idx));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  virtual intptr_t  constant() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  virtual bool constant_is_oop() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  virtual jdouble constantD() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  virtual jfloat  constantF() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  virtual jlong   constantL() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  virtual TypeOopPtr *oop() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  virtual int  ccode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  // A zero, default, indicates this value is not needed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  // May need to lookup the base register, as done in int_ and ext_format
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  virtual int  base (PhaseRegAlloc *ra_, const Node *node, int idx) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  virtual int  index(PhaseRegAlloc *ra_, const Node *node, int idx) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
  virtual int  scale() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  // Parameters needed to support MEMORY_INTERFACE access to stackSlot
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  virtual int  disp (PhaseRegAlloc *ra_, const Node *node, int idx) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  // Check for PC-Relative displacement
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  virtual bool disp_is_oop() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  virtual int  constant_disp() const;   // usu. 0, may return Type::OffsetBot
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  virtual int  base_position()  const;  // base edge position, or -1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  virtual int  index_position() const;  // index edge position, or -1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  // Access the TypeKlassPtr of operands with a base==RegI and disp==RegP
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  // Only returns non-null value for i486.ad's indOffset32X
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  virtual const TypePtr *disp_as_type() const { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  // Return the label
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  virtual Label *label() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  // Return the method's address
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
  virtual intptr_t  method() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  // Hash and compare over operands are currently identical
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  virtual uint  hash() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  virtual uint  cmp( const MachOper &oper ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  // Virtual clone, since I do not know how big the MachOper is.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  virtual MachOper *clone(Compile* C) const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  // Return ideal Type from simple operands.  Fail for complex operands.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  virtual const Type *type() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  // Set an integer offset if we have one, or error otherwise
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  virtual void set_con( jint c0 ) { ShouldNotReachHere();  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  // Return name of operand
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  virtual const char    *Name() const { return "???";}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  // Methods to output the text version of the operand
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  virtual void int_format(PhaseRegAlloc *,const MachNode *node, outputStream *st) const = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  virtual void ext_format(PhaseRegAlloc *,const MachNode *node,int idx, outputStream *st) const=0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  virtual void dump_spec(outputStream *st) const; // Print per-operand info
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
//------------------------------MachNode---------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
// Base type for all machine specific nodes.  All node classes generated by the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
// ADLC inherit from this class.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
class MachNode : public Node {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  MachNode() : Node((uint)0), _num_opnds(0), _opnds(NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
    init_class_id(Class_Mach);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  // Required boilerplate
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  virtual uint size_of() const { return sizeof(MachNode); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  virtual int  Opcode() const;          // Always equal to MachNode
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  virtual uint rule() const = 0;        // Machine-specific opcode
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  // Number of inputs which come before the first operand.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  // Generally at least 1, to skip the Control input
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  virtual uint oper_input_base() const { return 1; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  // Copy inputs and operands to new node of instruction.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  // Called from cisc_version() and short_branch_version().
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  // !!!! The method's body is defined in ad_<arch>.cpp file.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  void fill_new_machnode(MachNode *n, Compile* C) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  // Return an equivalent instruction using memory for cisc_operand position
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  virtual MachNode *cisc_version(int offset, Compile* C);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  // Modify this instruction's register mask to use stack version for cisc_operand
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  virtual void use_cisc_RegMask();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  // Support for short branches
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  bool may_be_short_branch() const { return (flags() & Flag_may_be_short_branch) != 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
10264
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10255
diff changeset
   190
  // Avoid back to back some instructions on some CPUs.
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10255
diff changeset
   191
  bool avoid_back_to_back() const { return (flags() & Flag_avoid_back_to_back) != 0; }
6879f93d268d 7063629: use cbcond in C2 generated code on T4
kvn
parents: 10255
diff changeset
   192
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  // First index in _in[] corresponding to operand, or -1 if there is none
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  int  operand_index(uint operand) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  // Register class input is expected in
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  virtual const RegMask &in_RegMask(uint) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  // cisc-spillable instructions redefine for use by in_RegMask
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  virtual const RegMask *cisc_RegMask() const { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  // If this instruction is a 2-address instruction, then return the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
  // index of the input which must match the output.  Not nessecary
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  // for instructions which bind the input and output register to the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  // same singleton regiser (e.g., Intel IDIV which binds AX to be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  // both an input and an output).  It is nessecary when the input and
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
  // output have choices - but they must use the same choice.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  virtual uint two_adr( ) const { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  // Array of complex operand pointers.  Each corresponds to zero or
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  // more leafs.  Must be set by MachNode constructor to point to an
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  // internal array of MachOpers.  The MachOper array is sized by
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  // specific MachNodes described in the ADL.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  uint _num_opnds;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  MachOper **_opnds;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  uint  num_opnds() const { return _num_opnds; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  // Emit bytes into cbuf
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  virtual void  emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  // Size of instruction in bytes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  virtual uint  size(PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
  // Helper function that computes size by emitting code
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  virtual uint  emit_size(PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  // Return the alignment required (in units of relocInfo::addr_unit())
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  // for this instruction (must be a power of 2)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
  virtual int   alignment_required() const { return 1; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  // Return the padding (in bytes) to be emitted before this
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  // instruction to properly align it.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  virtual int   compute_padding(int current_offset) const { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  // Return number of relocatable values contained in this instruction
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  virtual int   reloc() const { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  // Hash and compare over operands.  Used to do GVN on machine Nodes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  virtual uint  hash() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  virtual uint  cmp( const Node &n ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  // Expand method for MachNode, replaces nodes representing pseudo
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  // instructions with a set of nodes which represent real machine
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  // instructions and compute the same value.
4751
9418f690831d 6916644: C2 compiler crash on x86
never
parents: 4566
diff changeset
   243
  virtual MachNode *Expand( State *, Node_List &proj_list, Node* mem ) { return this; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  // Bottom_type call; value comes from operand0
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  virtual const class Type *bottom_type() const { return _opnds[0]->type(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
  virtual uint ideal_reg() const { const Type *t = _opnds[0]->type(); return t == TypeInt::CC ? Op_RegFlags : Matcher::base2reg[t->base()]; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  // If this is a memory op, return the base pointer and fixed offset.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  // If there are no such, return NULL.  If there are multiple addresses
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
  // or the address is indeterminate (rare cases) then return (Node*)-1,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  // which serves as node bottom.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  // If the offset is not statically determined, set it to Type::OffsetBot.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  // This method is free to ignore stack slots if that helps.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  #define TYPE_PTR_SENTINAL  ((const TypePtr*)-1)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  // Passing TYPE_PTR_SENTINAL as adr_type asks for computation of the adr_type if possible
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  const Node* get_base_and_disp(intptr_t &offset, const TypePtr* &adr_type) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  // Helper for get_base_and_disp: find the base and index input nodes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
  // Returns the MachOper as determined by memory_operand(), for use, if
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  // needed by the caller. If (MachOper *)-1 is returned, base and index
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
  // are set to NodeSentinel. If (MachOper *) NULL is returned, base and
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  // index are set to NULL.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  const MachOper* memory_inputs(Node* &base, Node* &index) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  // Helper for memory_inputs:  Which operand carries the necessary info?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  // By default, returns NULL, which means there is no such operand.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
  // If it returns (MachOper*)-1, this means there are multiple memories.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
  virtual const MachOper* memory_operand() const { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  // Call "get_base_and_disp" to decide which category of memory is used here.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
  virtual const class TypePtr *adr_type() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  // Apply peephole rule(s) to this instruction
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
  virtual MachNode *peephole( Block *block, int block_index, PhaseRegAlloc *ra_, int &deleted, Compile* C );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
  // Top-level ideal Opcode matched
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  virtual int ideal_Opcode()     const { return Op_Node; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
  // Adds the label for the case
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
  virtual void add_case_label( int switch_val, Label* blockLabel);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
  // Set the absolute address for methods
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
  virtual void method_set( intptr_t addr );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
  // Should we clone rather than spill this instruction?
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  bool rematerialize() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
  // Get the pipeline info
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  static const Pipeline *pipeline_class();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  virtual const Pipeline *pipeline() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
  virtual const char *Name() const = 0; // Machine-specific name
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
  virtual void dump_spec(outputStream *st) const; // Print per-node info
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
  void         dump_format(PhaseRegAlloc *ra, outputStream *st) const; // access to virtual
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
//------------------------------MachIdealNode----------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
// Machine specific versions of nodes that must be defined by user.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
// These are not converted by matcher from ideal nodes to machine nodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
// but are inserted into the code by the compiler.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
class MachIdealNode : public MachNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
  MachIdealNode( ) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
  // Define the following defaults for non-matched machine nodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
  virtual uint oper_input_base() const { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
  virtual uint rule()            const { return 9999999; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
  virtual const class Type *bottom_type() const { return _opnds == NULL ? Type::CONTROL : MachNode::bottom_type(); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
//------------------------------MachTypeNode----------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
// Machine Nodes that need to retain a known Type.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
class MachTypeNode : public MachNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
  virtual uint size_of() const { return sizeof(*this); } // Size is bigger
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
  const Type *_bottom_type;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
  virtual const class Type *bottom_type() const { return _bottom_type; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
  virtual void dump_spec(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
//------------------------------MachBreakpointNode----------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
// Machine breakpoint or interrupt Node
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
class MachBreakpointNode : public MachIdealNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
  MachBreakpointNode( ) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
  virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
  virtual uint size(PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
  virtual const char *Name() const { return "Breakpoint"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
  virtual void format( PhaseRegAlloc *, outputStream *st ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
7433
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   341
//------------------------------MachConstantBaseNode--------------------------
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   342
// 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
   343
class MachConstantBaseNode : public MachIdealNode {
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   344
public:
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   345
  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
   346
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   347
public:
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   348
  MachConstantBaseNode() : MachIdealNode() {
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   349
    init_class_id(Class_MachConstantBase);
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   350
  }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   351
  virtual const class Type* bottom_type() const { return TypeRawPtr::NOTNULL; }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   352
  virtual uint ideal_reg() const { return Op_RegP; }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   353
  virtual uint oper_input_base() const { return 1; }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   354
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   355
  virtual void emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const;
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   356
  virtual uint size(PhaseRegAlloc* ra_) const;
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   357
  virtual bool pinned() const { return UseRDPCForConstantTableBase; }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   358
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   359
  static const RegMask& static_out_RegMask() { return _out_RegMask; }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   360
  virtual const RegMask& out_RegMask() const { return static_out_RegMask(); }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   361
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   362
#ifndef PRODUCT
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   363
  virtual const char* Name() const { return "MachConstantBaseNode"; }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   364
  virtual void format(PhaseRegAlloc*, outputStream* st) const;
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   365
#endif
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   366
};
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   367
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   368
//------------------------------MachConstantNode-------------------------------
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   369
// Machine node that holds a constant which is stored in the constant table.
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   370
class MachConstantNode : public MachNode {
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   371
protected:
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   372
  Compile::Constant _constant;  // This node's constant.
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   373
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   374
public:
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   375
  MachConstantNode() : MachNode() {
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   376
    init_class_id(Class_MachConstant);
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   377
  }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   378
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   379
  virtual void eval_constant(Compile* C) {
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   380
#ifdef ASSERT
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   381
    tty->print("missing MachConstantNode eval_constant function: ");
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   382
    dump();
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   383
#endif
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   384
    ShouldNotCallThis();
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   385
  }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   386
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   387
  virtual const RegMask &in_RegMask(uint idx) const {
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   388
    if (idx == mach_constant_base_node_input())
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   389
      return MachConstantBaseNode::static_out_RegMask();
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   390
    return MachNode::in_RegMask(idx);
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   391
  }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   392
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   393
  // Input edge of MachConstantBaseNode.
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   394
  uint mach_constant_base_node_input() const { return req() - 1; }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   395
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   396
  int  constant_offset();
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   397
  int  constant_offset() const { return ((MachConstantNode*) this)->constant_offset(); }
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   398
};
b418028612ad 6961690: load oops from constant table on SPARC
twisti
parents: 7397
diff changeset
   399
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
//------------------------------MachUEPNode-----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
// Machine Unvalidated Entry Point Node
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
class MachUEPNode : public MachIdealNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
  MachUEPNode( ) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
  virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
  virtual uint size(PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
  virtual const char *Name() const { return "Unvalidated-Entry-Point"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
  virtual void format( PhaseRegAlloc *, outputStream *st ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
//------------------------------MachPrologNode--------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
// Machine function Prolog Node
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
class MachPrologNode : public MachIdealNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
  MachPrologNode( ) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
  virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
  virtual uint size(PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
  virtual int reloc() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
  virtual const char *Name() const { return "Prolog"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
  virtual void format( PhaseRegAlloc *, outputStream *st ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
//------------------------------MachEpilogNode--------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
// Machine function Epilog Node
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
class MachEpilogNode : public MachIdealNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
  MachEpilogNode(bool do_poll = false) : _do_polling(do_poll) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
  virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
  virtual uint size(PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
  virtual int reloc() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
  virtual const Pipeline *pipeline() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
  bool _do_polling;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
  bool do_polling() const { return _do_polling; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
  // Offset of safepoint from the beginning of the node
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
  int safepoint_offset() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
  virtual const char *Name() const { return "Epilog"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
  virtual void format( PhaseRegAlloc *, outputStream *st ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
//------------------------------MachNopNode-----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
// Machine function Nop Node
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
class MachNopNode : public MachIdealNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
  int _count;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
  MachNopNode( ) : _count(1) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
  MachNopNode( int count ) : _count(count) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
  virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
  virtual uint size(PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
  virtual const class Type *bottom_type() const { return Type::CONTROL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
  virtual int ideal_Opcode() const { return Op_Con; } // bogus; see output.cpp
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
  virtual const Pipeline *pipeline() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
  virtual const char *Name() const { return "Nop"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
  virtual void format( PhaseRegAlloc *, outputStream *st ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
  virtual void dump_spec(outputStream *st) const { } // No per-operand info
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
//------------------------------MachSpillCopyNode------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
// Machine SpillCopy Node.  Copies 1 or 2 words from any location to any
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
// location (stack or register).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
class MachSpillCopyNode : public MachIdealNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
  const RegMask *_in;           // RegMask for input
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
  const RegMask *_out;          // RegMask for output
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
  const Type *_type;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
  MachSpillCopyNode( Node *n, const RegMask &in, const RegMask &out ) :
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
    MachIdealNode(), _in(&in), _out(&out), _type(n->bottom_type()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
    init_class_id(Class_MachSpillCopy);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
    init_flags(Flag_is_Copy);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
    add_req(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
    add_req(n);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
  virtual uint size_of() const { return sizeof(*this); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
  void set_out_RegMask(const RegMask &out) { _out = &out; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
  void set_in_RegMask(const RegMask &in) { _in = &in; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
  virtual const RegMask &out_RegMask() const { return *_out; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
  virtual const RegMask &in_RegMask(uint) const { return *_in; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
  virtual const class Type *bottom_type() const { return _type; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
  virtual uint ideal_reg() const { return Matcher::base2reg[_type->base()]; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
  virtual uint oper_input_base() const { return 1; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
  uint implementation( CodeBuffer *cbuf, PhaseRegAlloc *ra_, bool do_size, outputStream* st ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
  virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
  virtual uint size(PhaseRegAlloc *ra_) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
  virtual const char *Name() const { return "MachSpillCopy"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
  virtual void format( PhaseRegAlloc *, outputStream *st ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   510
//------------------------------MachBranchNode--------------------------------
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   511
// Abstract machine branch Node
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   512
class MachBranchNode : public MachIdealNode {
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   513
public:
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   514
  MachBranchNode() : MachIdealNode() {
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   515
    init_class_id(Class_MachBranch);
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   516
  }
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   517
  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
   518
  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
   519
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   520
  // Support for short branches
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   521
  virtual MachNode *short_branch_version(Compile* C) { return NULL; }
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   522
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   523
  virtual bool pinned() const { return true; };
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   524
};
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   525
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   526
//------------------------------MachNullChkNode--------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   527
// Machine-dependent null-pointer-check Node.  Points a real MachNode that is
489c9b5090e2 Initial load
duke
parents:
diff changeset
   528
// also some kind of memory op.  Turns the indicated MachNode into a
489c9b5090e2 Initial load
duke
parents:
diff changeset
   529
// conditional branch with good latency on the ptr-not-null path and awful
489c9b5090e2 Initial load
duke
parents:
diff changeset
   530
// latency on the pointer-is-null path.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   531
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   532
class MachNullCheckNode : public MachBranchNode {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   533
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   534
  const uint _vidx;             // Index of memop being tested
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   535
  MachNullCheckNode( Node *ctrl, Node *memop, uint vidx ) : MachBranchNode(), _vidx(vidx) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   536
    init_class_id(Class_MachNullCheck);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   537
    add_req(ctrl);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   538
    add_req(memop);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   539
  }
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   540
  virtual uint size_of() const { return sizeof(*this); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   541
489c9b5090e2 Initial load
duke
parents:
diff changeset
   542
  virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 7433
diff changeset
   543
  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
   544
  virtual void save_label(Label** label, uint* block_num);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   545
  virtual void negate() { }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   546
  virtual const class Type *bottom_type() const { return TypeTuple::IFBOTH; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   547
  virtual uint ideal_reg() const { return NotAMachineReg; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   548
  virtual const RegMask &in_RegMask(uint) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   549
  virtual const RegMask &out_RegMask() const { return RegMask::Empty; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   550
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   551
  virtual const char *Name() const { return "NullCheck"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   552
  virtual void format( PhaseRegAlloc *, outputStream *st ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   553
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   554
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   555
489c9b5090e2 Initial load
duke
parents:
diff changeset
   556
//------------------------------MachProjNode----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   557
// Machine-dependent Ideal projections (how is that for an oxymoron).  Really
489c9b5090e2 Initial load
duke
parents:
diff changeset
   558
// just MachNodes made by the Ideal world that replicate simple projections
489c9b5090e2 Initial load
duke
parents:
diff changeset
   559
// but with machine-dependent input & output register masks.  Generally
489c9b5090e2 Initial load
duke
parents:
diff changeset
   560
// produced as part of calling conventions.  Normally I make MachNodes as part
489c9b5090e2 Initial load
duke
parents:
diff changeset
   561
// of the Matcher process, but the Matcher is ill suited to issues involving
489c9b5090e2 Initial load
duke
parents:
diff changeset
   562
// frame handling, so frame handling is all done in the Ideal world with
489c9b5090e2 Initial load
duke
parents:
diff changeset
   563
// occasional callbacks to the machine model for important info.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   564
class MachProjNode : public ProjNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   565
public:
10255
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   566
  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
   567
    init_class_id(Class_MachProj);
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   568
  }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   569
  RegMask _rout;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   570
  const uint  _ideal_reg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   571
  enum projType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   572
    unmatched_proj = 0,         // Projs for Control, I/O, memory not matched
489c9b5090e2 Initial load
duke
parents:
diff changeset
   573
    fat_proj       = 999        // Projs killing many regs, defined by _rout
489c9b5090e2 Initial load
duke
parents:
diff changeset
   574
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   575
  virtual int   Opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   576
  virtual const Type *bottom_type() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   577
  virtual const TypePtr *adr_type() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   578
  virtual const RegMask &in_RegMask(uint) const { return RegMask::Empty; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   579
  virtual const RegMask &out_RegMask() const { return _rout; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   580
  virtual uint  ideal_reg() const { return _ideal_reg; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   581
  // Need size_of() for virtual ProjNode::clone()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   582
  virtual uint  size_of() const { return sizeof(MachProjNode); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   583
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   584
  virtual void dump_spec(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   585
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   586
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   587
489c9b5090e2 Initial load
duke
parents:
diff changeset
   588
//------------------------------MachIfNode-------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   589
// Machine-specific versions of IfNodes
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   590
class MachIfNode : public MachBranchNode {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   591
  virtual uint size_of() const { return sizeof(*this); } // Size is bigger
489c9b5090e2 Initial load
duke
parents:
diff changeset
   592
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   593
  float _prob;                  // Probability branch goes either way
489c9b5090e2 Initial load
duke
parents:
diff changeset
   594
  float _fcnt;                  // Frequency counter
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   595
  MachIfNode() : MachBranchNode() {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   596
    init_class_id(Class_MachIf);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   597
  }
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   598
  // Negate conditional branches.
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   599
  virtual void negate() = 0;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   600
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   601
  virtual void dump_spec(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   602
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   603
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   604
10255
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   605
//------------------------------MachGotoNode-----------------------------------
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   606
// Machine-specific versions of GotoNodes
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   607
class MachGotoNode : public MachBranchNode {
10255
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   608
public:
10266
2ea344c79e33 7079317: Incorrect branch's destination block in PrintoOptoAssembly output
kvn
parents: 10264
diff changeset
   609
  MachGotoNode() : MachBranchNode() {
10255
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   610
    init_class_id(Class_MachGoto);
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   611
  }
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   612
};
bab46e6f7661 7069452: Cleanup NodeFlags
kvn
parents: 10252
diff changeset
   613
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   614
//------------------------------MachFastLockNode-------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   615
// Machine-specific versions of FastLockNodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   616
class MachFastLockNode : public MachNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   617
  virtual uint size_of() const { return sizeof(*this); } // Size is bigger
489c9b5090e2 Initial load
duke
parents:
diff changeset
   618
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   619
  BiasedLockingCounters* _counters;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   620
489c9b5090e2 Initial load
duke
parents:
diff changeset
   621
  MachFastLockNode() : MachNode() {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   622
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   623
489c9b5090e2 Initial load
duke
parents:
diff changeset
   624
//------------------------------MachReturnNode--------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   625
// Machine-specific versions of subroutine returns
489c9b5090e2 Initial load
duke
parents:
diff changeset
   626
class MachReturnNode : public MachNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   627
  virtual uint size_of() const; // Size is bigger
489c9b5090e2 Initial load
duke
parents:
diff changeset
   628
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   629
  RegMask *_in_rms;             // Input register masks, set during allocation
489c9b5090e2 Initial load
duke
parents:
diff changeset
   630
  ReallocMark _nesting;         // assertion check for reallocations
489c9b5090e2 Initial load
duke
parents:
diff changeset
   631
  const TypePtr* _adr_type;     // memory effects of call or return
489c9b5090e2 Initial load
duke
parents:
diff changeset
   632
  MachReturnNode() : MachNode() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   633
    init_class_id(Class_MachReturn);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   634
    _adr_type = TypePtr::BOTTOM; // the default: all of memory
489c9b5090e2 Initial load
duke
parents:
diff changeset
   635
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   636
489c9b5090e2 Initial load
duke
parents:
diff changeset
   637
  void set_adr_type(const TypePtr* atp) { _adr_type = atp; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   638
489c9b5090e2 Initial load
duke
parents:
diff changeset
   639
  virtual const RegMask &in_RegMask(uint) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   640
  virtual bool pinned() const { return true; };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   641
  virtual const TypePtr *adr_type() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   642
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   643
489c9b5090e2 Initial load
duke
parents:
diff changeset
   644
//------------------------------MachSafePointNode-----------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   645
// Machine-specific versions of safepoints
489c9b5090e2 Initial load
duke
parents:
diff changeset
   646
class MachSafePointNode : public MachReturnNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   647
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   648
  OopMap*         _oop_map;     // Array of OopMap info (8-bit char) for GC
489c9b5090e2 Initial load
duke
parents:
diff changeset
   649
  JVMState*       _jvms;        // Pointer to list of JVM State Objects
489c9b5090e2 Initial load
duke
parents:
diff changeset
   650
  uint            _jvmadj;      // Extra delta to jvms indexes (mach. args)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   651
  OopMap*         oop_map() const { return _oop_map; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   652
  void            set_oop_map(OopMap* om) { _oop_map = om; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   653
489c9b5090e2 Initial load
duke
parents:
diff changeset
   654
  MachSafePointNode() : MachReturnNode(), _oop_map(NULL), _jvms(NULL), _jvmadj(0) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   655
    init_class_id(Class_MachSafePoint);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   656
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   657
489c9b5090e2 Initial load
duke
parents:
diff changeset
   658
  virtual JVMState* jvms() const { return _jvms; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   659
  void set_jvms(JVMState* s) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   660
    _jvms = s;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   661
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   662
  virtual const Type    *bottom_type() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   663
489c9b5090e2 Initial load
duke
parents:
diff changeset
   664
  virtual const RegMask &in_RegMask(uint) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   665
489c9b5090e2 Initial load
duke
parents:
diff changeset
   666
  // Functionality from old debug nodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   667
  Node *returnadr() const { return in(TypeFunc::ReturnAdr); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   668
  Node *frameptr () const { return in(TypeFunc::FramePtr); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   669
489c9b5090e2 Initial load
duke
parents:
diff changeset
   670
  Node *local(const JVMState* jvms, uint idx) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   671
    assert(verify_jvms(jvms), "jvms must match");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   672
    return in(_jvmadj + jvms->locoff() + idx);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   673
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   674
  Node *stack(const JVMState* jvms, uint idx) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   675
    assert(verify_jvms(jvms), "jvms must match");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   676
    return in(_jvmadj + jvms->stkoff() + idx);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   677
 }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   678
  Node *monitor_obj(const JVMState* jvms, uint idx) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   679
    assert(verify_jvms(jvms), "jvms must match");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   680
    return in(_jvmadj + jvms->monitor_obj_offset(idx));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   681
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   682
  Node *monitor_box(const JVMState* jvms, uint idx) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   683
    assert(verify_jvms(jvms), "jvms must match");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   684
    return in(_jvmadj + jvms->monitor_box_offset(idx));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   685
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   686
  void  set_local(const JVMState* jvms, uint idx, Node *c) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   687
    assert(verify_jvms(jvms), "jvms must match");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   688
    set_req(_jvmadj + jvms->locoff() + idx, c);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   689
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   690
  void  set_stack(const JVMState* jvms, uint idx, Node *c) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   691
    assert(verify_jvms(jvms), "jvms must match");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   692
    set_req(_jvmadj + jvms->stkoff() + idx, c);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   693
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   694
  void  set_monitor(const JVMState* jvms, uint idx, Node *c) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   695
    assert(verify_jvms(jvms), "jvms must match");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   696
    set_req(_jvmadj + jvms->monoff() + idx, c);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   697
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   698
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   699
489c9b5090e2 Initial load
duke
parents:
diff changeset
   700
//------------------------------MachCallNode----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   701
// Machine-specific versions of subroutine calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
   702
class MachCallNode : public MachSafePointNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   703
protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   704
  virtual uint hash() const { return NO_HASH; }  // CFG nodes do not hash
489c9b5090e2 Initial load
duke
parents:
diff changeset
   705
  virtual uint cmp( const Node &n ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   706
  virtual uint size_of() const = 0; // Size is bigger
489c9b5090e2 Initial load
duke
parents:
diff changeset
   707
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   708
  const TypeFunc *_tf;        // Function type
489c9b5090e2 Initial load
duke
parents:
diff changeset
   709
  address      _entry_point;  // Address of the method being called
489c9b5090e2 Initial load
duke
parents:
diff changeset
   710
  float        _cnt;          // Estimate of number of times called
489c9b5090e2 Initial load
duke
parents:
diff changeset
   711
  uint         _argsize;      // Size of argument block on stack
489c9b5090e2 Initial load
duke
parents:
diff changeset
   712
489c9b5090e2 Initial load
duke
parents:
diff changeset
   713
  const TypeFunc* tf()        const { return _tf; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   714
  const address entry_point() const { return _entry_point; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   715
  const float   cnt()         const { return _cnt; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   716
  uint argsize()              const { return _argsize; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   717
489c9b5090e2 Initial load
duke
parents:
diff changeset
   718
  void set_tf(const TypeFunc* tf) { _tf = tf; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   719
  void set_entry_point(address p) { _entry_point = p; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   720
  void set_cnt(float c)           { _cnt = c; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   721
  void set_argsize(int s)         { _argsize = s; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   722
489c9b5090e2 Initial load
duke
parents:
diff changeset
   723
  MachCallNode() : MachSafePointNode() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   724
    init_class_id(Class_MachCall);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   725
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   726
489c9b5090e2 Initial load
duke
parents:
diff changeset
   727
  virtual const Type *bottom_type() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   728
  virtual bool  pinned() const { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   729
  virtual const Type *Value( PhaseTransform *phase ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   730
  virtual const RegMask &in_RegMask(uint) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   731
  virtual int ret_addr_offset() { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   732
489c9b5090e2 Initial load
duke
parents:
diff changeset
   733
  bool returns_long() const { return tf()->return_type() == T_LONG; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   734
  bool return_value_is_used() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   735
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   736
  virtual void dump_spec(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   737
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   738
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   739
489c9b5090e2 Initial load
duke
parents:
diff changeset
   740
//------------------------------MachCallJavaNode------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   741
// "Base" class for machine-specific versions of subroutine calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
   742
class MachCallJavaNode : public MachCallNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   743
protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   744
  virtual uint cmp( const Node &n ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   745
  virtual uint size_of() const; // Size is bigger
489c9b5090e2 Initial load
duke
parents:
diff changeset
   746
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   747
  ciMethod* _method;             // Method being direct called
489c9b5090e2 Initial load
duke
parents:
diff changeset
   748
  int        _bci;               // Byte Code index of call byte code
489c9b5090e2 Initial load
duke
parents:
diff changeset
   749
  bool       _optimized_virtual; // Tells if node is a static call or an optimized virtual
4566
b363f6ef4068 6829187: compiler optimizations required for JSR 292
twisti
parents: 1
diff changeset
   750
  bool       _method_handle_invoke;   // Tells if the call has to preserve SP
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   751
  MachCallJavaNode() : MachCallNode() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   752
    init_class_id(Class_MachCallJava);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   753
  }
4566
b363f6ef4068 6829187: compiler optimizations required for JSR 292
twisti
parents: 1
diff changeset
   754
b363f6ef4068 6829187: compiler optimizations required for JSR 292
twisti
parents: 1
diff changeset
   755
  virtual const RegMask &in_RegMask(uint) const;
b363f6ef4068 6829187: compiler optimizations required for JSR 292
twisti
parents: 1
diff changeset
   756
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   757
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   758
  virtual void dump_spec(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   759
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   760
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   761
489c9b5090e2 Initial load
duke
parents:
diff changeset
   762
//------------------------------MachCallStaticJavaNode------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   763
// Machine-specific versions of monomorphic subroutine calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
   764
class MachCallStaticJavaNode : public MachCallJavaNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   765
  virtual uint cmp( const Node &n ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   766
  virtual uint size_of() const; // Size is bigger
489c9b5090e2 Initial load
duke
parents:
diff changeset
   767
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   768
  const char *_name;            // Runtime wrapper name
489c9b5090e2 Initial load
duke
parents:
diff changeset
   769
  MachCallStaticJavaNode() : MachCallJavaNode() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   770
    init_class_id(Class_MachCallStaticJava);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   771
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   772
489c9b5090e2 Initial load
duke
parents:
diff changeset
   773
  // If this is an uncommon trap, return the request code, else zero.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   774
  int uncommon_trap_request() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   775
489c9b5090e2 Initial load
duke
parents:
diff changeset
   776
  virtual int ret_addr_offset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   777
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   778
  virtual void dump_spec(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   779
  void dump_trap_args(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   780
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   781
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   782
489c9b5090e2 Initial load
duke
parents:
diff changeset
   783
//------------------------------MachCallDynamicJavaNode------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   784
// Machine-specific versions of possibly megamorphic subroutine calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
   785
class MachCallDynamicJavaNode : public MachCallJavaNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   786
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   787
  int _vtable_index;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   788
  MachCallDynamicJavaNode() : MachCallJavaNode() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   789
    init_class_id(Class_MachCallDynamicJava);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   790
    DEBUG_ONLY(_vtable_index = -99);  // throw an assert if uninitialized
489c9b5090e2 Initial load
duke
parents:
diff changeset
   791
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   792
  virtual int ret_addr_offset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   793
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   794
  virtual void dump_spec(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   795
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   796
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   797
489c9b5090e2 Initial load
duke
parents:
diff changeset
   798
//------------------------------MachCallRuntimeNode----------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   799
// Machine-specific versions of subroutine calls
489c9b5090e2 Initial load
duke
parents:
diff changeset
   800
class MachCallRuntimeNode : public MachCallNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   801
  virtual uint cmp( const Node &n ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   802
  virtual uint size_of() const; // Size is bigger
489c9b5090e2 Initial load
duke
parents:
diff changeset
   803
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   804
  const char *_name;            // Printable name, if _method is NULL
489c9b5090e2 Initial load
duke
parents:
diff changeset
   805
  MachCallRuntimeNode() : MachCallNode() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   806
    init_class_id(Class_MachCallRuntime);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   807
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   808
  virtual int ret_addr_offset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   809
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   810
  virtual void dump_spec(outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   811
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   812
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   813
489c9b5090e2 Initial load
duke
parents:
diff changeset
   814
class MachCallLeafNode: public MachCallRuntimeNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   815
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   816
  MachCallLeafNode() : MachCallRuntimeNode() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   817
    init_class_id(Class_MachCallLeaf);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   818
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   819
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   820
489c9b5090e2 Initial load
duke
parents:
diff changeset
   821
//------------------------------MachHaltNode-----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   822
// Machine-specific versions of halt nodes
489c9b5090e2 Initial load
duke
parents:
diff changeset
   823
class MachHaltNode : public MachReturnNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   824
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   825
  virtual JVMState* jvms() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   826
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   827
489c9b5090e2 Initial load
duke
parents:
diff changeset
   828
489c9b5090e2 Initial load
duke
parents:
diff changeset
   829
//------------------------------MachTempNode-----------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   830
// Node used by the adlc to construct inputs to represent temporary registers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   831
class MachTempNode : public MachNode {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   832
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   833
  MachOper *_opnd_array[1];
489c9b5090e2 Initial load
duke
parents:
diff changeset
   834
489c9b5090e2 Initial load
duke
parents:
diff changeset
   835
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   836
  virtual const RegMask &out_RegMask() const { return *_opnds[0]->in_RegMask(0); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   837
  virtual uint rule() const { return 9999999; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   838
  virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   839
489c9b5090e2 Initial load
duke
parents:
diff changeset
   840
  MachTempNode(MachOper* oper) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   841
    init_class_id(Class_MachTemp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   842
    _num_opnds = 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   843
    _opnds = _opnd_array;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   844
    add_req(NULL);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   845
    _opnds[0] = oper;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   846
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   847
  virtual uint size_of() const { return sizeof(MachTempNode); }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   848
489c9b5090e2 Initial load
duke
parents:
diff changeset
   849
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   850
  virtual void format(PhaseRegAlloc *, outputStream *st ) const {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   851
  virtual const char *Name() const { return "MachTemp";}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   852
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   853
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   854
489c9b5090e2 Initial load
duke
parents:
diff changeset
   855
489c9b5090e2 Initial load
duke
parents:
diff changeset
   856
489c9b5090e2 Initial load
duke
parents:
diff changeset
   857
//------------------------------labelOper--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   858
// Machine-independent version of label operand
489c9b5090e2 Initial load
duke
parents:
diff changeset
   859
class labelOper : public MachOper {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   860
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   861
  virtual uint           num_edges() const { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   862
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   863
  // Supported for fixed size branches
489c9b5090e2 Initial load
duke
parents:
diff changeset
   864
  Label* _label;                // Label for branch(es)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   865
489c9b5090e2 Initial load
duke
parents:
diff changeset
   866
  uint _block_num;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   867
489c9b5090e2 Initial load
duke
parents:
diff changeset
   868
  labelOper() : _block_num(0), _label(0) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   869
489c9b5090e2 Initial load
duke
parents:
diff changeset
   870
  labelOper(Label* label, uint block_num) : _label(label), _block_num(block_num) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   871
489c9b5090e2 Initial load
duke
parents:
diff changeset
   872
  labelOper(labelOper* l) : _label(l->_label) , _block_num(l->_block_num) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   873
489c9b5090e2 Initial load
duke
parents:
diff changeset
   874
  virtual MachOper *clone(Compile* C) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   875
10252
0981ce1c3eef 7063628: Use cbcond on T4
kvn
parents: 7433
diff changeset
   876
  virtual Label *label() const { assert(_label != NULL, "need Label"); return _label; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   877
489c9b5090e2 Initial load
duke
parents:
diff changeset
   878
  virtual uint           opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   879
489c9b5090e2 Initial load
duke
parents:
diff changeset
   880
  virtual uint           hash()   const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   881
  virtual uint           cmp( const MachOper &oper ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   882
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   883
  virtual const char    *Name()   const { return "Label";}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   884
489c9b5090e2 Initial load
duke
parents:
diff changeset
   885
  virtual void int_format(PhaseRegAlloc *ra, const MachNode *node, outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   886
  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
   887
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   888
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   889
489c9b5090e2 Initial load
duke
parents:
diff changeset
   890
489c9b5090e2 Initial load
duke
parents:
diff changeset
   891
//------------------------------methodOper--------------------------------------
489c9b5090e2 Initial load
duke
parents:
diff changeset
   892
// Machine-independent version of method operand
489c9b5090e2 Initial load
duke
parents:
diff changeset
   893
class methodOper : public MachOper {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   894
private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   895
  virtual uint           num_edges() const { return 0; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   896
public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   897
  intptr_t _method;             // Address of method
489c9b5090e2 Initial load
duke
parents:
diff changeset
   898
  methodOper() :   _method(0) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   899
  methodOper(intptr_t method) : _method(method)  {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   900
489c9b5090e2 Initial load
duke
parents:
diff changeset
   901
  virtual MachOper *clone(Compile* C) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   902
489c9b5090e2 Initial load
duke
parents:
diff changeset
   903
  virtual intptr_t method() const { return _method; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   904
489c9b5090e2 Initial load
duke
parents:
diff changeset
   905
  virtual uint           opcode() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   906
489c9b5090e2 Initial load
duke
parents:
diff changeset
   907
  virtual uint           hash()   const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   908
  virtual uint           cmp( const MachOper &oper ) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   909
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   910
  virtual const char    *Name()   const { return "Method";}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   911
489c9b5090e2 Initial load
duke
parents:
diff changeset
   912
  virtual void int_format(PhaseRegAlloc *ra, const MachNode *node, outputStream *st) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   913
  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
   914
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   915
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   916
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   917
#endif // SHARE_VM_OPTO_MACHNODE_HPP