src/share/vm/opto/machnode.hpp

Thu, 31 Jul 2014 19:59:36 +0200

author
roland
date
Thu, 31 Jul 2014 19:59:36 +0200
changeset 7003
69ea58782b1a
parent 6620
17b2fbdb6637
child 6876
710a3c8b516e
child 7161
fc2c88ea11a9
permissions
-rw-r--r--

8054054: 8040121 is broken
Summary: C++ code pattern from 8040121 is incorrect
Reviewed-by: kvn

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

mercurial