Mercurial > hg > truffle
comparison src/share/vm/opto/machnode.hpp @ 17812:a7d4d4655766
Merge
author | kvn |
---|---|
date | Wed, 26 Mar 2014 18:21:05 -0700 |
parents | 62c54fcc0a35 |
children | 17b2fbdb6637 |
comparison
equal
deleted
inserted
replaced
17789:6b207d038106 | 17812:a7d4d4655766 |
---|---|
29 #include "opto/matcher.hpp" | 29 #include "opto/matcher.hpp" |
30 #include "opto/multnode.hpp" | 30 #include "opto/multnode.hpp" |
31 #include "opto/node.hpp" | 31 #include "opto/node.hpp" |
32 #include "opto/regmask.hpp" | 32 #include "opto/regmask.hpp" |
33 | 33 |
34 class BiasedLockingCounters; | |
34 class BufferBlob; | 35 class BufferBlob; |
35 class CodeBuffer; | 36 class CodeBuffer; |
36 class JVMState; | 37 class JVMState; |
37 class MachCallDynamicJavaNode; | 38 class MachCallDynamicJavaNode; |
38 class MachCallJavaNode; | 39 class MachCallJavaNode; |
101 } | 102 } |
102 XMMRegister as_XMMRegister(PhaseRegAlloc *ra_, const Node *node, int idx) const { | 103 XMMRegister as_XMMRegister(PhaseRegAlloc *ra_, const Node *node, int idx) const { |
103 return ::as_XMMRegister(reg(ra_, node, idx)); | 104 return ::as_XMMRegister(reg(ra_, node, idx)); |
104 } | 105 } |
105 #endif | 106 #endif |
107 // CondRegister reg converter | |
108 #if defined(PPC64) | |
109 ConditionRegister as_ConditionRegister(PhaseRegAlloc *ra_, const Node *node) const { | |
110 return ::as_ConditionRegister(reg(ra_, node)); | |
111 } | |
112 ConditionRegister as_ConditionRegister(PhaseRegAlloc *ra_, const Node *node, int idx) const { | |
113 return ::as_ConditionRegister(reg(ra_, node, idx)); | |
114 } | |
115 #endif | |
106 | 116 |
107 virtual intptr_t constant() const; | 117 virtual intptr_t constant() const; |
108 virtual relocInfo::relocType constant_reloc() const; | 118 virtual relocInfo::relocType constant_reloc() const; |
109 virtual jdouble constantD() const; | 119 virtual jdouble constantD() const; |
110 virtual jfloat constantF() const; | 120 virtual jfloat constantF() const; |
154 // Methods to output the text version of the operand | 164 // Methods to output the text version of the operand |
155 virtual void int_format(PhaseRegAlloc *,const MachNode *node, outputStream *st) const = 0; | 165 virtual void int_format(PhaseRegAlloc *,const MachNode *node, outputStream *st) const = 0; |
156 virtual void ext_format(PhaseRegAlloc *,const MachNode *node,int idx, outputStream *st) const=0; | 166 virtual void ext_format(PhaseRegAlloc *,const MachNode *node,int idx, outputStream *st) const=0; |
157 | 167 |
158 virtual void dump_spec(outputStream *st) const; // Print per-operand info | 168 virtual void dump_spec(outputStream *st) const; // Print per-operand info |
159 #endif | 169 |
170 // Check whether o is a valid oper. | |
171 static bool notAnOper(const MachOper *o) { | |
172 if (o == NULL) return true; | |
173 if (((intptr_t)o & 1) != 0) return true; | |
174 if (*(address*)o == badAddress) return true; // kill by Node::destruct | |
175 return false; | |
176 } | |
177 #endif // !PRODUCT | |
160 }; | 178 }; |
161 | 179 |
162 //------------------------------MachNode--------------------------------------- | 180 //------------------------------MachNode--------------------------------------- |
163 // Base type for all machine specific nodes. All node classes generated by the | 181 // Base type for all machine specific nodes. All node classes generated by the |
164 // ADLC inherit from this class. | 182 // ADLC inherit from this class. |
172 virtual int Opcode() const; // Always equal to MachNode | 190 virtual int Opcode() const; // Always equal to MachNode |
173 virtual uint rule() const = 0; // Machine-specific opcode | 191 virtual uint rule() const = 0; // Machine-specific opcode |
174 // Number of inputs which come before the first operand. | 192 // Number of inputs which come before the first operand. |
175 // Generally at least 1, to skip the Control input | 193 // Generally at least 1, to skip the Control input |
176 virtual uint oper_input_base() const { return 1; } | 194 virtual uint oper_input_base() const { return 1; } |
195 // Position of constant base node in node's inputs. -1 if | |
196 // no constant base node input. | |
197 virtual uint mach_constant_base_node_input() const { return (uint)-1; } | |
177 | 198 |
178 // Copy inputs and operands to new node of instruction. | 199 // Copy inputs and operands to new node of instruction. |
179 // Called from cisc_version() and short_branch_version(). | 200 // Called from cisc_version() and short_branch_version(). |
180 // !!!! The method's body is defined in ad_<arch>.cpp file. | 201 // !!!! The method's body is defined in ad_<arch>.cpp file. |
181 void fill_new_machnode(MachNode *n, Compile* C) const; | 202 void fill_new_machnode(MachNode *n, Compile* C) const; |
194 // instruction implemented with a call | 215 // instruction implemented with a call |
195 bool has_call() const { return (flags() & Flag_has_call) != 0; } | 216 bool has_call() const { return (flags() & Flag_has_call) != 0; } |
196 | 217 |
197 // First index in _in[] corresponding to operand, or -1 if there is none | 218 // First index in _in[] corresponding to operand, or -1 if there is none |
198 int operand_index(uint operand) const; | 219 int operand_index(uint operand) const; |
220 int operand_index(const MachOper *oper) const; | |
199 | 221 |
200 // Register class input is expected in | 222 // Register class input is expected in |
201 virtual const RegMask &in_RegMask(uint) const; | 223 virtual const RegMask &in_RegMask(uint) const; |
202 | 224 |
203 // cisc-spillable instructions redefine for use by in_RegMask | 225 // cisc-spillable instructions redefine for use by in_RegMask |
219 MachOper **_opnds; | 241 MachOper **_opnds; |
220 uint num_opnds() const { return _num_opnds; } | 242 uint num_opnds() const { return _num_opnds; } |
221 | 243 |
222 // Emit bytes into cbuf | 244 // Emit bytes into cbuf |
223 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const; | 245 virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const; |
246 // Expand node after register allocation. | |
247 // Node is replaced by several nodes in the postalloc expand phase. | |
248 // Corresponding methods are generated for nodes if they specify | |
249 // postalloc_expand. See block.cpp for more documentation. | |
250 virtual bool requires_postalloc_expand() const { return false; } | |
251 virtual void postalloc_expand(GrowableArray <Node *> *nodes, PhaseRegAlloc *ra_); | |
224 // Size of instruction in bytes | 252 // Size of instruction in bytes |
225 virtual uint size(PhaseRegAlloc *ra_) const; | 253 virtual uint size(PhaseRegAlloc *ra_) const; |
226 // Helper function that computes size by emitting code | 254 // Helper function that computes size by emitting code |
227 virtual uint emit_size(PhaseRegAlloc *ra_) const; | 255 virtual uint emit_size(PhaseRegAlloc *ra_) const; |
228 | 256 |
234 // instruction to properly align it. | 262 // instruction to properly align it. |
235 virtual int compute_padding(int current_offset) const { return 0; } | 263 virtual int compute_padding(int current_offset) const { return 0; } |
236 | 264 |
237 // Return number of relocatable values contained in this instruction | 265 // Return number of relocatable values contained in this instruction |
238 virtual int reloc() const { return 0; } | 266 virtual int reloc() const { return 0; } |
267 | |
268 // Return number of words used for double constants in this instruction | |
269 virtual int ins_num_consts() const { return 0; } | |
239 | 270 |
240 // Hash and compare over operands. Used to do GVN on machine Nodes. | 271 // Hash and compare over operands. Used to do GVN on machine Nodes. |
241 virtual uint hash() const; | 272 virtual uint hash() const; |
242 virtual uint cmp( const Node &n ) const; | 273 virtual uint cmp( const Node &n ) const; |
243 | 274 |
292 | 323 |
293 // Get the pipeline info | 324 // Get the pipeline info |
294 static const Pipeline *pipeline_class(); | 325 static const Pipeline *pipeline_class(); |
295 virtual const Pipeline *pipeline() const; | 326 virtual const Pipeline *pipeline() const; |
296 | 327 |
328 // Returns true if this node is a check that can be implemented with a trap. | |
329 virtual bool is_TrapBasedCheckNode() const { return false; } | |
330 | |
297 #ifndef PRODUCT | 331 #ifndef PRODUCT |
298 virtual const char *Name() const = 0; // Machine-specific name | 332 virtual const char *Name() const = 0; // Machine-specific name |
299 virtual void dump_spec(outputStream *st) const; // Print per-node info | 333 virtual void dump_spec(outputStream *st) const; // Print per-node info |
300 void dump_format(PhaseRegAlloc *ra, outputStream *st) const; // access to virtual | 334 void dump_format(PhaseRegAlloc *ra, outputStream *st) const; // access to virtual |
301 #endif | 335 #endif |
355 } | 389 } |
356 virtual const class Type* bottom_type() const { return TypeRawPtr::NOTNULL; } | 390 virtual const class Type* bottom_type() const { return TypeRawPtr::NOTNULL; } |
357 virtual uint ideal_reg() const { return Op_RegP; } | 391 virtual uint ideal_reg() const { return Op_RegP; } |
358 virtual uint oper_input_base() const { return 1; } | 392 virtual uint oper_input_base() const { return 1; } |
359 | 393 |
394 virtual bool requires_postalloc_expand() const; | |
395 virtual void postalloc_expand(GrowableArray <Node *> *nodes, PhaseRegAlloc *ra_); | |
396 | |
360 virtual void emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const; | 397 virtual void emit(CodeBuffer& cbuf, PhaseRegAlloc* ra_) const; |
361 virtual uint size(PhaseRegAlloc* ra_) const; | 398 virtual uint size(PhaseRegAlloc* ra_) const; |
362 virtual bool pinned() const { return UseRDPCForConstantTableBase; } | 399 virtual bool pinned() const { return UseRDPCForConstantTableBase; } |
363 | 400 |
364 static const RegMask& static_out_RegMask() { return _out_RegMask; } | 401 static const RegMask& static_out_RegMask() { return _out_RegMask; } |
394 return MachConstantBaseNode::static_out_RegMask(); | 431 return MachConstantBaseNode::static_out_RegMask(); |
395 return MachNode::in_RegMask(idx); | 432 return MachNode::in_RegMask(idx); |
396 } | 433 } |
397 | 434 |
398 // Input edge of MachConstantBaseNode. | 435 // Input edge of MachConstantBaseNode. |
399 uint mach_constant_base_node_input() const { return req() - 1; } | 436 virtual uint mach_constant_base_node_input() const { return req() - 1; } |
400 | 437 |
401 int constant_offset(); | 438 int constant_offset(); |
402 int constant_offset() const { return ((MachConstantNode*) this)->constant_offset(); } | 439 int constant_offset() const { return ((MachConstantNode*) this)->constant_offset(); } |
440 // Unchecked version to avoid assertions in debug output. | |
441 int constant_offset_unchecked() const; | |
403 }; | 442 }; |
404 | 443 |
405 //------------------------------MachUEPNode----------------------------------- | 444 //------------------------------MachUEPNode----------------------------------- |
406 // Machine Unvalidated Entry Point Node | 445 // Machine Unvalidated Entry Point Node |
407 class MachUEPNode : public MachIdealNode { | 446 class MachUEPNode : public MachIdealNode { |