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