src/share/vm/opto/matcher.hpp

Thu, 24 May 2018 19:26:50 +0800

author
aoqi
date
Thu, 24 May 2018 19:26:50 +0800
changeset 8862
fd13a567f179
parent 6876
710a3c8b516e
child 9448
73d689add964
permissions
-rw-r--r--

#7046 C2 supports long branch
Contributed-by: fujie

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #ifndef SHARE_VM_OPTO_MATCHER_HPP
aoqi@0 26 #define SHARE_VM_OPTO_MATCHER_HPP
aoqi@0 27
aoqi@0 28 #include "libadt/vectset.hpp"
aoqi@0 29 #include "memory/resourceArea.hpp"
aoqi@0 30 #include "opto/node.hpp"
aoqi@0 31 #include "opto/phaseX.hpp"
aoqi@0 32 #include "opto/regmask.hpp"
aoqi@0 33
aoqi@0 34 class Compile;
aoqi@0 35 class Node;
aoqi@0 36 class MachNode;
aoqi@0 37 class MachTypeNode;
aoqi@0 38 class MachOper;
aoqi@0 39
aoqi@0 40 //---------------------------Matcher-------------------------------------------
aoqi@0 41 class Matcher : public PhaseTransform {
aoqi@0 42 friend class VMStructs;
aoqi@0 43 // Private arena of State objects
aoqi@0 44 ResourceArea _states_arena;
aoqi@0 45
aoqi@0 46 VectorSet _visited; // Visit bits
aoqi@0 47
aoqi@0 48 // Used to control the Label pass
aoqi@0 49 VectorSet _shared; // Shared Ideal Node
aoqi@0 50 VectorSet _dontcare; // Nothing the matcher cares about
aoqi@0 51
aoqi@0 52 // Private methods which perform the actual matching and reduction
aoqi@0 53 // Walks the label tree, generating machine nodes
aoqi@0 54 MachNode *ReduceInst( State *s, int rule, Node *&mem);
aoqi@0 55 void ReduceInst_Chain_Rule( State *s, int rule, Node *&mem, MachNode *mach);
aoqi@0 56 uint ReduceInst_Interior(State *s, int rule, Node *&mem, MachNode *mach, uint num_opnds);
aoqi@0 57 void ReduceOper( State *s, int newrule, Node *&mem, MachNode *mach );
aoqi@0 58
aoqi@0 59 // If this node already matched using "rule", return the MachNode for it.
aoqi@0 60 MachNode* find_shared_node(Node* n, uint rule);
aoqi@0 61
aoqi@0 62 // Convert a dense opcode number to an expanded rule number
aoqi@0 63 const int *_reduceOp;
aoqi@0 64 const int *_leftOp;
aoqi@0 65 const int *_rightOp;
aoqi@0 66
aoqi@0 67 // Map dense opcode number to info on when rule is swallowed constant.
aoqi@0 68 const bool *_swallowed;
aoqi@0 69
aoqi@0 70 // Map dense rule number to determine if this is an instruction chain rule
aoqi@0 71 const uint _begin_inst_chain_rule;
aoqi@0 72 const uint _end_inst_chain_rule;
aoqi@0 73
aoqi@0 74 // We want to clone constants and possible CmpI-variants.
aoqi@0 75 // If we do not clone CmpI, then we can have many instances of
aoqi@0 76 // condition codes alive at once. This is OK on some chips and
aoqi@0 77 // bad on others. Hence the machine-dependent table lookup.
aoqi@0 78 const char *_must_clone;
aoqi@0 79
aoqi@0 80 // Find shared Nodes, or Nodes that otherwise are Matcher roots
aoqi@0 81 void find_shared( Node *n );
aoqi@0 82 #ifdef X86
aoqi@0 83 bool is_bmi_pattern(Node *n, Node *m);
aoqi@0 84 #endif
aoqi@0 85
aoqi@0 86 // Debug and profile information for nodes in old space:
aoqi@0 87 GrowableArray<Node_Notes*>* _old_node_note_array;
aoqi@0 88
aoqi@0 89 // Node labeling iterator for instruction selection
aoqi@0 90 Node *Label_Root( const Node *n, State *svec, Node *control, const Node *mem );
aoqi@0 91
aoqi@0 92 Node *transform( Node *dummy );
aoqi@0 93
aoqi@0 94 Node_List _projection_list; // For Machine nodes killing many values
aoqi@0 95
aoqi@0 96 Node_Array _shared_nodes;
aoqi@0 97
aoqi@0 98 debug_only(Node_Array _old2new_map;) // Map roots of ideal-trees to machine-roots
aoqi@0 99 debug_only(Node_Array _new2old_map;) // Maps machine nodes back to ideal
aoqi@0 100
aoqi@0 101 // Accessors for the inherited field PhaseTransform::_nodes:
aoqi@0 102 void grow_new_node_array(uint idx_limit) {
aoqi@0 103 _nodes.map(idx_limit-1, NULL);
aoqi@0 104 }
aoqi@0 105 bool has_new_node(const Node* n) const {
aoqi@0 106 return _nodes.at(n->_idx) != NULL;
aoqi@0 107 }
aoqi@0 108 Node* new_node(const Node* n) const {
aoqi@0 109 assert(has_new_node(n), "set before get");
aoqi@0 110 return _nodes.at(n->_idx);
aoqi@0 111 }
aoqi@0 112 void set_new_node(const Node* n, Node *nn) {
aoqi@0 113 assert(!has_new_node(n), "set only once");
aoqi@0 114 _nodes.map(n->_idx, nn);
aoqi@0 115 }
aoqi@0 116
aoqi@0 117 #ifdef ASSERT
aoqi@0 118 // Make sure only new nodes are reachable from this node
aoqi@0 119 void verify_new_nodes_only(Node* root);
aoqi@0 120
aoqi@0 121 Node* _mem_node; // Ideal memory node consumed by mach node
aoqi@0 122 #endif
aoqi@0 123
aoqi@0 124 // Mach node for ConP #NULL
aoqi@0 125 MachNode* _mach_null;
aoqi@0 126
aoqi@0 127 public:
aoqi@0 128 int LabelRootDepth;
aoqi@0 129 // Convert ideal machine register to a register mask for spill-loads
aoqi@0 130 static const RegMask *idealreg2regmask[];
aoqi@0 131 RegMask *idealreg2spillmask [_last_machine_leaf];
aoqi@0 132 RegMask *idealreg2debugmask [_last_machine_leaf];
aoqi@0 133 RegMask *idealreg2mhdebugmask[_last_machine_leaf];
aoqi@0 134 void init_spill_mask( Node *ret );
aoqi@0 135 // Convert machine register number to register mask
aoqi@0 136 static uint mreg2regmask_max;
aoqi@0 137 static RegMask mreg2regmask[];
aoqi@0 138 static RegMask STACK_ONLY_mask;
aoqi@0 139
aoqi@0 140 MachNode* mach_null() const { return _mach_null; }
aoqi@0 141
aoqi@0 142 bool is_shared( Node *n ) { return _shared.test(n->_idx) != 0; }
aoqi@0 143 void set_shared( Node *n ) { _shared.set(n->_idx); }
aoqi@0 144 bool is_visited( Node *n ) { return _visited.test(n->_idx) != 0; }
aoqi@0 145 void set_visited( Node *n ) { _visited.set(n->_idx); }
aoqi@0 146 bool is_dontcare( Node *n ) { return _dontcare.test(n->_idx) != 0; }
aoqi@0 147 void set_dontcare( Node *n ) { _dontcare.set(n->_idx); }
aoqi@0 148
aoqi@0 149 // Mode bit to tell DFA and expand rules whether we are running after
aoqi@0 150 // (or during) register selection. Usually, the matcher runs before,
aoqi@0 151 // but it will also get called to generate post-allocation spill code.
aoqi@0 152 // In this situation, it is a deadly error to attempt to allocate more
aoqi@0 153 // temporary registers.
aoqi@0 154 bool _allocation_started;
aoqi@0 155
aoqi@0 156 // Machine register names
aoqi@0 157 static const char *regName[];
aoqi@0 158 // Machine register encodings
aoqi@0 159 static const unsigned char _regEncode[];
aoqi@0 160 // Machine Node names
aoqi@0 161 const char **_ruleName;
aoqi@0 162 // Rules that are cheaper to rematerialize than to spill
aoqi@0 163 static const uint _begin_rematerialize;
aoqi@0 164 static const uint _end_rematerialize;
aoqi@0 165
aoqi@0 166 // An array of chars, from 0 to _last_Mach_Reg.
aoqi@0 167 // No Save = 'N' (for register windows)
aoqi@0 168 // Save on Entry = 'E'
aoqi@0 169 // Save on Call = 'C'
aoqi@0 170 // Always Save = 'A' (same as SOE + SOC)
aoqi@0 171 const char *_register_save_policy;
aoqi@0 172 const char *_c_reg_save_policy;
aoqi@0 173 // Convert a machine register to a machine register type, so-as to
aoqi@0 174 // properly match spill code.
aoqi@0 175 const int *_register_save_type;
aoqi@0 176 // Maps from machine register to boolean; true if machine register can
aoqi@0 177 // be holding a call argument in some signature.
aoqi@0 178 static bool can_be_java_arg( int reg );
aoqi@0 179 // Maps from machine register to boolean; true if machine register holds
aoqi@0 180 // a spillable argument.
aoqi@0 181 static bool is_spillable_arg( int reg );
aoqi@0 182
aoqi@0 183 // List of IfFalse or IfTrue Nodes that indicate a taken null test.
aoqi@0 184 // List is valid in the post-matching space.
aoqi@0 185 Node_List _null_check_tests;
aoqi@0 186 void collect_null_checks( Node *proj, Node *orig_proj );
aoqi@0 187 void validate_null_checks( );
aoqi@0 188
aoqi@0 189 Matcher();
aoqi@0 190
aoqi@0 191 // Get a projection node at position pos
aoqi@0 192 Node* get_projection(uint pos) {
aoqi@0 193 return _projection_list[pos];
aoqi@0 194 }
aoqi@0 195
aoqi@0 196 // Push a projection node onto the projection list
aoqi@0 197 void push_projection(Node* node) {
aoqi@0 198 _projection_list.push(node);
aoqi@0 199 }
aoqi@0 200
aoqi@0 201 Node* pop_projection() {
aoqi@0 202 return _projection_list.pop();
aoqi@0 203 }
aoqi@0 204
aoqi@0 205 // Number of nodes in the projection list
aoqi@0 206 uint number_of_projections() const {
aoqi@0 207 return _projection_list.size();
aoqi@0 208 }
aoqi@0 209
aoqi@0 210 // Select instructions for entire method
aoqi@0 211 void match();
aoqi@0 212
aoqi@0 213 // Helper for match
aoqi@0 214 OptoReg::Name warp_incoming_stk_arg( VMReg reg );
aoqi@0 215
aoqi@0 216 // Transform, then walk. Does implicit DCE while walking.
aoqi@0 217 // Name changed from "transform" to avoid it being virtual.
aoqi@0 218 Node *xform( Node *old_space_node, int Nodes );
aoqi@0 219
aoqi@0 220 // Match a single Ideal Node - turn it into a 1-Node tree; Label & Reduce.
aoqi@0 221 MachNode *match_tree( const Node *n );
aoqi@0 222 MachNode *match_sfpt( SafePointNode *sfpt );
aoqi@0 223 // Helper for match_sfpt
aoqi@0 224 OptoReg::Name warp_outgoing_stk_arg( VMReg reg, OptoReg::Name begin_out_arg_area, OptoReg::Name &out_arg_limit_per_call );
aoqi@0 225
aoqi@0 226 // Initialize first stack mask and related masks.
aoqi@0 227 void init_first_stack_mask();
aoqi@0 228
aoqi@0 229 // If we should save-on-entry this register
aoqi@0 230 bool is_save_on_entry( int reg );
aoqi@0 231
aoqi@0 232 // Fixup the save-on-entry registers
aoqi@0 233 void Fixup_Save_On_Entry( );
aoqi@0 234
aoqi@0 235 // --- Frame handling ---
aoqi@0 236
aoqi@0 237 // Register number of the stack slot corresponding to the incoming SP.
aoqi@0 238 // Per the Big Picture in the AD file, it is:
aoqi@0 239 // SharedInfo::stack0 + locks + in_preserve_stack_slots + pad2.
aoqi@0 240 OptoReg::Name _old_SP;
aoqi@0 241
aoqi@0 242 // Register number of the stack slot corresponding to the highest incoming
aoqi@0 243 // argument on the stack. Per the Big Picture in the AD file, it is:
aoqi@0 244 // _old_SP + out_preserve_stack_slots + incoming argument size.
aoqi@0 245 OptoReg::Name _in_arg_limit;
aoqi@0 246
aoqi@0 247 // Register number of the stack slot corresponding to the new SP.
aoqi@0 248 // Per the Big Picture in the AD file, it is:
aoqi@0 249 // _in_arg_limit + pad0
aoqi@0 250 OptoReg::Name _new_SP;
aoqi@0 251
aoqi@0 252 // Register number of the stack slot corresponding to the highest outgoing
aoqi@0 253 // argument on the stack. Per the Big Picture in the AD file, it is:
aoqi@0 254 // _new_SP + max outgoing arguments of all calls
aoqi@0 255 OptoReg::Name _out_arg_limit;
aoqi@0 256
aoqi@0 257 OptoRegPair *_parm_regs; // Array of machine registers per argument
aoqi@0 258 RegMask *_calling_convention_mask; // Array of RegMasks per argument
aoqi@0 259
aoqi@0 260 // Does matcher have a match rule for this ideal node?
aoqi@0 261 static const bool has_match_rule(int opcode);
aoqi@0 262 static const bool _hasMatchRule[_last_opcode];
aoqi@0 263
aoqi@0 264 // Does matcher have a match rule for this ideal node and is the
aoqi@0 265 // predicate (if there is one) true?
aoqi@0 266 // NOTE: If this function is used more commonly in the future, ADLC
aoqi@0 267 // should generate this one.
aoqi@0 268 static const bool match_rule_supported(int opcode);
aoqi@0 269
aoqi@0 270 // Used to determine if we have fast l2f conversion
aoqi@0 271 // USII has it, USIII doesn't
aoqi@0 272 static const bool convL2FSupported(void);
aoqi@0 273
aoqi@0 274 // Vector width in bytes
aoqi@0 275 static const int vector_width_in_bytes(BasicType bt);
aoqi@0 276
aoqi@0 277 // Limits on vector size (number of elements).
aoqi@0 278 static const int max_vector_size(const BasicType bt);
aoqi@0 279 static const int min_vector_size(const BasicType bt);
aoqi@0 280 static const bool vector_size_supported(const BasicType bt, int size) {
aoqi@0 281 return (Matcher::max_vector_size(bt) >= size &&
aoqi@0 282 Matcher::min_vector_size(bt) <= size);
aoqi@0 283 }
aoqi@0 284
aoqi@0 285 // Vector ideal reg
aoqi@0 286 static const int vector_ideal_reg(int len);
aoqi@0 287 static const int vector_shift_count_ideal_reg(int len);
aoqi@0 288
aoqi@0 289 // CPU supports misaligned vectors store/load.
aoqi@0 290 static const bool misaligned_vectors_ok();
aoqi@0 291
aoqi@0 292 // Should original key array reference be passed to AES stubs
aoqi@0 293 static const bool pass_original_key_for_aes();
aoqi@0 294
aoqi@0 295 // Used to determine a "low complexity" 64-bit constant. (Zero is simple.)
aoqi@0 296 // The standard of comparison is one (StoreL ConL) vs. two (StoreI ConI).
aoqi@0 297 // Depends on the details of 64-bit constant generation on the CPU.
aoqi@0 298 static const bool isSimpleConstant64(jlong con);
aoqi@0 299
aoqi@0 300 // These calls are all generated by the ADLC
aoqi@0 301
aoqi@0 302 // TRUE - grows up, FALSE - grows down (Intel)
aoqi@0 303 virtual bool stack_direction() const;
aoqi@0 304
aoqi@0 305 // Java-Java calling convention
aoqi@0 306 // (what you use when Java calls Java)
aoqi@0 307
aoqi@0 308 // Alignment of stack in bytes, standard Intel word alignment is 4.
aoqi@0 309 // Sparc probably wants at least double-word (8).
aoqi@0 310 static uint stack_alignment_in_bytes();
aoqi@0 311 // Alignment of stack, measured in stack slots.
aoqi@0 312 // The size of stack slots is defined by VMRegImpl::stack_slot_size.
aoqi@0 313 static uint stack_alignment_in_slots() {
aoqi@0 314 return stack_alignment_in_bytes() / (VMRegImpl::stack_slot_size);
aoqi@0 315 }
aoqi@0 316
aoqi@0 317 // Array mapping arguments to registers. Argument 0 is usually the 'this'
aoqi@0 318 // pointer. Registers can include stack-slots and regular registers.
aoqi@0 319 static void calling_convention( BasicType *, VMRegPair *, uint len, bool is_outgoing );
aoqi@0 320
aoqi@0 321 // Convert a sig into a calling convention register layout
aoqi@0 322 // and find interesting things about it.
aoqi@0 323 static OptoReg::Name find_receiver( bool is_outgoing );
aoqi@0 324 // Return address register. On Intel it is a stack-slot. On PowerPC
aoqi@0 325 // it is the Link register. On Sparc it is r31?
aoqi@0 326 virtual OptoReg::Name return_addr() const;
aoqi@0 327 RegMask _return_addr_mask;
aoqi@0 328 // Return value register. On Intel it is EAX. On Sparc i0/o0.
aoqi@0 329 static OptoRegPair return_value(int ideal_reg, bool is_outgoing);
aoqi@0 330 static OptoRegPair c_return_value(int ideal_reg, bool is_outgoing);
aoqi@0 331 RegMask _return_value_mask;
aoqi@0 332 // Inline Cache Register
aoqi@0 333 static OptoReg::Name inline_cache_reg();
aoqi@0 334 static int inline_cache_reg_encode();
aoqi@0 335
aoqi@0 336 // Register for DIVI projection of divmodI
aoqi@0 337 static RegMask divI_proj_mask();
aoqi@0 338 // Register for MODI projection of divmodI
aoqi@0 339 static RegMask modI_proj_mask();
aoqi@0 340
aoqi@0 341 // Register for DIVL projection of divmodL
aoqi@0 342 static RegMask divL_proj_mask();
aoqi@0 343 // Register for MODL projection of divmodL
aoqi@0 344 static RegMask modL_proj_mask();
aoqi@0 345
aoqi@0 346 // Use hardware DIV instruction when it is faster than
aoqi@0 347 // a code which use multiply for division by constant.
aoqi@0 348 static bool use_asm_for_ldiv_by_con( jlong divisor );
aoqi@0 349
aoqi@0 350 static const RegMask method_handle_invoke_SP_save_mask();
aoqi@0 351
aoqi@0 352 // Java-Interpreter calling convention
aoqi@0 353 // (what you use when calling between compiled-Java and Interpreted-Java
aoqi@0 354
aoqi@0 355 // Number of callee-save + always-save registers
aoqi@0 356 // Ignores frame pointer and "special" registers
aoqi@0 357 static int number_of_saved_registers();
aoqi@0 358
aoqi@0 359 // The Method-klass-holder may be passed in the inline_cache_reg
aoqi@0 360 // and then expanded into the inline_cache_reg and a method_oop register
aoqi@0 361
aoqi@0 362 static OptoReg::Name interpreter_method_oop_reg();
aoqi@0 363 static int interpreter_method_oop_reg_encode();
aoqi@0 364
aoqi@0 365 static OptoReg::Name compiler_method_oop_reg();
aoqi@0 366 static const RegMask &compiler_method_oop_reg_mask();
aoqi@0 367 static int compiler_method_oop_reg_encode();
aoqi@0 368
aoqi@0 369 // Interpreter's Frame Pointer Register
aoqi@0 370 static OptoReg::Name interpreter_frame_pointer_reg();
aoqi@0 371
aoqi@0 372 // Java-Native calling convention
aoqi@0 373 // (what you use when intercalling between Java and C++ code)
aoqi@0 374
aoqi@0 375 // Array mapping arguments to registers. Argument 0 is usually the 'this'
aoqi@0 376 // pointer. Registers can include stack-slots and regular registers.
aoqi@0 377 static void c_calling_convention( BasicType*, VMRegPair *, uint );
aoqi@0 378 // Frame pointer. The frame pointer is kept at the base of the stack
aoqi@0 379 // and so is probably the stack pointer for most machines. On Intel
aoqi@0 380 // it is ESP. On the PowerPC it is R1. On Sparc it is SP.
aoqi@0 381 OptoReg::Name c_frame_pointer() const;
aoqi@0 382 static RegMask c_frame_ptr_mask;
aoqi@0 383
aoqi@0 384 // !!!!! Special stuff for building ScopeDescs
aoqi@0 385 virtual int regnum_to_fpu_offset(int regnum);
aoqi@0 386
aoqi@0 387 // Is this branch offset small enough to be addressed by a short branch?
aoqi@0 388 bool is_short_branch_offset(int rule, int br_size, int offset);
aoqi@0 389
aoqi@0 390 // Optional scaling for the parameter to the ClearArray/CopyArray node.
aoqi@0 391 static const bool init_array_count_is_in_bytes;
aoqi@0 392
aoqi@0 393 // Threshold small size (in bytes) for a ClearArray/CopyArray node.
aoqi@0 394 // Anything this size or smaller may get converted to discrete scalar stores.
aoqi@0 395 static const int init_array_short_size;
aoqi@0 396
aoqi@0 397 // Some hardware needs 2 CMOV's for longs.
aoqi@0 398 static const int long_cmove_cost();
aoqi@0 399
aoqi@0 400 // Some hardware have expensive CMOV for float and double.
aoqi@0 401 static const int float_cmove_cost();
aoqi@0 402
aoqi@0 403 // Should the Matcher clone shifts on addressing modes, expecting them to
aoqi@0 404 // be subsumed into complex addressing expressions or compute them into
aoqi@0 405 // registers? True for Intel but false for most RISCs
aoqi@0 406 static const bool clone_shift_expressions;
aoqi@0 407
aoqi@0 408 static bool narrow_oop_use_complex_address();
aoqi@0 409 static bool narrow_klass_use_complex_address();
aoqi@0 410
aoqi@0 411 // Generate implicit null check for narrow oops if it can fold
aoqi@0 412 // into address expression (x64).
aoqi@0 413 //
aoqi@0 414 // [R12 + narrow_oop_reg<<3 + offset] // fold into address expression
aoqi@0 415 // NullCheck narrow_oop_reg
aoqi@0 416 //
aoqi@0 417 // When narrow oops can't fold into address expression (Sparc) and
aoqi@0 418 // base is not null use decode_not_null and normal implicit null check.
aoqi@0 419 // Note, decode_not_null node can be used here since it is referenced
aoqi@0 420 // only on non null path but it requires special handling, see
aoqi@0 421 // collect_null_checks():
aoqi@0 422 //
aoqi@0 423 // decode_not_null narrow_oop_reg, oop_reg // 'shift' and 'add base'
aoqi@0 424 // [oop_reg + offset]
aoqi@0 425 // NullCheck oop_reg
aoqi@0 426 //
aoqi@0 427 // With Zero base and when narrow oops can not fold into address
aoqi@0 428 // expression use normal implicit null check since only shift
aoqi@0 429 // is needed to decode narrow oop.
aoqi@0 430 //
aoqi@0 431 // decode narrow_oop_reg, oop_reg // only 'shift'
aoqi@0 432 // [oop_reg + offset]
aoqi@0 433 // NullCheck oop_reg
aoqi@0 434 //
aoqi@0 435 inline static bool gen_narrow_oop_implicit_null_checks() {
aoqi@0 436 return Universe::narrow_oop_use_implicit_null_checks() &&
aoqi@0 437 (narrow_oop_use_complex_address() ||
aoqi@0 438 Universe::narrow_oop_base() != NULL);
aoqi@0 439 }
aoqi@0 440
aoqi@0 441 // Is it better to copy float constants, or load them directly from memory?
aoqi@0 442 // Intel can load a float constant from a direct address, requiring no
aoqi@0 443 // extra registers. Most RISCs will have to materialize an address into a
aoqi@0 444 // register first, so they may as well materialize the constant immediately.
aoqi@0 445 static const bool rematerialize_float_constants;
aoqi@0 446
aoqi@0 447 // If CPU can load and store mis-aligned doubles directly then no fixup is
aoqi@0 448 // needed. Else we split the double into 2 integer pieces and move it
aoqi@0 449 // piece-by-piece. Only happens when passing doubles into C code or when
aoqi@0 450 // calling i2c adapters as the Java calling convention forces doubles to be
aoqi@0 451 // aligned.
aoqi@0 452 static const bool misaligned_doubles_ok;
aoqi@0 453
aoqi@0 454 // Does the CPU require postalloc expand (see block.cpp for description of
aoqi@0 455 // postalloc expand)?
aoqi@0 456 static const bool require_postalloc_expand;
aoqi@0 457
aoqi@0 458 // Perform a platform dependent implicit null fixup. This is needed
aoqi@0 459 // on windows95 to take care of some unusual register constraints.
aoqi@0 460 void pd_implicit_null_fixup(MachNode *load, uint idx);
aoqi@0 461
aoqi@0 462 // Advertise here if the CPU requires explicit rounding operations
aoqi@0 463 // to implement the UseStrictFP mode.
aoqi@0 464 static const bool strict_fp_requires_explicit_rounding;
aoqi@0 465
aoqi@0 466 // Are floats conerted to double when stored to stack during deoptimization?
aoqi@0 467 static bool float_in_double();
aoqi@0 468 // Do ints take an entire long register or just half?
aoqi@0 469 static const bool int_in_long;
aoqi@0 470
aoqi@0 471 // Do the processor's shift instructions only use the low 5/6 bits
aoqi@0 472 // of the count for 32/64 bit ints? If not we need to do the masking
aoqi@0 473 // ourselves.
aoqi@0 474 static const bool need_masked_shift_count;
aoqi@0 475
aoqi@0 476 // This routine is run whenever a graph fails to match.
aoqi@0 477 // If it returns, the compiler should bailout to interpreter without error.
aoqi@0 478 // In non-product mode, SoftMatchFailure is false to detect non-canonical
aoqi@0 479 // graphs. Print a message and exit.
aoqi@0 480 static void soft_match_failure() {
aoqi@0 481 if( SoftMatchFailure ) return;
aoqi@0 482 else { fatal("SoftMatchFailure is not allowed except in product"); }
aoqi@0 483 }
aoqi@0 484
aoqi@0 485 // Check for a following volatile memory barrier without an
aoqi@0 486 // intervening load and thus we don't need a barrier here. We
aoqi@0 487 // retain the Node to act as a compiler ordering barrier.
aoqi@0 488 static bool post_store_load_barrier(const Node* mb);
aoqi@0 489
aoqi@0 490 // Does n lead to an uncommon trap that can cause deoptimization?
aoqi@0 491 static bool branches_to_uncommon_trap(const Node *n);
aoqi@0 492
aoqi@0 493 #ifdef ASSERT
aoqi@0 494 void dump_old2new_map(); // machine-independent to machine-dependent
aoqi@0 495
aoqi@0 496 Node* find_old_node(Node* new_node) {
aoqi@0 497 return _new2old_map[new_node->_idx];
aoqi@0 498 }
aoqi@0 499 #endif
aoqi@0 500 };
aoqi@0 501
aoqi@0 502 #endif // SHARE_VM_OPTO_MATCHER_HPP

mercurial