430 int j;
431 // Find the branch; ignore trailing NOPs.
432 for( j = b->_nodes.size()-1; j>=0; j-- ) {
433 nj = b->_nodes[j];
434 if( !nj->is_Mach() || nj->as_Mach()->ideal_Opcode() != Op_Con )
435 break;
436 }
437
438 if (j >= 0) {
439 if( nj->is_Mach() && nj->as_Mach()->may_be_short_branch() ) {
440 MachNode *mach = nj->as_Mach();
441 // This requires the TRUE branch target be in succs[0]
442 uint bnum = b->non_connector_successor(0)->_pre_order;
443 uintptr_t target = blk_starts[bnum];
444 if( mach->is_pc_relative() ) {
445 int offset = target-(blk_starts[i] + jmp_end[i]);
446 if (_matcher->is_short_branch_offset(offset)) {
447 // We've got a winner. Replace this branch.
448 MachNode *replacement = mach->short_branch_version(this);
449 b->_nodes.map(j, replacement);
450
451 // Update the jmp_end size to save time in our
452 // next pass.
453 jmp_end[i] -= (mach->size(_regalloc) - replacement->size(_regalloc));
454 DEBUG_ONLY( jmp_target[i] = bnum; );
455 }
456 } else {
457 #ifndef PRODUCT
458 mach->dump(3);
459 #endif
460 Unimplemented();
461 }
462 }
463 }
464 }
465
466 // Compute the size of first NumberOfLoopInstrToAlign instructions at head
467 // of a loop. It is used to determine the padding for loop alignment.
468 compute_loop_first_inst_sizes();
469
|
430 int j;
431 // Find the branch; ignore trailing NOPs.
432 for( j = b->_nodes.size()-1; j>=0; j-- ) {
433 nj = b->_nodes[j];
434 if( !nj->is_Mach() || nj->as_Mach()->ideal_Opcode() != Op_Con )
435 break;
436 }
437
438 if (j >= 0) {
439 if( nj->is_Mach() && nj->as_Mach()->may_be_short_branch() ) {
440 MachNode *mach = nj->as_Mach();
441 // This requires the TRUE branch target be in succs[0]
442 uint bnum = b->non_connector_successor(0)->_pre_order;
443 uintptr_t target = blk_starts[bnum];
444 if( mach->is_pc_relative() ) {
445 int offset = target-(blk_starts[i] + jmp_end[i]);
446 if (_matcher->is_short_branch_offset(offset)) {
447 // We've got a winner. Replace this branch.
448 MachNode *replacement = mach->short_branch_version(this);
449 b->_nodes.map(j, replacement);
450 mach->subsume_by(replacement);
451
452 // Update the jmp_end size to save time in our
453 // next pass.
454 jmp_end[i] -= (mach->size(_regalloc) - replacement->size(_regalloc));
455 DEBUG_ONLY( jmp_target[i] = bnum; );
456 }
457 } else {
458 #ifndef PRODUCT
459 mach->dump(3);
460 #endif
461 Unimplemented();
462 }
463 }
464 }
465 }
466
467 // Compute the size of first NumberOfLoopInstrToAlign instructions at head
468 // of a loop. It is used to determine the padding for loop alignment.
469 compute_loop_first_inst_sizes();
470
|