annotate src/share/vm/opto/machnode.hpp @ 196:d1605aabd0a1 jdk7-b30

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