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