< prev index next >

src/hotspot/cpu/ppc/ppc.ad

Print this page

 1525   if (ConstantsALot) {
 1526     const int num_consts = const_size();
 1527     for (int i = 0; i < num_consts; i++) {
 1528       __ long_constant(0xB0B5B00BBABE);
 1529     }
 1530   }
 1531 #endif
 1532   if (!method_is_frameless) {
 1533     // Save return pc.
 1534     __ std(return_pc, _abi0(lr), callers_sp);
 1535   }
 1536 
 1537   if (C->stub_function() == nullptr) {
 1538     BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
 1539     bs->nmethod_entry_barrier(masm, push_frame_temp);
 1540   }
 1541 
 1542   C->output()->set_frame_complete(__ offset());
 1543 }
 1544 
 1545 uint MachPrologNode::size(PhaseRegAlloc *ra_) const {
 1546   // Variable size. determine dynamically.
 1547   return MachNode::size(ra_);
 1548 }
 1549 
 1550 int MachPrologNode::reloc() const {
 1551   // Return number of relocatable values contained in this instruction.
 1552   return 1; // 1 reloc entry for load_const(toc).
 1553 }
 1554 
 1555 //=============================================================================
 1556 
 1557 #ifndef PRODUCT
 1558 void MachEpilogNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
 1559   Compile* C = ra_->C;
 1560 
 1561   st->print("EPILOG\n\t");
 1562   st->print("restore return pc\n\t");
 1563   st->print("pop frame\n\t");
 1564 
 1565   if (do_polling() && C->is_method_compilation()) {
 1566     st->print("safepoint poll\n\t");
 1567   }
 1568 }
 1569 #endif

 1588     __ addi(R1_SP, R1_SP, (int)framesize);
 1589   }
 1590 
 1591   if (StackReservedPages > 0 && C->has_reserved_stack_access()) {
 1592     __ reserved_stack_check(return_pc);
 1593   }
 1594 
 1595   if (method_needs_polling) {
 1596     Label dummy_label;
 1597     Label* code_stub = &dummy_label;
 1598     if (!UseSIGTRAP && !C->output()->in_scratch_emit_size()) {
 1599       C2SafepointPollStub* stub = new (C->comp_arena()) C2SafepointPollStub(__ offset());
 1600       C->output()->add_stub(stub);
 1601       code_stub = &stub->entry();
 1602       __ relocate(relocInfo::poll_return_type);
 1603     }
 1604     __ safepoint_poll(*code_stub, temp, true /* at_return */, true /* in_nmethod */);
 1605   }
 1606 }
 1607 
 1608 uint MachEpilogNode::size(PhaseRegAlloc *ra_) const {
 1609   // Variable size. Determine dynamically.
 1610   return MachNode::size(ra_);
 1611 }
 1612 
 1613 int MachEpilogNode::reloc() const {
 1614   // Return number of relocatable values contained in this instruction.
 1615   return 1; // 1 for load_from_polling_page.
 1616 }
 1617 
 1618 const Pipeline * MachEpilogNode::pipeline() const {
 1619   return MachNode::pipeline_class();
 1620 }
 1621 
 1622 // =============================================================================
 1623 
 1624 // Figure out which register class each belongs in: rc_int, rc_float, rc_vec or
 1625 // rc_stack.
 1626 enum RC { rc_bad, rc_int, rc_float, rc_vec, rc_stack };
 1627 
 1628 static enum RC rc_class(OptoReg::Name reg) {
 1629   // Return the register class for the given register. The given register
 1630   // reg is a <register>_num value, which is an index into the MachRegisterNumbers
 1631   // enumeration in adGlobals_ppc.hpp.
 1632 

 1942   st->print("ADDI    %s, SP, %d \t// box node", reg_str, offset);
 1943 }
 1944 #endif
 1945 
 1946 void BoxLockNode::emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const {
 1947   int offset = ra_->reg2offset(in_RegMask(0).find_first_elem());
 1948   int reg    = ra_->get_encode(this);
 1949 
 1950   if (Assembler::is_simm(offset, 16)) {
 1951     __ addi(as_Register(reg), R1, offset);
 1952   } else {
 1953     ShouldNotReachHere();
 1954   }
 1955 }
 1956 
 1957 uint BoxLockNode::size(PhaseRegAlloc *ra_) const {
 1958   // BoxLockNode is not a MachNode, so we can't just call MachNode::size(ra_).
 1959   return 4;
 1960 }
 1961 












 1962 #ifndef PRODUCT
 1963 void MachUEPNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
 1964   st->print_cr("---- MachUEPNode ----");
 1965   st->print_cr("...");
 1966 }
 1967 #endif
 1968 
 1969 void MachUEPNode::emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const {
 1970   // This is the unverified entry point.
 1971   __ ic_check(CodeEntryAlignment);
 1972   // Argument is valid and klass is as expected, continue.
 1973 }
 1974 
 1975 uint MachUEPNode::size(PhaseRegAlloc *ra_) const {
 1976   // Variable size. Determine dynamically.
 1977   return MachNode::size(ra_);
 1978 }
 1979 
 1980 //=============================================================================
 1981 
 1982 %} // interrupt source
 1983 
 1984 source_hpp %{ // Header information of the source block.
 1985 
 1986 class HandlerImpl {
 1987 
 1988  public:
 1989 
 1990   static int emit_deopt_handler(C2_MacroAssembler* masm);
 1991 
 1992   static uint size_deopt_handler() {
 1993     // The deopt_handler is a bl64_patchable.
 1994     return MacroAssembler::bl64_patchable_size + BytesPerInstWord;
 1995   }
 1996 
 1997 };
 1998 
 1999 class Node::PD {

 9694   format %{ "MR      $dst, $src \t// Long->Ptr" %}
 9695   // variable size, 0 or 4.
 9696   ins_encode %{
 9697     __ mr_if_needed($dst$$Register, $src$$Register);
 9698   %}
 9699  ins_pipe(pipe_class_default);
 9700 %}
 9701 
 9702 // Cast Pointer to Long for unsafe natives.
 9703 instruct castP2X(iRegLdst dst, iRegP_N2P src) %{
 9704   match(Set dst (CastP2X src));
 9705 
 9706   format %{ "MR      $dst, $src \t// Ptr->Long" %}
 9707   // variable size, 0 or 4.
 9708   ins_encode %{
 9709     __ mr_if_needed($dst$$Register, $src$$Register);
 9710   %}
 9711   ins_pipe(pipe_class_default);
 9712 %}
 9713 











 9714 instruct castPP(iRegPdst dst) %{
 9715   match(Set dst (CastPP dst));
 9716   format %{ " -- \t// castPP of $dst" %}
 9717   size(0);
 9718   ins_encode( /*empty*/ );
 9719   ins_pipe(pipe_class_default);
 9720 %}
 9721 
 9722 instruct castII(iRegIdst dst) %{
 9723   match(Set dst (CastII dst));
 9724   format %{ " -- \t// castII of $dst" %}
 9725   size(0);
 9726   ins_encode( /*empty*/ );
 9727   ins_pipe(pipe_class_default);
 9728 %}
 9729 
 9730 instruct castLL(iRegLdst dst) %{
 9731   match(Set dst (CastLL dst));
 9732   format %{ " -- \t// castLL of $dst" %}
 9733   size(0);

11410   size(4);
11411   ins_encode %{
11412     __ clrrdi($dst$$Register, $src$$Register, log2i_exact(-(julong)$mask$$constant));
11413   %}
11414   ins_pipe(pipe_class_default);
11415 %}
11416 
11417 // Array size computation.
11418 instruct array_size(iRegLdst dst, iRegPsrc end, iRegPsrc start) %{
11419   match(Set dst (SubL (CastP2X end) (CastP2X start)));
11420 
11421   format %{ "SUB     $dst, $end, $start \t// array size in bytes" %}
11422   size(4);
11423   ins_encode %{
11424     __ subf($dst$$Register, $start$$Register, $end$$Register);
11425   %}
11426   ins_pipe(pipe_class_default);
11427 %}
11428 
11429 // Clear-array with constant short array length. The versions below can use dcbz with cnt > 30.
11430 instruct inlineCallClearArrayShort(immLmax30 cnt, rarg2RegP base, Universe dummy, regCTR ctr) %{
11431   match(Set dummy (ClearArray cnt base));
11432   effect(USE_KILL base, KILL ctr);
11433   ins_cost(2 * MEMORY_REF_COST);
11434 
11435   format %{ "ClearArray $cnt, $base" %}
11436   ins_encode %{
11437     __ clear_memory_constlen($base$$Register, $cnt$$constant, R0); // kills base, R0
11438   %}
11439   ins_pipe(pipe_class_default);
11440 %}
11441 
11442 // Clear-array with constant large array length.
11443 instruct inlineCallClearArrayLarge(immL cnt, rarg2RegP base, Universe dummy, iRegLdst tmp, regCTR ctr) %{
11444   match(Set dummy (ClearArray cnt base));
11445   effect(USE_KILL base, TEMP tmp, KILL ctr);
11446   ins_cost(3 * MEMORY_REF_COST);
11447 
11448   format %{ "ClearArray $cnt, $base \t// KILL $tmp" %}
11449   ins_encode %{
11450     __ clear_memory_doubleword($base$$Register, $tmp$$Register, R0, $cnt$$constant); // kills base, R0
11451   %}
11452   ins_pipe(pipe_class_default);
11453 %}
11454 
11455 // Clear-array with dynamic array length.
11456 instruct inlineCallClearArray(rarg1RegL cnt, rarg2RegP base, Universe dummy, regCTR ctr) %{
11457   match(Set dummy (ClearArray cnt base));
11458   effect(USE_KILL cnt, USE_KILL base, KILL ctr);
11459   ins_cost(4 * MEMORY_REF_COST);
11460 
11461   format %{ "ClearArray $cnt, $base" %}
11462   ins_encode %{
11463     __ clear_memory_doubleword($base$$Register, $cnt$$Register, R0); // kills cnt, base, R0
11464   %}
11465   ins_pipe(pipe_class_default);
11466 %}
11467 














11468 instruct string_compareL(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt1, rarg4RegI cnt2, iRegIdst result,
11469                          iRegIdst tmp, regCTR ctr, flagsRegCR0 cr0) %{
11470   predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LL);
11471   match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
11472   effect(TEMP_DEF result, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL ctr, KILL cr0, TEMP tmp);
11473   ins_cost(300);
11474   format %{ "String Compare byte[] $str1,$cnt1,$str2,$cnt2 -> $result \t// KILL $tmp" %}
11475   ins_encode %{
11476     __ string_compare($str1$$Register, $str2$$Register,
11477                       $cnt1$$Register, $cnt2$$Register,
11478                       $tmp$$Register,
11479                       $result$$Register, StrIntrinsicNode::LL);
11480   %}
11481   ins_pipe(pipe_class_default);
11482 %}
11483 
11484 instruct string_compareU(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt1, rarg4RegI cnt2, iRegIdst result,
11485                          iRegIdst tmp, regCTR ctr, flagsRegCR0 cr0) %{
11486   predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::UU);
11487   match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));

 1525   if (ConstantsALot) {
 1526     const int num_consts = const_size();
 1527     for (int i = 0; i < num_consts; i++) {
 1528       __ long_constant(0xB0B5B00BBABE);
 1529     }
 1530   }
 1531 #endif
 1532   if (!method_is_frameless) {
 1533     // Save return pc.
 1534     __ std(return_pc, _abi0(lr), callers_sp);
 1535   }
 1536 
 1537   if (C->stub_function() == nullptr) {
 1538     BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
 1539     bs->nmethod_entry_barrier(masm, push_frame_temp);
 1540   }
 1541 
 1542   C->output()->set_frame_complete(__ offset());
 1543 }
 1544 





 1545 int MachPrologNode::reloc() const {
 1546   // Return number of relocatable values contained in this instruction.
 1547   return 1; // 1 reloc entry for load_const(toc).
 1548 }
 1549 
 1550 //=============================================================================
 1551 
 1552 #ifndef PRODUCT
 1553 void MachEpilogNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
 1554   Compile* C = ra_->C;
 1555 
 1556   st->print("EPILOG\n\t");
 1557   st->print("restore return pc\n\t");
 1558   st->print("pop frame\n\t");
 1559 
 1560   if (do_polling() && C->is_method_compilation()) {
 1561     st->print("safepoint poll\n\t");
 1562   }
 1563 }
 1564 #endif

 1583     __ addi(R1_SP, R1_SP, (int)framesize);
 1584   }
 1585 
 1586   if (StackReservedPages > 0 && C->has_reserved_stack_access()) {
 1587     __ reserved_stack_check(return_pc);
 1588   }
 1589 
 1590   if (method_needs_polling) {
 1591     Label dummy_label;
 1592     Label* code_stub = &dummy_label;
 1593     if (!UseSIGTRAP && !C->output()->in_scratch_emit_size()) {
 1594       C2SafepointPollStub* stub = new (C->comp_arena()) C2SafepointPollStub(__ offset());
 1595       C->output()->add_stub(stub);
 1596       code_stub = &stub->entry();
 1597       __ relocate(relocInfo::poll_return_type);
 1598     }
 1599     __ safepoint_poll(*code_stub, temp, true /* at_return */, true /* in_nmethod */);
 1600   }
 1601 }
 1602 





 1603 int MachEpilogNode::reloc() const {
 1604   // Return number of relocatable values contained in this instruction.
 1605   return 1; // 1 for load_from_polling_page.
 1606 }
 1607 
 1608 const Pipeline * MachEpilogNode::pipeline() const {
 1609   return MachNode::pipeline_class();
 1610 }
 1611 
 1612 // =============================================================================
 1613 
 1614 // Figure out which register class each belongs in: rc_int, rc_float, rc_vec or
 1615 // rc_stack.
 1616 enum RC { rc_bad, rc_int, rc_float, rc_vec, rc_stack };
 1617 
 1618 static enum RC rc_class(OptoReg::Name reg) {
 1619   // Return the register class for the given register. The given register
 1620   // reg is a <register>_num value, which is an index into the MachRegisterNumbers
 1621   // enumeration in adGlobals_ppc.hpp.
 1622 

 1932   st->print("ADDI    %s, SP, %d \t// box node", reg_str, offset);
 1933 }
 1934 #endif
 1935 
 1936 void BoxLockNode::emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const {
 1937   int offset = ra_->reg2offset(in_RegMask(0).find_first_elem());
 1938   int reg    = ra_->get_encode(this);
 1939 
 1940   if (Assembler::is_simm(offset, 16)) {
 1941     __ addi(as_Register(reg), R1, offset);
 1942   } else {
 1943     ShouldNotReachHere();
 1944   }
 1945 }
 1946 
 1947 uint BoxLockNode::size(PhaseRegAlloc *ra_) const {
 1948   // BoxLockNode is not a MachNode, so we can't just call MachNode::size(ra_).
 1949   return 4;
 1950 }
 1951 
 1952 #ifndef PRODUCT
 1953 void MachVEPNode::format(PhaseRegAlloc* ra_, outputStream* st) const
 1954 {
 1955   Unimplemented();
 1956 }
 1957 #endif
 1958 
 1959 void MachVEPNode::emit(C2_MacroAssembler *masm, PhaseRegAlloc* ra_) const
 1960 {
 1961   Unimplemented();
 1962 }
 1963 
 1964 #ifndef PRODUCT
 1965 void MachUEPNode::format(PhaseRegAlloc *ra_, outputStream *st) const {
 1966   st->print_cr("---- MachUEPNode ----");
 1967   st->print_cr("...");
 1968 }
 1969 #endif
 1970 
 1971 void MachUEPNode::emit(C2_MacroAssembler *masm, PhaseRegAlloc *ra_) const {
 1972   // This is the unverified entry point.
 1973   __ ic_check(CodeEntryAlignment);
 1974   // Argument is valid and klass is as expected, continue.
 1975 }
 1976 





 1977 //=============================================================================
 1978 
 1979 %} // interrupt source
 1980 
 1981 source_hpp %{ // Header information of the source block.
 1982 
 1983 class HandlerImpl {
 1984 
 1985  public:
 1986 
 1987   static int emit_deopt_handler(C2_MacroAssembler* masm);
 1988 
 1989   static uint size_deopt_handler() {
 1990     // The deopt_handler is a bl64_patchable.
 1991     return MacroAssembler::bl64_patchable_size + BytesPerInstWord;
 1992   }
 1993 
 1994 };
 1995 
 1996 class Node::PD {

 9691   format %{ "MR      $dst, $src \t// Long->Ptr" %}
 9692   // variable size, 0 or 4.
 9693   ins_encode %{
 9694     __ mr_if_needed($dst$$Register, $src$$Register);
 9695   %}
 9696  ins_pipe(pipe_class_default);
 9697 %}
 9698 
 9699 // Cast Pointer to Long for unsafe natives.
 9700 instruct castP2X(iRegLdst dst, iRegP_N2P src) %{
 9701   match(Set dst (CastP2X src));
 9702 
 9703   format %{ "MR      $dst, $src \t// Ptr->Long" %}
 9704   // variable size, 0 or 4.
 9705   ins_encode %{
 9706     __ mr_if_needed($dst$$Register, $src$$Register);
 9707   %}
 9708   ins_pipe(pipe_class_default);
 9709 %}
 9710 
 9711 instruct castN2X(iRegLdst dst, iRegNsrc src) %{
 9712   match(Set dst (CastP2X src));
 9713 
 9714   format %{ "MR      $dst, $src \t// Ptr->Long" %}
 9715   // variable size, 0 or 4.
 9716   ins_encode %{
 9717     __ mr_if_needed($dst$$Register, $src$$Register);
 9718   %}
 9719   ins_pipe(pipe_class_default);
 9720 %}
 9721 
 9722 instruct castPP(iRegPdst dst) %{
 9723   match(Set dst (CastPP dst));
 9724   format %{ " -- \t// castPP of $dst" %}
 9725   size(0);
 9726   ins_encode( /*empty*/ );
 9727   ins_pipe(pipe_class_default);
 9728 %}
 9729 
 9730 instruct castII(iRegIdst dst) %{
 9731   match(Set dst (CastII dst));
 9732   format %{ " -- \t// castII of $dst" %}
 9733   size(0);
 9734   ins_encode( /*empty*/ );
 9735   ins_pipe(pipe_class_default);
 9736 %}
 9737 
 9738 instruct castLL(iRegLdst dst) %{
 9739   match(Set dst (CastLL dst));
 9740   format %{ " -- \t// castLL of $dst" %}
 9741   size(0);

11418   size(4);
11419   ins_encode %{
11420     __ clrrdi($dst$$Register, $src$$Register, log2i_exact(-(julong)$mask$$constant));
11421   %}
11422   ins_pipe(pipe_class_default);
11423 %}
11424 
11425 // Array size computation.
11426 instruct array_size(iRegLdst dst, iRegPsrc end, iRegPsrc start) %{
11427   match(Set dst (SubL (CastP2X end) (CastP2X start)));
11428 
11429   format %{ "SUB     $dst, $end, $start \t// array size in bytes" %}
11430   size(4);
11431   ins_encode %{
11432     __ subf($dst$$Register, $start$$Register, $end$$Register);
11433   %}
11434   ins_pipe(pipe_class_default);
11435 %}
11436 
11437 // Clear-array with constant short array length. The versions below can use dcbz with cnt > 30.
11438 instruct inlineCallClearArrayShort(immLmax30 cnt, rarg2RegP base, immL_0 zero, Universe dummy, regCTR ctr) %{
11439   match(Set dummy (ClearArray (Binary cnt base) zero));
11440   effect(USE_KILL base, KILL ctr);
11441   ins_cost(2 * MEMORY_REF_COST);
11442 
11443   format %{ "ClearArray $cnt, $base" %}
11444   ins_encode %{
11445     __ clear_memory_constlen($base$$Register, $cnt$$constant, R0); // kills base, R0
11446   %}
11447   ins_pipe(pipe_class_default);
11448 %}
11449 
11450 // Clear-array with constant large array length.
11451 instruct inlineCallClearArrayLarge(immL cnt, rarg2RegP base, immL_0 zero, Universe dummy, iRegLdst tmp, regCTR ctr) %{
11452   match(Set dummy (ClearArray (Binary cnt base) zero));
11453   effect(USE_KILL base, TEMP tmp, KILL ctr);
11454   ins_cost(3 * MEMORY_REF_COST);
11455 
11456   format %{ "ClearArray $cnt, $base \t// KILL $tmp" %}
11457   ins_encode %{
11458     __ clear_memory_doubleword($base$$Register, $tmp$$Register, R0, $cnt$$constant); // kills base, R0
11459   %}
11460   ins_pipe(pipe_class_default);
11461 %}
11462 
11463 // Clear-array with dynamic array length.
11464 instruct inlineCallClearArray(rarg1RegL cnt, rarg2RegP base, immL_0 zero, Universe dummy, regCTR ctr) %{
11465   match(Set dummy (ClearArray (Binary cnt base) zero));
11466   effect(USE_KILL cnt, USE_KILL base, KILL ctr);
11467   ins_cost(4 * MEMORY_REF_COST);
11468 
11469   format %{ "ClearArray $cnt, $base" %}
11470   ins_encode %{
11471     __ clear_memory_doubleword($base$$Register, $cnt$$Register, R0); // kills cnt, base, R0
11472   %}
11473   ins_pipe(pipe_class_default);
11474 %}
11475 
11476 // Clear-array with dynamic array length and non-zero value.
11477 instruct inlineCallClearArrayWordCopy(rarg1RegL cnt, rarg2RegP base, iRegLdst val, Universe dummy, regCTR ctr) %{
11478   predicate(((ClearArrayNode*)n)->word_copy_only());
11479   match(Set dummy (ClearArray (Binary cnt base) val));
11480   effect(USE_KILL base, KILL ctr);
11481   ins_cost(8 * MEMORY_REF_COST);
11482 
11483   format %{ "ClearArray $cnt, $base, $val" %}
11484   ins_encode %{
11485     __ fill_words($base$$Register, $cnt$$Register, $val$$Register);
11486   %}
11487   ins_pipe(pipe_class_default);
11488 %}
11489 
11490 instruct string_compareL(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt1, rarg4RegI cnt2, iRegIdst result,
11491                          iRegIdst tmp, regCTR ctr, flagsRegCR0 cr0) %{
11492   predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::LL);
11493   match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
11494   effect(TEMP_DEF result, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL ctr, KILL cr0, TEMP tmp);
11495   ins_cost(300);
11496   format %{ "String Compare byte[] $str1,$cnt1,$str2,$cnt2 -> $result \t// KILL $tmp" %}
11497   ins_encode %{
11498     __ string_compare($str1$$Register, $str2$$Register,
11499                       $cnt1$$Register, $cnt2$$Register,
11500                       $tmp$$Register,
11501                       $result$$Register, StrIntrinsicNode::LL);
11502   %}
11503   ins_pipe(pipe_class_default);
11504 %}
11505 
11506 instruct string_compareU(rarg1RegP str1, rarg2RegP str2, rarg3RegI cnt1, rarg4RegI cnt2, iRegIdst result,
11507                          iRegIdst tmp, regCTR ctr, flagsRegCR0 cr0) %{
11508   predicate(((StrCompNode*)n)->encoding() == StrIntrinsicNode::UU);
11509   match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
< prev index next >