166 Unique_Node_List worklist;
167 VectorSet visited;
168 worklist.push(xroot);
169 while (worklist.size() > 0) {
170 Node* n = worklist.pop();
171 visited.set(n->_idx);
172 assert(C->node_arena()->contains(n), "dead node");
173 for (uint j = 0; j < n->req(); j++) {
174 Node* in = n->in(j);
175 if (in != NULL) {
176 assert(C->node_arena()->contains(in), "dead node");
177 if (!visited.test(in->_idx)) {
178 worklist.push(in);
179 }
180 }
181 }
182 }
183 }
184 #endif
185
186
187 //---------------------------match---------------------------------------------
188 void Matcher::match( ) {
189 if( MaxLabelRootDepth < 100 ) { // Too small?
190 assert(false, "invalid MaxLabelRootDepth, increase it to 100 minimum");
191 MaxLabelRootDepth = 100;
192 }
193 // One-time initialization of some register masks.
194 init_spill_mask( C->root()->in(1) );
195 _return_addr_mask = return_addr();
196 #ifdef _LP64
197 // Pointers take 2 slots in 64-bit land
198 _return_addr_mask.Insert(OptoReg::add(return_addr(),1));
199 #endif
200
201 // Map a Java-signature return type into return register-value
202 // machine registers for 0, 1 and 2 returned values.
203 const TypeTuple *range = C->tf()->range();
204 if( range->cnt() > TypeFunc::Parms ) { // If not a void function
205 // Get ideal-register return type
206 uint ireg = range->field_at(TypeFunc::Parms)->ideal_reg();
207 // Get machine return register
208 uint sop = C->start()->Opcode();
209 OptoRegPair regs = return_value(ireg);
210
211 // And mask for same
212 _return_value_mask = RegMask(regs.first());
213 if( OptoReg::is_valid(regs.second()) )
214 _return_value_mask.Insert(regs.second());
215 }
216
217 // ---------------
218 // Frame Layout
219
220 // Need the method signature to determine the incoming argument types,
221 // because the types determine which registers the incoming arguments are
222 // in, and this affects the matched code.
223 const TypeTuple *domain = C->tf()->domain();
224 uint argcnt = domain->cnt() - TypeFunc::Parms;
225 BasicType *sig_bt = NEW_RESOURCE_ARRAY( BasicType, argcnt );
226 VMRegPair *vm_parm_regs = NEW_RESOURCE_ARRAY( VMRegPair, argcnt );
227 _parm_regs = NEW_RESOURCE_ARRAY( OptoRegPair, argcnt );
228 _calling_convention_mask = NEW_RESOURCE_ARRAY( RegMask, argcnt );
229 uint i;
230 for( i = 0; i<argcnt; i++ ) {
231 sig_bt[i] = domain->field_at(i+TypeFunc::Parms)->basic_type();
232 }
233
234 // Pass array of ideal registers and length to USER code (from the AD file)
235 // that will convert this to an array of register numbers.
236 const StartNode *start = C->start();
237 start->calling_convention( sig_bt, vm_parm_regs, argcnt );
238 #ifdef ASSERT
239 // Sanity check users' calling convention. Real handy while trying to
240 // get the initial port correct.
241 { for (uint i = 0; i<argcnt; i++) {
242 if( !vm_parm_regs[i].first()->is_valid() && !vm_parm_regs[i].second()->is_valid() ) {
243 assert(domain->field_at(i+TypeFunc::Parms)==Type::HALF, "only allowed on halve" );
507 idealreg2mhdebugmask[Op_VecS] = &rms[31];
508 idealreg2mhdebugmask[Op_VecD] = &rms[32];
509 idealreg2mhdebugmask[Op_VecX] = &rms[33];
510 idealreg2mhdebugmask[Op_VecY] = &rms[34];
511 idealreg2mhdebugmask[Op_VecZ] = &rms[35];
512
513 idealreg2spillmask [Op_RegVectMask] = &rms[36];
514 idealreg2debugmask [Op_RegVectMask] = &rms[37];
515 idealreg2mhdebugmask[Op_RegVectMask] = &rms[38];
516
517 OptoReg::Name i;
518
519 // At first, start with the empty mask
520 C->FIRST_STACK_mask().Clear();
521
522 // Add in the incoming argument area
523 OptoReg::Name init_in = OptoReg::add(_old_SP, C->out_preserve_stack_slots());
524 for (i = init_in; i < _in_arg_limit; i = OptoReg::add(i,1)) {
525 C->FIRST_STACK_mask().Insert(i);
526 }
527 // Add in all bits past the outgoing argument area
528 guarantee(RegMask::can_represent_arg(OptoReg::add(_out_arg_limit,-1)),
529 "must be able to represent all call arguments in reg mask");
530 OptoReg::Name init = _out_arg_limit;
531 for (i = init; RegMask::can_represent(i); i = OptoReg::add(i,1)) {
532 C->FIRST_STACK_mask().Insert(i);
533 }
534 // Finally, set the "infinite stack" bit.
535 C->FIRST_STACK_mask().set_AllStack();
536
537 // Make spill masks. Registers for their class, plus FIRST_STACK_mask.
538 RegMask aligned_stack_mask = C->FIRST_STACK_mask();
539 // Keep spill masks aligned.
540 aligned_stack_mask.clear_to_pairs();
541 assert(aligned_stack_mask.is_AllStack(), "should be infinite stack");
542 RegMask scalable_stack_mask = aligned_stack_mask;
543
544 *idealreg2spillmask[Op_RegP] = *idealreg2regmask[Op_RegP];
545 #ifdef _LP64
546 *idealreg2spillmask[Op_RegN] = *idealreg2regmask[Op_RegN];
765 _register_save_policy[reg] == 'E' ||
766 _register_save_policy[reg] == 'A'; // Save-on-entry register?
767 }
768
769 //---------------------------Fixup_Save_On_Entry-------------------------------
770 void Matcher::Fixup_Save_On_Entry( ) {
771 init_first_stack_mask();
772
773 Node *root = C->root(); // Short name for root
774 // Count number of save-on-entry registers.
775 uint soe_cnt = number_of_saved_registers();
776 uint i;
777
778 // Find the procedure Start Node
779 StartNode *start = C->start();
780 assert( start, "Expect a start node" );
781
782 // Input RegMask array shared by all Returns.
783 // The type for doubles and longs has a count of 2, but
784 // there is only 1 returned value
785 uint ret_edge_cnt = TypeFunc::Parms + ((C->tf()->range()->cnt() == TypeFunc::Parms) ? 0 : 1);
786 RegMask *ret_rms = init_input_masks( ret_edge_cnt + soe_cnt, _return_addr_mask, c_frame_ptr_mask );
787 // Returns have 0 or 1 returned values depending on call signature.
788 // Return register is specified by return_value in the AD file.
789 if (ret_edge_cnt > TypeFunc::Parms)
790 ret_rms[TypeFunc::Parms+0] = _return_value_mask;
791
792 // Input RegMask array shared by all Rethrows.
793 uint reth_edge_cnt = TypeFunc::Parms+1;
794 RegMask *reth_rms = init_input_masks( reth_edge_cnt + soe_cnt, _return_addr_mask, c_frame_ptr_mask );
795 // Rethrow takes exception oop only, but in the argument 0 slot.
796 OptoReg::Name reg = find_receiver();
797 if (reg >= 0) {
798 reth_rms[TypeFunc::Parms] = mreg2regmask[reg];
799 #ifdef _LP64
800 // Need two slots for ptrs in 64-bit land
801 reth_rms[TypeFunc::Parms].Insert(OptoReg::add(OptoReg::Name(reg), 1));
802 #endif
803 }
804
805 // Input RegMask array shared by all TailCalls
806 uint tail_call_edge_cnt = TypeFunc::Parms+2;
807 RegMask *tail_call_rms = init_input_masks( tail_call_edge_cnt + soe_cnt, _return_addr_mask, c_frame_ptr_mask );
808
809 // Input RegMask array shared by all TailJumps
810 uint tail_jump_edge_cnt = TypeFunc::Parms+2;
837 }
838
839 // Input RegMask array shared by all Halts
840 uint halt_edge_cnt = TypeFunc::Parms;
841 RegMask *halt_rms = init_input_masks( halt_edge_cnt + soe_cnt, _return_addr_mask, c_frame_ptr_mask );
842
843 // Capture the return input masks into each exit flavor
844 for( i=1; i < root->req(); i++ ) {
845 MachReturnNode *exit = root->in(i)->as_MachReturn();
846 switch( exit->ideal_Opcode() ) {
847 case Op_Return : exit->_in_rms = ret_rms; break;
848 case Op_Rethrow : exit->_in_rms = reth_rms; break;
849 case Op_TailCall : exit->_in_rms = tail_call_rms; break;
850 case Op_TailJump : exit->_in_rms = tail_jump_rms; break;
851 case Op_Halt : exit->_in_rms = halt_rms; break;
852 default : ShouldNotReachHere();
853 }
854 }
855
856 // Next unused projection number from Start.
857 int proj_cnt = C->tf()->domain()->cnt();
858
859 // Do all the save-on-entry registers. Make projections from Start for
860 // them, and give them a use at the exit points. To the allocator, they
861 // look like incoming register arguments.
862 for( i = 0; i < _last_Mach_Reg; i++ ) {
863 if( is_save_on_entry(i) ) {
864
865 // Add the save-on-entry to the mask array
866 ret_rms [ ret_edge_cnt] = mreg2regmask[i];
867 reth_rms [ reth_edge_cnt] = mreg2regmask[i];
868 tail_call_rms[tail_call_edge_cnt] = mreg2regmask[i];
869 tail_jump_rms[tail_jump_edge_cnt] = mreg2regmask[i];
870 // Halts need the SOE registers, but only in the stack as debug info.
871 // A just-prior uncommon-trap or deoptimization will use the SOE regs.
872 halt_rms [ halt_edge_cnt] = *idealreg2spillmask[_register_save_type[i]];
873
874 Node *mproj;
875
876 // Is this a RegF low half of a RegD? Double up 2 adjacent RegF's
877 // into a single RegD.
1109 Node *oldn = n;
1110 // Old-space or new-space check
1111 if (!C->node_arena()->contains(n)) {
1112 // Old space!
1113 Node* m;
1114 if (has_new_node(n)) { // Not yet Label/Reduced
1115 m = new_node(n);
1116 } else {
1117 if (!is_dontcare(n)) { // Matcher can match this guy
1118 // Calls match special. They match alone with no children.
1119 // Their children, the incoming arguments, match normally.
1120 m = n->is_SafePoint() ? match_sfpt(n->as_SafePoint()):match_tree(n);
1121 if (C->failing()) return NULL;
1122 if (m == NULL) { Matcher::soft_match_failure(); return NULL; }
1123 if (n->is_MemBar()) {
1124 m->as_MachMemBar()->set_adr_type(n->adr_type());
1125 }
1126 } else { // Nothing the matcher cares about
1127 if (n->is_Proj() && n->in(0) != NULL && n->in(0)->is_Multi()) { // Projections?
1128 // Convert to machine-dependent projection
1129 m = n->in(0)->as_Multi()->match( n->as_Proj(), this );
1130 NOT_PRODUCT(record_new2old(m, n);)
1131 if (m->in(0) != NULL) // m might be top
1132 collect_null_checks(m, n);
1133 } else { // Else just a regular 'ol guy
1134 m = n->clone(); // So just clone into new-space
1135 NOT_PRODUCT(record_new2old(m, n);)
1136 // Def-Use edges will be added incrementally as Uses
1137 // of this node are matched.
1138 assert(m->outcnt() == 0, "no Uses of this clone yet");
1139 }
1140 }
1141
1142 set_new_node(n, m); // Map old to new
1143 if (_old_node_note_array != NULL) {
1144 Node_Notes* nn = C->locate_node_notes(_old_node_note_array,
1145 n->_idx);
1146 C->set_node_notes_at(m->_idx, nn);
1147 }
1148 debug_only(match_alias_type(C, n, m));
1149 }
1248 }
1249 return OptoReg::as_OptoReg(reg);
1250 }
1251
1252
1253 //------------------------------match_sfpt-------------------------------------
1254 // Helper function to match call instructions. Calls match special.
1255 // They match alone with no children. Their children, the incoming
1256 // arguments, match normally.
1257 MachNode *Matcher::match_sfpt( SafePointNode *sfpt ) {
1258 MachSafePointNode *msfpt = NULL;
1259 MachCallNode *mcall = NULL;
1260 uint cnt;
1261 // Split out case for SafePoint vs Call
1262 CallNode *call;
1263 const TypeTuple *domain;
1264 ciMethod* method = NULL;
1265 bool is_method_handle_invoke = false; // for special kill effects
1266 if( sfpt->is_Call() ) {
1267 call = sfpt->as_Call();
1268 domain = call->tf()->domain();
1269 cnt = domain->cnt();
1270
1271 // Match just the call, nothing else
1272 MachNode *m = match_tree(call);
1273 if (C->failing()) return NULL;
1274 if( m == NULL ) { Matcher::soft_match_failure(); return NULL; }
1275
1276 // Copy data from the Ideal SafePoint to the machine version
1277 mcall = m->as_MachCall();
1278
1279 mcall->set_tf( call->tf());
1280 mcall->set_entry_point( call->entry_point());
1281 mcall->set_cnt( call->cnt());
1282 mcall->set_guaranteed_safepoint(call->guaranteed_safepoint());
1283
1284 if( mcall->is_MachCallJava() ) {
1285 MachCallJavaNode *mcall_java = mcall->as_MachCallJava();
1286 const CallJavaNode *call_java = call->as_CallJava();
1287 assert(call_java->validate_symbolic_info(), "inconsistent info");
1288 method = call_java->method();
1327 msfpt->_in_rms = NEW_RESOURCE_ARRAY( RegMask, cnt );
1328 // Empty them all.
1329 for (uint i = 0; i < cnt; i++) ::new (&(msfpt->_in_rms[i])) RegMask();
1330
1331 // Do all the pre-defined non-Empty register masks
1332 msfpt->_in_rms[TypeFunc::ReturnAdr] = _return_addr_mask;
1333 msfpt->_in_rms[TypeFunc::FramePtr ] = c_frame_ptr_mask;
1334
1335 // Place first outgoing argument can possibly be put.
1336 OptoReg::Name begin_out_arg_area = OptoReg::add(_new_SP, C->out_preserve_stack_slots());
1337 assert( is_even(begin_out_arg_area), "" );
1338 // Compute max outgoing register number per call site.
1339 OptoReg::Name out_arg_limit_per_call = begin_out_arg_area;
1340 // Calls to C may hammer extra stack slots above and beyond any arguments.
1341 // These are usually backing store for register arguments for varargs.
1342 if( call != NULL && call->is_CallRuntime() )
1343 out_arg_limit_per_call = OptoReg::add(out_arg_limit_per_call,C->varargs_C_out_slots_killed());
1344
1345
1346 // Do the normal argument list (parameters) register masks
1347 int argcnt = cnt - TypeFunc::Parms;
1348 if( argcnt > 0 ) { // Skip it all if we have no args
1349 BasicType *sig_bt = NEW_RESOURCE_ARRAY( BasicType, argcnt );
1350 VMRegPair *parm_regs = NEW_RESOURCE_ARRAY( VMRegPair, argcnt );
1351 int i;
1352 for( i = 0; i < argcnt; i++ ) {
1353 sig_bt[i] = domain->field_at(i+TypeFunc::Parms)->basic_type();
1354 }
1355 // V-call to pick proper calling convention
1356 call->calling_convention( sig_bt, parm_regs, argcnt );
1357
1358 #ifdef ASSERT
1359 // Sanity check users' calling convention. Really handy during
1360 // the initial porting effort. Fairly expensive otherwise.
1361 { for (int i = 0; i<argcnt; i++) {
1362 if( !parm_regs[i].first()->is_valid() &&
1363 !parm_regs[i].second()->is_valid() ) continue;
1364 VMReg reg1 = parm_regs[i].first();
1365 VMReg reg2 = parm_regs[i].second();
1366 for (int j = 0; j < i; j++) {
1367 if( !parm_regs[j].first()->is_valid() &&
1368 !parm_regs[j].second()->is_valid() ) continue;
1369 VMReg reg3 = parm_regs[j].first();
1370 VMReg reg4 = parm_regs[j].second();
1371 if( !reg1->is_valid() ) {
1372 assert( !reg2->is_valid(), "valid halvsies" );
1373 } else if( !reg3->is_valid() ) {
1374 assert( !reg4->is_valid(), "valid halvsies" );
1375 } else {
1376 assert( reg1 != reg2, "calling conv. must produce distinct regs");
1377 assert( reg1 != reg3, "calling conv. must produce distinct regs");
1378 assert( reg1 != reg4, "calling conv. must produce distinct regs");
1379 assert( reg2 != reg3, "calling conv. must produce distinct regs");
1380 assert( reg2 != reg4 || !reg2->is_valid(), "calling conv. must produce distinct regs");
1381 assert( reg3 != reg4, "calling conv. must produce distinct regs");
1382 }
1383 }
1384 }
1385 }
1386 #endif
1387
1388 // Visit each argument. Compute its outgoing register mask.
1389 // Return results now can have 2 bits returned.
1390 // Compute max over all outgoing arguments both per call-site
1391 // and over the entire method.
1392 for( i = 0; i < argcnt; i++ ) {
1393 // Address of incoming argument mask to fill in
1394 RegMask *rm = &mcall->_in_rms[i+TypeFunc::Parms];
1395 VMReg first = parm_regs[i].first();
1396 VMReg second = parm_regs[i].second();
1397 if(!first->is_valid() &&
1398 !second->is_valid()) {
1399 continue; // Avoid Halves
1400 }
1401 // Handle case where arguments are in vector registers.
1402 if(call->in(TypeFunc::Parms + i)->bottom_type()->isa_vect()) {
1403 OptoReg::Name reg_fst = OptoReg::as_OptoReg(first);
1404 OptoReg::Name reg_snd = OptoReg::as_OptoReg(second);
1405 assert (reg_fst <= reg_snd, "fst=%d snd=%d", reg_fst, reg_snd);
1406 for (OptoReg::Name r = reg_fst; r <= reg_snd; r++) {
1407 rm->Insert(r);
1408 }
1409 }
1410 // Grab first register, adjust stack slots and insert in mask.
1411 OptoReg::Name reg1 = warp_outgoing_stk_arg(first, begin_out_arg_area, out_arg_limit_per_call );
1412 if (OptoReg::is_valid(reg1))
1413 rm->Insert( reg1 );
1414 // Grab second register (if any), adjust stack slots and insert in mask.
1415 OptoReg::Name reg2 = warp_outgoing_stk_arg(second, begin_out_arg_area, out_arg_limit_per_call );
1416 if (OptoReg::is_valid(reg2))
1417 rm->Insert( reg2 );
1418 } // End of for all arguments
1419 }
1420
1421 // Compute the max stack slot killed by any call. These will not be
1422 // available for debug info, and will be used to adjust FIRST_STACK_mask
1423 // after all call sites have been visited.
1424 if( _out_arg_limit < out_arg_limit_per_call)
1425 _out_arg_limit = out_arg_limit_per_call;
1426
1427 if (mcall) {
1428 // Kill the outgoing argument area, including any non-argument holes and
1429 // any legacy C-killed slots. Use Fat-Projections to do the killing.
1430 // Since the max-per-method covers the max-per-call-site and debug info
1431 // is excluded on the max-per-method basis, debug info cannot land in
1432 // this killed area.
1433 uint r_cnt = mcall->tf()->range()->cnt();
1434 MachProjNode *proj = new MachProjNode( mcall, r_cnt+10000, RegMask::Empty, MachProjNode::fat_proj );
1435 if (!RegMask::can_represent_arg(OptoReg::Name(out_arg_limit_per_call-1))) {
1436 C->record_method_not_compilable("unsupported outgoing calling sequence");
1437 } else {
1438 for (int i = begin_out_arg_area; i < out_arg_limit_per_call; i++)
1439 proj->_rout.Insert(OptoReg::Name(i));
1440 }
1441 if (proj->_rout.is_NotEmpty()) {
1442 push_projection(proj);
1443 }
1444 }
1445 // Transfer the safepoint information from the call to the mcall
1446 // Move the JVMState list
1447 msfpt->set_jvms(sfpt->jvms());
1448 for (JVMState* jvms = msfpt->jvms(); jvms; jvms = jvms->caller()) {
1449 jvms->set_map(sfpt);
1450 }
1451
1452 // Debug inputs begin just after the last incoming parameter
1453 assert((mcall == NULL) || (mcall->jvms() == NULL) ||
1454 (mcall->jvms()->debug_start() + mcall->_jvmadj == mcall->tf()->domain()->cnt()), "");
1455
1456 // Add additional edges.
1457 if (msfpt->mach_constant_base_node_input() != (uint)-1 && !msfpt->is_MachCallLeaf()) {
1458 // For these calls we can not add MachConstantBase in expand(), as the
1459 // ins are not complete then.
1460 msfpt->ins_req(msfpt->mach_constant_base_node_input(), C->mach_constant_base_node());
1461 if (msfpt->jvms() &&
1462 msfpt->mach_constant_base_node_input() <= msfpt->jvms()->debug_start() + msfpt->_jvmadj) {
1463 // We added an edge before jvms, so we must adapt the position of the ins.
1464 msfpt->jvms()->adapt_position(+1);
1465 }
1466 }
1467
1468 // Registers killed by the call are set in the local scheduling pass
1469 // of Global Code Motion.
1470 return msfpt;
1471 }
1472
1473 //---------------------------match_tree----------------------------------------
1474 // Match a Ideal Node DAG - turn it into a tree; Label & Reduce. Used as part
2117 set_shared(n); // Flag as shared and
2118 if (n->is_DecodeNarrowPtr()) {
2119 // Oop field/array element loads must be shared but since
2120 // they are shared through a DecodeN they may appear to have
2121 // a single use so force sharing here.
2122 set_shared(n->in(1));
2123 }
2124 mstack.pop(); // remove node from stack
2125 continue;
2126 }
2127 nstate = Visit; // Not already visited; so visit now
2128 }
2129 if (nstate == Visit) {
2130 mstack.set_state(Post_Visit);
2131 set_visited(n); // Flag as visited now
2132 bool mem_op = false;
2133 int mem_addr_idx = MemNode::Address;
2134 if (find_shared_visit(mstack, n, nop, mem_op, mem_addr_idx)) {
2135 continue;
2136 }
2137 for (int i = n->req() - 1; i >= 0; --i) { // For my children
2138 Node* m = n->in(i); // Get ith input
2139 if (m == NULL) {
2140 continue; // Ignore NULLs
2141 }
2142 if (clone_node(n, m, mstack)) {
2143 continue;
2144 }
2145
2146 // Clone addressing expressions as they are "free" in memory access instructions
2147 if (mem_op && i == mem_addr_idx && m->is_AddP() &&
2148 // When there are other uses besides address expressions
2149 // put it on stack and mark as shared.
2150 !is_visited(m)) {
2151 // Some inputs for address expression are not put on stack
2152 // to avoid marking them as shared and forcing them into register
2153 // if they are used only in address expressions.
2154 // But they should be marked as shared if there are other uses
2155 // besides address expressions.
2156
2157 if (pd_clone_address_expressions(m->as_AddP(), mstack, address_visited)) {
2441 case Op_FmaD:
2442 case Op_FmaF:
2443 case Op_FmaVD:
2444 case Op_FmaVF: {
2445 // Restructure into a binary tree for Matching.
2446 Node* pair = new BinaryNode(n->in(1), n->in(2));
2447 n->set_req(2, pair);
2448 n->set_req(1, n->in(3));
2449 n->del_req(3);
2450 break;
2451 }
2452 case Op_MulAddS2I: {
2453 Node* pair1 = new BinaryNode(n->in(1), n->in(2));
2454 Node* pair2 = new BinaryNode(n->in(3), n->in(4));
2455 n->set_req(1, pair1);
2456 n->set_req(2, pair2);
2457 n->del_req(4);
2458 n->del_req(3);
2459 break;
2460 }
2461 case Op_CopySignD:
2462 case Op_SignumVF:
2463 case Op_SignumVD:
2464 case Op_SignumF:
2465 case Op_SignumD: {
2466 Node* pair = new BinaryNode(n->in(2), n->in(3));
2467 n->set_req(2, pair);
2468 n->del_req(3);
2469 break;
2470 }
2471 case Op_VectorBlend:
2472 case Op_VectorInsert: {
2473 Node* pair = new BinaryNode(n->in(1), n->in(2));
2474 n->set_req(1, pair);
2475 n->set_req(2, n->in(3));
2476 n->del_req(3);
2477 break;
2478 }
2479 case Op_LoadVectorGatherMasked:
2480 case Op_StoreVectorScatter: {
|
166 Unique_Node_List worklist;
167 VectorSet visited;
168 worklist.push(xroot);
169 while (worklist.size() > 0) {
170 Node* n = worklist.pop();
171 visited.set(n->_idx);
172 assert(C->node_arena()->contains(n), "dead node");
173 for (uint j = 0; j < n->req(); j++) {
174 Node* in = n->in(j);
175 if (in != NULL) {
176 assert(C->node_arena()->contains(in), "dead node");
177 if (!visited.test(in->_idx)) {
178 worklist.push(in);
179 }
180 }
181 }
182 }
183 }
184 #endif
185
186 // Array of RegMask, one per returned values (inline type instances can
187 // be returned as multiple return values, one per field)
188 RegMask* Matcher::return_values_mask(const TypeFunc* tf) {
189 const TypeTuple* range = tf->range_cc();
190 uint cnt = range->cnt() - TypeFunc::Parms;
191 if (cnt == 0) {
192 return NULL;
193 }
194 RegMask* mask = NEW_RESOURCE_ARRAY(RegMask, cnt);
195 BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType, cnt);
196 VMRegPair* vm_parm_regs = NEW_RESOURCE_ARRAY(VMRegPair, cnt);
197 for (uint i = 0; i < cnt; i++) {
198 sig_bt[i] = range->field_at(i+TypeFunc::Parms)->basic_type();
199 }
200
201 int regs = SharedRuntime::java_return_convention(sig_bt, vm_parm_regs, cnt);
202 if (regs <= 0) {
203 // We ran out of registers to store the IsInit information for a nullable inline type return.
204 // Since it is only set in the 'call_epilog', we can simply put it on the stack.
205 assert(tf->returns_inline_type_as_fields(), "should have been tested during graph construction");
206 // TODO 8284443 Can we teach the register allocator to reserve a stack slot instead?
207 // mask[--cnt] = STACK_ONLY_mask does not work (test with -XX:+StressGCM)
208 int slot = C->fixed_slots() - 2;
209 if (C->needs_stack_repair()) {
210 slot -= 2; // Account for stack increment value
211 }
212 mask[--cnt].Clear();
213 mask[cnt].Insert(OptoReg::stack2reg(slot));
214 }
215 for (uint i = 0; i < cnt; i++) {
216 mask[i].Clear();
217
218 OptoReg::Name reg1 = OptoReg::as_OptoReg(vm_parm_regs[i].first());
219 if (OptoReg::is_valid(reg1)) {
220 mask[i].Insert(reg1);
221 }
222 OptoReg::Name reg2 = OptoReg::as_OptoReg(vm_parm_regs[i].second());
223 if (OptoReg::is_valid(reg2)) {
224 mask[i].Insert(reg2);
225 }
226 }
227
228 return mask;
229 }
230
231 //---------------------------match---------------------------------------------
232 void Matcher::match( ) {
233 if( MaxLabelRootDepth < 100 ) { // Too small?
234 assert(false, "invalid MaxLabelRootDepth, increase it to 100 minimum");
235 MaxLabelRootDepth = 100;
236 }
237 // One-time initialization of some register masks.
238 init_spill_mask( C->root()->in(1) );
239 _return_addr_mask = return_addr();
240 #ifdef _LP64
241 // Pointers take 2 slots in 64-bit land
242 _return_addr_mask.Insert(OptoReg::add(return_addr(),1));
243 #endif
244
245 // Map Java-signature return types into return register-value
246 // machine registers.
247 _return_values_mask = return_values_mask(C->tf());
248
249 // ---------------
250 // Frame Layout
251
252 // Need the method signature to determine the incoming argument types,
253 // because the types determine which registers the incoming arguments are
254 // in, and this affects the matched code.
255 const TypeTuple *domain = C->tf()->domain_cc();
256 uint argcnt = domain->cnt() - TypeFunc::Parms;
257 BasicType *sig_bt = NEW_RESOURCE_ARRAY( BasicType, argcnt );
258 VMRegPair *vm_parm_regs = NEW_RESOURCE_ARRAY( VMRegPair, argcnt );
259 _parm_regs = NEW_RESOURCE_ARRAY( OptoRegPair, argcnt );
260 _calling_convention_mask = NEW_RESOURCE_ARRAY( RegMask, argcnt );
261 uint i;
262 for( i = 0; i<argcnt; i++ ) {
263 sig_bt[i] = domain->field_at(i+TypeFunc::Parms)->basic_type();
264 }
265
266 // Pass array of ideal registers and length to USER code (from the AD file)
267 // that will convert this to an array of register numbers.
268 const StartNode *start = C->start();
269 start->calling_convention( sig_bt, vm_parm_regs, argcnt );
270 #ifdef ASSERT
271 // Sanity check users' calling convention. Real handy while trying to
272 // get the initial port correct.
273 { for (uint i = 0; i<argcnt; i++) {
274 if( !vm_parm_regs[i].first()->is_valid() && !vm_parm_regs[i].second()->is_valid() ) {
275 assert(domain->field_at(i+TypeFunc::Parms)==Type::HALF, "only allowed on halve" );
539 idealreg2mhdebugmask[Op_VecS] = &rms[31];
540 idealreg2mhdebugmask[Op_VecD] = &rms[32];
541 idealreg2mhdebugmask[Op_VecX] = &rms[33];
542 idealreg2mhdebugmask[Op_VecY] = &rms[34];
543 idealreg2mhdebugmask[Op_VecZ] = &rms[35];
544
545 idealreg2spillmask [Op_RegVectMask] = &rms[36];
546 idealreg2debugmask [Op_RegVectMask] = &rms[37];
547 idealreg2mhdebugmask[Op_RegVectMask] = &rms[38];
548
549 OptoReg::Name i;
550
551 // At first, start with the empty mask
552 C->FIRST_STACK_mask().Clear();
553
554 // Add in the incoming argument area
555 OptoReg::Name init_in = OptoReg::add(_old_SP, C->out_preserve_stack_slots());
556 for (i = init_in; i < _in_arg_limit; i = OptoReg::add(i,1)) {
557 C->FIRST_STACK_mask().Insert(i);
558 }
559
560 // Add in all bits past the outgoing argument area
561 guarantee(RegMask::can_represent_arg(OptoReg::add(_out_arg_limit,-1)),
562 "must be able to represent all call arguments in reg mask");
563 OptoReg::Name init = _out_arg_limit;
564 for (i = init; RegMask::can_represent(i); i = OptoReg::add(i,1)) {
565 C->FIRST_STACK_mask().Insert(i);
566 }
567 // Finally, set the "infinite stack" bit.
568 C->FIRST_STACK_mask().set_AllStack();
569
570 // Make spill masks. Registers for their class, plus FIRST_STACK_mask.
571 RegMask aligned_stack_mask = C->FIRST_STACK_mask();
572 // Keep spill masks aligned.
573 aligned_stack_mask.clear_to_pairs();
574 assert(aligned_stack_mask.is_AllStack(), "should be infinite stack");
575 RegMask scalable_stack_mask = aligned_stack_mask;
576
577 *idealreg2spillmask[Op_RegP] = *idealreg2regmask[Op_RegP];
578 #ifdef _LP64
579 *idealreg2spillmask[Op_RegN] = *idealreg2regmask[Op_RegN];
798 _register_save_policy[reg] == 'E' ||
799 _register_save_policy[reg] == 'A'; // Save-on-entry register?
800 }
801
802 //---------------------------Fixup_Save_On_Entry-------------------------------
803 void Matcher::Fixup_Save_On_Entry( ) {
804 init_first_stack_mask();
805
806 Node *root = C->root(); // Short name for root
807 // Count number of save-on-entry registers.
808 uint soe_cnt = number_of_saved_registers();
809 uint i;
810
811 // Find the procedure Start Node
812 StartNode *start = C->start();
813 assert( start, "Expect a start node" );
814
815 // Input RegMask array shared by all Returns.
816 // The type for doubles and longs has a count of 2, but
817 // there is only 1 returned value
818 uint ret_edge_cnt = C->tf()->range_cc()->cnt();
819 RegMask *ret_rms = init_input_masks( ret_edge_cnt + soe_cnt, _return_addr_mask, c_frame_ptr_mask );
820 for (i = TypeFunc::Parms; i < ret_edge_cnt; i++) {
821 ret_rms[i] = _return_values_mask[i-TypeFunc::Parms];
822 }
823
824 // Input RegMask array shared by all Rethrows.
825 uint reth_edge_cnt = TypeFunc::Parms+1;
826 RegMask *reth_rms = init_input_masks( reth_edge_cnt + soe_cnt, _return_addr_mask, c_frame_ptr_mask );
827 // Rethrow takes exception oop only, but in the argument 0 slot.
828 OptoReg::Name reg = find_receiver();
829 if (reg >= 0) {
830 reth_rms[TypeFunc::Parms] = mreg2regmask[reg];
831 #ifdef _LP64
832 // Need two slots for ptrs in 64-bit land
833 reth_rms[TypeFunc::Parms].Insert(OptoReg::add(OptoReg::Name(reg), 1));
834 #endif
835 }
836
837 // Input RegMask array shared by all TailCalls
838 uint tail_call_edge_cnt = TypeFunc::Parms+2;
839 RegMask *tail_call_rms = init_input_masks( tail_call_edge_cnt + soe_cnt, _return_addr_mask, c_frame_ptr_mask );
840
841 // Input RegMask array shared by all TailJumps
842 uint tail_jump_edge_cnt = TypeFunc::Parms+2;
869 }
870
871 // Input RegMask array shared by all Halts
872 uint halt_edge_cnt = TypeFunc::Parms;
873 RegMask *halt_rms = init_input_masks( halt_edge_cnt + soe_cnt, _return_addr_mask, c_frame_ptr_mask );
874
875 // Capture the return input masks into each exit flavor
876 for( i=1; i < root->req(); i++ ) {
877 MachReturnNode *exit = root->in(i)->as_MachReturn();
878 switch( exit->ideal_Opcode() ) {
879 case Op_Return : exit->_in_rms = ret_rms; break;
880 case Op_Rethrow : exit->_in_rms = reth_rms; break;
881 case Op_TailCall : exit->_in_rms = tail_call_rms; break;
882 case Op_TailJump : exit->_in_rms = tail_jump_rms; break;
883 case Op_Halt : exit->_in_rms = halt_rms; break;
884 default : ShouldNotReachHere();
885 }
886 }
887
888 // Next unused projection number from Start.
889 int proj_cnt = C->tf()->domain_cc()->cnt();
890
891 // Do all the save-on-entry registers. Make projections from Start for
892 // them, and give them a use at the exit points. To the allocator, they
893 // look like incoming register arguments.
894 for( i = 0; i < _last_Mach_Reg; i++ ) {
895 if( is_save_on_entry(i) ) {
896
897 // Add the save-on-entry to the mask array
898 ret_rms [ ret_edge_cnt] = mreg2regmask[i];
899 reth_rms [ reth_edge_cnt] = mreg2regmask[i];
900 tail_call_rms[tail_call_edge_cnt] = mreg2regmask[i];
901 tail_jump_rms[tail_jump_edge_cnt] = mreg2regmask[i];
902 // Halts need the SOE registers, but only in the stack as debug info.
903 // A just-prior uncommon-trap or deoptimization will use the SOE regs.
904 halt_rms [ halt_edge_cnt] = *idealreg2spillmask[_register_save_type[i]];
905
906 Node *mproj;
907
908 // Is this a RegF low half of a RegD? Double up 2 adjacent RegF's
909 // into a single RegD.
1141 Node *oldn = n;
1142 // Old-space or new-space check
1143 if (!C->node_arena()->contains(n)) {
1144 // Old space!
1145 Node* m;
1146 if (has_new_node(n)) { // Not yet Label/Reduced
1147 m = new_node(n);
1148 } else {
1149 if (!is_dontcare(n)) { // Matcher can match this guy
1150 // Calls match special. They match alone with no children.
1151 // Their children, the incoming arguments, match normally.
1152 m = n->is_SafePoint() ? match_sfpt(n->as_SafePoint()):match_tree(n);
1153 if (C->failing()) return NULL;
1154 if (m == NULL) { Matcher::soft_match_failure(); return NULL; }
1155 if (n->is_MemBar()) {
1156 m->as_MachMemBar()->set_adr_type(n->adr_type());
1157 }
1158 } else { // Nothing the matcher cares about
1159 if (n->is_Proj() && n->in(0) != NULL && n->in(0)->is_Multi()) { // Projections?
1160 // Convert to machine-dependent projection
1161 RegMask* mask = NULL;
1162 if (n->in(0)->is_Call() && n->in(0)->as_Call()->tf()->returns_inline_type_as_fields()) {
1163 mask = return_values_mask(n->in(0)->as_Call()->tf());
1164 }
1165 m = n->in(0)->as_Multi()->match(n->as_Proj(), this, mask);
1166 NOT_PRODUCT(record_new2old(m, n);)
1167 if (m->in(0) != NULL) // m might be top
1168 collect_null_checks(m, n);
1169 } else { // Else just a regular 'ol guy
1170 m = n->clone(); // So just clone into new-space
1171 NOT_PRODUCT(record_new2old(m, n);)
1172 // Def-Use edges will be added incrementally as Uses
1173 // of this node are matched.
1174 assert(m->outcnt() == 0, "no Uses of this clone yet");
1175 }
1176 }
1177
1178 set_new_node(n, m); // Map old to new
1179 if (_old_node_note_array != NULL) {
1180 Node_Notes* nn = C->locate_node_notes(_old_node_note_array,
1181 n->_idx);
1182 C->set_node_notes_at(m->_idx, nn);
1183 }
1184 debug_only(match_alias_type(C, n, m));
1185 }
1284 }
1285 return OptoReg::as_OptoReg(reg);
1286 }
1287
1288
1289 //------------------------------match_sfpt-------------------------------------
1290 // Helper function to match call instructions. Calls match special.
1291 // They match alone with no children. Their children, the incoming
1292 // arguments, match normally.
1293 MachNode *Matcher::match_sfpt( SafePointNode *sfpt ) {
1294 MachSafePointNode *msfpt = NULL;
1295 MachCallNode *mcall = NULL;
1296 uint cnt;
1297 // Split out case for SafePoint vs Call
1298 CallNode *call;
1299 const TypeTuple *domain;
1300 ciMethod* method = NULL;
1301 bool is_method_handle_invoke = false; // for special kill effects
1302 if( sfpt->is_Call() ) {
1303 call = sfpt->as_Call();
1304 domain = call->tf()->domain_cc();
1305 cnt = domain->cnt();
1306
1307 // Match just the call, nothing else
1308 MachNode *m = match_tree(call);
1309 if (C->failing()) return NULL;
1310 if( m == NULL ) { Matcher::soft_match_failure(); return NULL; }
1311
1312 // Copy data from the Ideal SafePoint to the machine version
1313 mcall = m->as_MachCall();
1314
1315 mcall->set_tf( call->tf());
1316 mcall->set_entry_point( call->entry_point());
1317 mcall->set_cnt( call->cnt());
1318 mcall->set_guaranteed_safepoint(call->guaranteed_safepoint());
1319
1320 if( mcall->is_MachCallJava() ) {
1321 MachCallJavaNode *mcall_java = mcall->as_MachCallJava();
1322 const CallJavaNode *call_java = call->as_CallJava();
1323 assert(call_java->validate_symbolic_info(), "inconsistent info");
1324 method = call_java->method();
1363 msfpt->_in_rms = NEW_RESOURCE_ARRAY( RegMask, cnt );
1364 // Empty them all.
1365 for (uint i = 0; i < cnt; i++) ::new (&(msfpt->_in_rms[i])) RegMask();
1366
1367 // Do all the pre-defined non-Empty register masks
1368 msfpt->_in_rms[TypeFunc::ReturnAdr] = _return_addr_mask;
1369 msfpt->_in_rms[TypeFunc::FramePtr ] = c_frame_ptr_mask;
1370
1371 // Place first outgoing argument can possibly be put.
1372 OptoReg::Name begin_out_arg_area = OptoReg::add(_new_SP, C->out_preserve_stack_slots());
1373 assert( is_even(begin_out_arg_area), "" );
1374 // Compute max outgoing register number per call site.
1375 OptoReg::Name out_arg_limit_per_call = begin_out_arg_area;
1376 // Calls to C may hammer extra stack slots above and beyond any arguments.
1377 // These are usually backing store for register arguments for varargs.
1378 if( call != NULL && call->is_CallRuntime() )
1379 out_arg_limit_per_call = OptoReg::add(out_arg_limit_per_call,C->varargs_C_out_slots_killed());
1380
1381
1382 // Do the normal argument list (parameters) register masks
1383 // Null entry point is a special cast where the target of the call
1384 // is in a register.
1385 int adj = (call != NULL && call->entry_point() == NULL) ? 1 : 0;
1386 int argcnt = cnt - TypeFunc::Parms - adj;
1387 if( argcnt > 0 ) { // Skip it all if we have no args
1388 BasicType *sig_bt = NEW_RESOURCE_ARRAY( BasicType, argcnt );
1389 VMRegPair *parm_regs = NEW_RESOURCE_ARRAY( VMRegPair, argcnt );
1390 int i;
1391 for( i = 0; i < argcnt; i++ ) {
1392 sig_bt[i] = domain->field_at(i+TypeFunc::Parms+adj)->basic_type();
1393 }
1394 // V-call to pick proper calling convention
1395 call->calling_convention( sig_bt, parm_regs, argcnt );
1396
1397 #ifdef ASSERT
1398 // Sanity check users' calling convention. Really handy during
1399 // the initial porting effort. Fairly expensive otherwise.
1400 { for (int i = 0; i<argcnt; i++) {
1401 if( !parm_regs[i].first()->is_valid() &&
1402 !parm_regs[i].second()->is_valid() ) continue;
1403 VMReg reg1 = parm_regs[i].first();
1404 VMReg reg2 = parm_regs[i].second();
1405 for (int j = 0; j < i; j++) {
1406 if( !parm_regs[j].first()->is_valid() &&
1407 !parm_regs[j].second()->is_valid() ) continue;
1408 VMReg reg3 = parm_regs[j].first();
1409 VMReg reg4 = parm_regs[j].second();
1410 if( !reg1->is_valid() ) {
1411 assert( !reg2->is_valid(), "valid halvsies" );
1412 } else if( !reg3->is_valid() ) {
1413 assert( !reg4->is_valid(), "valid halvsies" );
1414 } else {
1415 assert( reg1 != reg2, "calling conv. must produce distinct regs");
1416 assert( reg1 != reg3, "calling conv. must produce distinct regs");
1417 assert( reg1 != reg4, "calling conv. must produce distinct regs");
1418 assert( reg2 != reg3, "calling conv. must produce distinct regs");
1419 assert( reg2 != reg4 || !reg2->is_valid(), "calling conv. must produce distinct regs");
1420 assert( reg3 != reg4, "calling conv. must produce distinct regs");
1421 }
1422 }
1423 }
1424 }
1425 #endif
1426
1427 // Visit each argument. Compute its outgoing register mask.
1428 // Return results now can have 2 bits returned.
1429 // Compute max over all outgoing arguments both per call-site
1430 // and over the entire method.
1431 for( i = 0; i < argcnt; i++ ) {
1432 // Address of incoming argument mask to fill in
1433 RegMask *rm = &mcall->_in_rms[i+TypeFunc::Parms+adj];
1434 VMReg first = parm_regs[i].first();
1435 VMReg second = parm_regs[i].second();
1436 if(!first->is_valid() &&
1437 !second->is_valid()) {
1438 continue; // Avoid Halves
1439 }
1440 // Handle case where arguments are in vector registers.
1441 if(call->in(TypeFunc::Parms + i)->bottom_type()->isa_vect()) {
1442 OptoReg::Name reg_fst = OptoReg::as_OptoReg(first);
1443 OptoReg::Name reg_snd = OptoReg::as_OptoReg(second);
1444 assert (reg_fst <= reg_snd, "fst=%d snd=%d", reg_fst, reg_snd);
1445 for (OptoReg::Name r = reg_fst; r <= reg_snd; r++) {
1446 rm->Insert(r);
1447 }
1448 }
1449 // Grab first register, adjust stack slots and insert in mask.
1450 OptoReg::Name reg1 = warp_outgoing_stk_arg(first, begin_out_arg_area, out_arg_limit_per_call );
1451 if (OptoReg::is_valid(reg1)) {
1452 rm->Insert( reg1 );
1453 }
1454 // Grab second register (if any), adjust stack slots and insert in mask.
1455 OptoReg::Name reg2 = warp_outgoing_stk_arg(second, begin_out_arg_area, out_arg_limit_per_call );
1456 if (OptoReg::is_valid(reg2)) {
1457 rm->Insert( reg2 );
1458 }
1459 } // End of for all arguments
1460 }
1461
1462 // Compute the max stack slot killed by any call. These will not be
1463 // available for debug info, and will be used to adjust FIRST_STACK_mask
1464 // after all call sites have been visited.
1465 if( _out_arg_limit < out_arg_limit_per_call)
1466 _out_arg_limit = out_arg_limit_per_call;
1467
1468 if (mcall) {
1469 // Kill the outgoing argument area, including any non-argument holes and
1470 // any legacy C-killed slots. Use Fat-Projections to do the killing.
1471 // Since the max-per-method covers the max-per-call-site and debug info
1472 // is excluded on the max-per-method basis, debug info cannot land in
1473 // this killed area.
1474 uint r_cnt = mcall->tf()->range_sig()->cnt();
1475 MachProjNode *proj = new MachProjNode( mcall, r_cnt+10000, RegMask::Empty, MachProjNode::fat_proj );
1476 if (!RegMask::can_represent_arg(OptoReg::Name(out_arg_limit_per_call-1))) {
1477 C->record_method_not_compilable("unsupported outgoing calling sequence");
1478 } else {
1479 for (int i = begin_out_arg_area; i < out_arg_limit_per_call; i++)
1480 proj->_rout.Insert(OptoReg::Name(i));
1481 }
1482 if (proj->_rout.is_NotEmpty()) {
1483 push_projection(proj);
1484 }
1485 }
1486 // Transfer the safepoint information from the call to the mcall
1487 // Move the JVMState list
1488 msfpt->set_jvms(sfpt->jvms());
1489 for (JVMState* jvms = msfpt->jvms(); jvms; jvms = jvms->caller()) {
1490 jvms->set_map(sfpt);
1491 }
1492
1493 // Debug inputs begin just after the last incoming parameter
1494 assert((mcall == NULL) || (mcall->jvms() == NULL) ||
1495 (mcall->jvms()->debug_start() + mcall->_jvmadj == mcall->tf()->domain_cc()->cnt()), "");
1496
1497 // Add additional edges.
1498 if (msfpt->mach_constant_base_node_input() != (uint)-1 && !msfpt->is_MachCallLeaf()) {
1499 // For these calls we can not add MachConstantBase in expand(), as the
1500 // ins are not complete then.
1501 msfpt->ins_req(msfpt->mach_constant_base_node_input(), C->mach_constant_base_node());
1502 if (msfpt->jvms() &&
1503 msfpt->mach_constant_base_node_input() <= msfpt->jvms()->debug_start() + msfpt->_jvmadj) {
1504 // We added an edge before jvms, so we must adapt the position of the ins.
1505 msfpt->jvms()->adapt_position(+1);
1506 }
1507 }
1508
1509 // Registers killed by the call are set in the local scheduling pass
1510 // of Global Code Motion.
1511 return msfpt;
1512 }
1513
1514 //---------------------------match_tree----------------------------------------
1515 // Match a Ideal Node DAG - turn it into a tree; Label & Reduce. Used as part
2158 set_shared(n); // Flag as shared and
2159 if (n->is_DecodeNarrowPtr()) {
2160 // Oop field/array element loads must be shared but since
2161 // they are shared through a DecodeN they may appear to have
2162 // a single use so force sharing here.
2163 set_shared(n->in(1));
2164 }
2165 mstack.pop(); // remove node from stack
2166 continue;
2167 }
2168 nstate = Visit; // Not already visited; so visit now
2169 }
2170 if (nstate == Visit) {
2171 mstack.set_state(Post_Visit);
2172 set_visited(n); // Flag as visited now
2173 bool mem_op = false;
2174 int mem_addr_idx = MemNode::Address;
2175 if (find_shared_visit(mstack, n, nop, mem_op, mem_addr_idx)) {
2176 continue;
2177 }
2178 for (int i = n->len() - 1; i >= 0; --i) { // For my children
2179 Node* m = n->in(i); // Get ith input
2180 if (m == NULL) {
2181 continue; // Ignore NULLs
2182 }
2183 if (clone_node(n, m, mstack)) {
2184 continue;
2185 }
2186
2187 // Clone addressing expressions as they are "free" in memory access instructions
2188 if (mem_op && i == mem_addr_idx && m->is_AddP() &&
2189 // When there are other uses besides address expressions
2190 // put it on stack and mark as shared.
2191 !is_visited(m)) {
2192 // Some inputs for address expression are not put on stack
2193 // to avoid marking them as shared and forcing them into register
2194 // if they are used only in address expressions.
2195 // But they should be marked as shared if there are other uses
2196 // besides address expressions.
2197
2198 if (pd_clone_address_expressions(m->as_AddP(), mstack, address_visited)) {
2482 case Op_FmaD:
2483 case Op_FmaF:
2484 case Op_FmaVD:
2485 case Op_FmaVF: {
2486 // Restructure into a binary tree for Matching.
2487 Node* pair = new BinaryNode(n->in(1), n->in(2));
2488 n->set_req(2, pair);
2489 n->set_req(1, n->in(3));
2490 n->del_req(3);
2491 break;
2492 }
2493 case Op_MulAddS2I: {
2494 Node* pair1 = new BinaryNode(n->in(1), n->in(2));
2495 Node* pair2 = new BinaryNode(n->in(3), n->in(4));
2496 n->set_req(1, pair1);
2497 n->set_req(2, pair2);
2498 n->del_req(4);
2499 n->del_req(3);
2500 break;
2501 }
2502 case Op_ClearArray: {
2503 Node* pair = new BinaryNode(n->in(2), n->in(3));
2504 n->set_req(2, pair);
2505 n->set_req(3, n->in(4));
2506 n->del_req(4);
2507 break;
2508 }
2509 case Op_CopySignD:
2510 case Op_SignumVF:
2511 case Op_SignumVD:
2512 case Op_SignumF:
2513 case Op_SignumD: {
2514 Node* pair = new BinaryNode(n->in(2), n->in(3));
2515 n->set_req(2, pair);
2516 n->del_req(3);
2517 break;
2518 }
2519 case Op_VectorBlend:
2520 case Op_VectorInsert: {
2521 Node* pair = new BinaryNode(n->in(1), n->in(2));
2522 n->set_req(1, pair);
2523 n->set_req(2, n->in(3));
2524 n->del_req(3);
2525 break;
2526 }
2527 case Op_LoadVectorGatherMasked:
2528 case Op_StoreVectorScatter: {
|