src/share/vm/opto/machnode.hpp

Tue, 08 Aug 2017 15:57:29 +0800

author
aoqi
date
Tue, 08 Aug 2017 15:57:29 +0800
changeset 6876
710a3c8b516e
parent 6620
17b2fbdb6637
parent 0
f90c822e73f8
child 7535
7ae4e26cb1e0
permissions
-rw-r--r--

merge

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

mercurial