OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 // bound position. If already linked, returns the position of the prior link. | 584 // bound position. If already linked, returns the position of the prior link. |
585 // Otherwise, returns the current pc_offset(). | 585 // Otherwise, returns the current pc_offset(). |
586 int link(Label* L); | 586 int link(Label* L); |
587 | 587 |
588 // Determines if Label is bound and near enough so that a single | 588 // Determines if Label is bound and near enough so that a single |
589 // branch instruction can be used to reach it. | 589 // branch instruction can be used to reach it. |
590 bool is_near(Label* L, Condition cond); | 590 bool is_near(Label* L, Condition cond); |
591 | 591 |
592 // Returns the branch offset to the given label from the current code position | 592 // Returns the branch offset to the given label from the current code position |
593 // Links the label to the current position if it is still unbound | 593 // Links the label to the current position if it is still unbound |
594 // Manages the jump elimination optimization if the second parameter is true. | 594 int branch_offset(Label* L) { |
595 int branch_offset(Label* L, bool jump_elimination_allowed) { | |
596 int position = link(L); | 595 int position = link(L); |
597 return position - pc_offset(); | 596 return position - pc_offset(); |
598 } | 597 } |
599 | 598 |
600 // Puts a labels target address at the given position. | 599 // Puts a labels target address at the given position. |
601 // The high 8 bits are set to zero. | 600 // The high 8 bits are set to zero. |
602 void label_at_put(Label* L, int at_offset); | 601 void label_at_put(Label* L, int at_offset); |
603 | 602 |
604 INLINE(static bool IsConstantPoolLoadStart( | 603 INLINE(static bool IsConstantPoolLoadStart( |
605 Address pc, ConstantPoolEntry::Access* access = nullptr)); | 604 Address pc, ConstantPoolEntry::Access* access = nullptr)); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 void bclr(BOfield bo, LKBit lk); | 745 void bclr(BOfield bo, LKBit lk); |
747 void blr(); | 746 void blr(); |
748 void bc(int branch_offset, BOfield bo, int condition_bit, LKBit lk = LeaveLK); | 747 void bc(int branch_offset, BOfield bo, int condition_bit, LKBit lk = LeaveLK); |
749 void b(int branch_offset, LKBit lk); | 748 void b(int branch_offset, LKBit lk); |
750 | 749 |
751 void bcctr(BOfield bo, LKBit lk); | 750 void bcctr(BOfield bo, LKBit lk); |
752 void bctr(); | 751 void bctr(); |
753 void bctrl(); | 752 void bctrl(); |
754 | 753 |
755 // Convenience branch instructions using labels | 754 // Convenience branch instructions using labels |
756 void b(Label* L, LKBit lk = LeaveLK) { b(branch_offset(L, false), lk); } | 755 void b(Label* L, LKBit lk = LeaveLK) { b(branch_offset(L), lk); } |
757 | 756 |
758 inline CRegister cmpi_optimization(CRegister cr) { | 757 inline CRegister cmpi_optimization(CRegister cr) { |
759 // Check whether the branch is preceeded by an optimizable cmpi against 0. | 758 // Check whether the branch is preceeded by an optimizable cmpi against 0. |
760 // The cmpi can be deleted if it is also preceeded by an instruction that | 759 // The cmpi can be deleted if it is also preceeded by an instruction that |
761 // sets the register used by the compare and supports a dot form. | 760 // sets the register used by the compare and supports a dot form. |
762 unsigned int sradi_mask = kOpcodeMask | kExt2OpcodeVariant2Mask; | 761 unsigned int sradi_mask = kOpcodeMask | kExt2OpcodeVariant2Mask; |
763 unsigned int srawi_mask = kOpcodeMask | kExt2OpcodeMask; | 762 unsigned int srawi_mask = kOpcodeMask | kExt2OpcodeMask; |
764 int pos = pc_offset(); | 763 int pos = pc_offset(); |
765 int cmpi_pos = pc_offset() - kInstrSize; | 764 int cmpi_pos = pc_offset() - kInstrSize; |
766 | 765 |
(...skipping 24 matching lines...) Expand all Loading... |
791 return cr; | 790 return cr; |
792 } | 791 } |
793 | 792 |
794 void bc_short(Condition cond, Label* L, CRegister cr = cr7, | 793 void bc_short(Condition cond, Label* L, CRegister cr = cr7, |
795 LKBit lk = LeaveLK) { | 794 LKBit lk = LeaveLK) { |
796 DCHECK(cond != al); | 795 DCHECK(cond != al); |
797 DCHECK(cr.code() >= 0 && cr.code() <= 7); | 796 DCHECK(cr.code() >= 0 && cr.code() <= 7); |
798 | 797 |
799 cr = cmpi_optimization(cr); | 798 cr = cmpi_optimization(cr); |
800 | 799 |
801 int b_offset = branch_offset(L, false); | 800 int b_offset = branch_offset(L); |
802 | 801 |
803 switch (cond) { | 802 switch (cond) { |
804 case eq: | 803 case eq: |
805 bc(b_offset, BT, encode_crbit(cr, CR_EQ), lk); | 804 bc(b_offset, BT, encode_crbit(cr, CR_EQ), lk); |
806 break; | 805 break; |
807 case ne: | 806 case ne: |
808 bc(b_offset, BF, encode_crbit(cr, CR_EQ), lk); | 807 bc(b_offset, BF, encode_crbit(cr, CR_EQ), lk); |
809 break; | 808 break; |
810 case gt: | 809 case gt: |
811 bc(b_offset, BT, encode_crbit(cr, CR_GT), lk); | 810 bc(b_offset, BT, encode_crbit(cr, CR_GT), lk); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 } | 923 } |
925 void boverflow(Label* L, CRegister cr = cr0, LKBit lk = LeaveLK) { | 924 void boverflow(Label* L, CRegister cr = cr0, LKBit lk = LeaveLK) { |
926 b(overflow, L, cr, lk); | 925 b(overflow, L, cr, lk); |
927 } | 926 } |
928 void bnooverflow(Label* L, CRegister cr = cr0, LKBit lk = LeaveLK) { | 927 void bnooverflow(Label* L, CRegister cr = cr0, LKBit lk = LeaveLK) { |
929 b(nooverflow, L, cr, lk); | 928 b(nooverflow, L, cr, lk); |
930 } | 929 } |
931 | 930 |
932 // Decrement CTR; branch if CTR != 0 | 931 // Decrement CTR; branch if CTR != 0 |
933 void bdnz(Label* L, LKBit lk = LeaveLK) { | 932 void bdnz(Label* L, LKBit lk = LeaveLK) { |
934 bc(branch_offset(L, false), DCBNZ, 0, lk); | 933 bc(branch_offset(L), DCBNZ, 0, lk); |
935 } | 934 } |
936 | 935 |
937 // Data-processing instructions | 936 // Data-processing instructions |
938 | 937 |
939 void sub(Register dst, Register src1, Register src2, OEBit s = LeaveOE, | 938 void sub(Register dst, Register src1, Register src2, OEBit s = LeaveOE, |
940 RCBit r = LeaveRC); | 939 RCBit r = LeaveRC); |
941 | 940 |
942 void subfic(Register dst, Register src, const Operand& imm); | 941 void subfic(Register dst, Register src, const Operand& imm); |
943 | 942 |
944 void subfc(Register dst, Register src1, Register src2, OEBit s = LeaveOE, | 943 void subfc(Register dst, Register src1, Register src2, OEBit s = LeaveOE, |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1581 | 1580 |
1582 | 1581 |
1583 class EnsureSpace BASE_EMBEDDED { | 1582 class EnsureSpace BASE_EMBEDDED { |
1584 public: | 1583 public: |
1585 explicit EnsureSpace(Assembler* assembler) { assembler->CheckBuffer(); } | 1584 explicit EnsureSpace(Assembler* assembler) { assembler->CheckBuffer(); } |
1586 }; | 1585 }; |
1587 } | 1586 } |
1588 } // namespace v8::internal | 1587 } // namespace v8::internal |
1589 | 1588 |
1590 #endif // V8_PPC_ASSEMBLER_PPC_H_ | 1589 #endif // V8_PPC_ASSEMBLER_PPC_H_ |
OLD | NEW |