| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 const SwVfpRegister s23 = { 23 }; | 277 const SwVfpRegister s23 = { 23 }; |
| 278 const SwVfpRegister s24 = { 24 }; | 278 const SwVfpRegister s24 = { 24 }; |
| 279 const SwVfpRegister s25 = { 25 }; | 279 const SwVfpRegister s25 = { 25 }; |
| 280 const SwVfpRegister s26 = { 26 }; | 280 const SwVfpRegister s26 = { 26 }; |
| 281 const SwVfpRegister s27 = { 27 }; | 281 const SwVfpRegister s27 = { 27 }; |
| 282 const SwVfpRegister s28 = { 28 }; | 282 const SwVfpRegister s28 = { 28 }; |
| 283 const SwVfpRegister s29 = { 29 }; | 283 const SwVfpRegister s29 = { 29 }; |
| 284 const SwVfpRegister s30 = { 30 }; | 284 const SwVfpRegister s30 = { 30 }; |
| 285 const SwVfpRegister s31 = { 31 }; | 285 const SwVfpRegister s31 = { 31 }; |
| 286 | 286 |
| 287 const DwVfpRegister no_dreg = { -1 }; |
| 287 const DwVfpRegister d0 = { 0 }; | 288 const DwVfpRegister d0 = { 0 }; |
| 288 const DwVfpRegister d1 = { 1 }; | 289 const DwVfpRegister d1 = { 1 }; |
| 289 const DwVfpRegister d2 = { 2 }; | 290 const DwVfpRegister d2 = { 2 }; |
| 290 const DwVfpRegister d3 = { 3 }; | 291 const DwVfpRegister d3 = { 3 }; |
| 291 const DwVfpRegister d4 = { 4 }; | 292 const DwVfpRegister d4 = { 4 }; |
| 292 const DwVfpRegister d5 = { 5 }; | 293 const DwVfpRegister d5 = { 5 }; |
| 293 const DwVfpRegister d6 = { 6 }; | 294 const DwVfpRegister d6 = { 6 }; |
| 294 const DwVfpRegister d7 = { 7 }; | 295 const DwVfpRegister d7 = { 7 }; |
| 295 const DwVfpRegister d8 = { 8 }; | 296 const DwVfpRegister d8 = { 8 }; |
| 296 const DwVfpRegister d9 = { 9 }; | 297 const DwVfpRegister d9 = { 9 }; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 | 381 |
| 381 // rm <shift_op> shift_imm | 382 // rm <shift_op> shift_imm |
| 382 explicit Operand(Register rm, ShiftOp shift_op, int shift_imm); | 383 explicit Operand(Register rm, ShiftOp shift_op, int shift_imm); |
| 383 | 384 |
| 384 // rm <shift_op> rs | 385 // rm <shift_op> rs |
| 385 explicit Operand(Register rm, ShiftOp shift_op, Register rs); | 386 explicit Operand(Register rm, ShiftOp shift_op, Register rs); |
| 386 | 387 |
| 387 // Return true if this is a register operand. | 388 // Return true if this is a register operand. |
| 388 INLINE(bool is_reg() const); | 389 INLINE(bool is_reg() const); |
| 389 | 390 |
| 390 // Return true of this operand fits in one instruction so that no | 391 // Return true if this operand fits in one instruction so that no |
| 391 // 2-instruction solution with a load into the ip register is necessary. | 392 // 2-instruction solution with a load into the ip register is necessary. |
| 392 bool is_single_instruction() const; | 393 bool is_single_instruction() const; |
| 393 bool must_use_constant_pool() const; | 394 bool must_use_constant_pool() const; |
| 394 | 395 |
| 395 inline int32_t immediate() const { | 396 inline int32_t immediate() const { |
| 396 ASSERT(!rm_.is_valid()); | 397 ASSERT(!rm_.is_valid()); |
| 397 return imm32_; | 398 return imm32_; |
| 398 } | 399 } |
| 399 | 400 |
| 400 Register rm() const { return rm_; } | 401 Register rm() const { return rm_; } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 // [rn +/- rm <shift_op> shift_imm]! PreIndex/NegPreIndex | 433 // [rn +/- rm <shift_op> shift_imm]! PreIndex/NegPreIndex |
| 433 // [rn], +/- rm <shift_op> shift_imm PostIndex/NegPostIndex | 434 // [rn], +/- rm <shift_op> shift_imm PostIndex/NegPostIndex |
| 434 explicit MemOperand(Register rn, Register rm, | 435 explicit MemOperand(Register rn, Register rm, |
| 435 ShiftOp shift_op, int shift_imm, AddrMode am = Offset); | 436 ShiftOp shift_op, int shift_imm, AddrMode am = Offset); |
| 436 | 437 |
| 437 void set_offset(int32_t offset) { | 438 void set_offset(int32_t offset) { |
| 438 ASSERT(rm_.is(no_reg)); | 439 ASSERT(rm_.is(no_reg)); |
| 439 offset_ = offset; | 440 offset_ = offset; |
| 440 } | 441 } |
| 441 | 442 |
| 442 uint32_t offset() { | 443 uint32_t offset() const { |
| 443 ASSERT(rm_.is(no_reg)); | 444 ASSERT(rm_.is(no_reg)); |
| 444 return offset_; | 445 return offset_; |
| 445 } | 446 } |
| 446 | 447 |
| 447 Register rn() const { return rn_; } | 448 Register rn() const { return rn_; } |
| 448 Register rm() const { return rm_; } | 449 Register rm() const { return rm_; } |
| 449 | 450 |
| 451 bool OffsetIsUint12Encodable() const { |
| 452 return offset_ >= 0 ? is_uint12(offset_) : is_uint12(-offset_); |
| 453 } |
| 454 |
| 450 private: | 455 private: |
| 451 Register rn_; // base | 456 Register rn_; // base |
| 452 Register rm_; // register offset | 457 Register rm_; // register offset |
| 453 int32_t offset_; // valid if rm_ == no_reg | 458 int32_t offset_; // valid if rm_ == no_reg |
| 454 ShiftOp shift_op_; | 459 ShiftOp shift_op_; |
| 455 int shift_imm_; // valid if rm_ != no_reg && rs_ == no_reg | 460 int shift_imm_; // valid if rm_ != no_reg && rs_ == no_reg |
| 456 AddrMode am_; // bits P, U, and W | 461 AddrMode am_; // bits P, U, and W |
| 457 | 462 |
| 458 friend class Assembler; | 463 friend class Assembler; |
| 459 }; | 464 }; |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 void tst(Register src1, Register src2, Condition cond = al) { | 740 void tst(Register src1, Register src2, Condition cond = al) { |
| 736 tst(src1, Operand(src2), cond); | 741 tst(src1, Operand(src2), cond); |
| 737 } | 742 } |
| 738 | 743 |
| 739 void teq(Register src1, const Operand& src2, Condition cond = al); | 744 void teq(Register src1, const Operand& src2, Condition cond = al); |
| 740 | 745 |
| 741 void cmp(Register src1, const Operand& src2, Condition cond = al); | 746 void cmp(Register src1, const Operand& src2, Condition cond = al); |
| 742 void cmp(Register src1, Register src2, Condition cond = al) { | 747 void cmp(Register src1, Register src2, Condition cond = al) { |
| 743 cmp(src1, Operand(src2), cond); | 748 cmp(src1, Operand(src2), cond); |
| 744 } | 749 } |
| 750 void cmp_raw_immediate(Register src1, int raw_immediate, Condition cond = al); |
| 745 | 751 |
| 746 void cmn(Register src1, const Operand& src2, Condition cond = al); | 752 void cmn(Register src1, const Operand& src2, Condition cond = al); |
| 747 | 753 |
| 748 void orr(Register dst, Register src1, const Operand& src2, | 754 void orr(Register dst, Register src1, const Operand& src2, |
| 749 SBit s = LeaveCC, Condition cond = al); | 755 SBit s = LeaveCC, Condition cond = al); |
| 750 void orr(Register dst, Register src1, Register src2, | 756 void orr(Register dst, Register src1, Register src2, |
| 751 SBit s = LeaveCC, Condition cond = al) { | 757 SBit s = LeaveCC, Condition cond = al) { |
| 752 orr(dst, src1, Operand(src2), s, cond); | 758 orr(dst, src1, Operand(src2), s, cond); |
| 753 } | 759 } |
| 754 | 760 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 LFlag l = Short); // v5 and above | 913 LFlag l = Short); // v5 and above |
| 908 | 914 |
| 909 // Support for VFP. | 915 // Support for VFP. |
| 910 // All these APIs support S0 to S31 and D0 to D15. | 916 // All these APIs support S0 to S31 and D0 to D15. |
| 911 // Currently these APIs do not support extended D registers, i.e, D16 to D31. | 917 // Currently these APIs do not support extended D registers, i.e, D16 to D31. |
| 912 // However, some simple modifications can allow | 918 // However, some simple modifications can allow |
| 913 // these APIs to support D16 to D31. | 919 // these APIs to support D16 to D31. |
| 914 | 920 |
| 915 void vldr(const DwVfpRegister dst, | 921 void vldr(const DwVfpRegister dst, |
| 916 const Register base, | 922 const Register base, |
| 917 int offset, // Offset must be a multiple of 4. | 923 int offset, |
| 924 const Condition cond = al); |
| 925 void vldr(const DwVfpRegister dst, |
| 926 const MemOperand& src, |
| 918 const Condition cond = al); | 927 const Condition cond = al); |
| 919 | 928 |
| 920 void vldr(const SwVfpRegister dst, | 929 void vldr(const SwVfpRegister dst, |
| 921 const Register base, | 930 const Register base, |
| 922 int offset, // Offset must be a multiple of 4. | 931 int offset, |
| 932 const Condition cond = al); |
| 933 void vldr(const SwVfpRegister dst, |
| 934 const MemOperand& src, |
| 923 const Condition cond = al); | 935 const Condition cond = al); |
| 924 | 936 |
| 925 void vstr(const DwVfpRegister src, | 937 void vstr(const DwVfpRegister src, |
| 926 const Register base, | 938 const Register base, |
| 927 int offset, // Offset must be a multiple of 4. | 939 int offset, |
| 940 const Condition cond = al); |
| 941 void vstr(const DwVfpRegister src, |
| 942 const MemOperand& dst, |
| 928 const Condition cond = al); | 943 const Condition cond = al); |
| 929 | 944 |
| 930 void vstr(const SwVfpRegister src, | 945 void vstr(const SwVfpRegister src, |
| 931 const Register base, | 946 const Register base, |
| 932 int offset, // Offset must be a multiple of 4. | 947 int offset, |
| 948 const Condition cond = al); |
| 949 void vstr(const SwVfpRegister src, |
| 950 const MemOperand& dst, |
| 933 const Condition cond = al); | 951 const Condition cond = al); |
| 934 | 952 |
| 935 void vmov(const DwVfpRegister dst, | 953 void vmov(const DwVfpRegister dst, |
| 936 double imm, | 954 double imm, |
| 937 const Condition cond = al); | 955 const Condition cond = al); |
| 938 void vmov(const SwVfpRegister dst, | 956 void vmov(const SwVfpRegister dst, |
| 939 const SwVfpRegister src, | 957 const SwVfpRegister src, |
| 940 const Condition cond = al); | 958 const Condition cond = al); |
| 941 void vmov(const DwVfpRegister dst, | 959 void vmov(const DwVfpRegister dst, |
| 942 const DwVfpRegister src, | 960 const DwVfpRegister src, |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 if (!allow_peephole_optimization_) return false; | 1123 if (!allow_peephole_optimization_) return false; |
| 1106 if (last_bound_pos_ > pc_offset() - instructions * kInstrSize) return false; | 1124 if (last_bound_pos_ > pc_offset() - instructions * kInstrSize) return false; |
| 1107 return reloc_info_writer.last_pc() <= pc_ - instructions * kInstrSize; | 1125 return reloc_info_writer.last_pc() <= pc_ - instructions * kInstrSize; |
| 1108 } | 1126 } |
| 1109 | 1127 |
| 1110 // Read/patch instructions | 1128 // Read/patch instructions |
| 1111 static Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); } | 1129 static Instr instr_at(byte* pc) { return *reinterpret_cast<Instr*>(pc); } |
| 1112 static void instr_at_put(byte* pc, Instr instr) { | 1130 static void instr_at_put(byte* pc, Instr instr) { |
| 1113 *reinterpret_cast<Instr*>(pc) = instr; | 1131 *reinterpret_cast<Instr*>(pc) = instr; |
| 1114 } | 1132 } |
| 1133 static Condition GetCondition(Instr instr); |
| 1115 static bool IsBranch(Instr instr); | 1134 static bool IsBranch(Instr instr); |
| 1116 static int GetBranchOffset(Instr instr); | 1135 static int GetBranchOffset(Instr instr); |
| 1117 static bool IsLdrRegisterImmediate(Instr instr); | 1136 static bool IsLdrRegisterImmediate(Instr instr); |
| 1118 static int GetLdrRegisterImmediateOffset(Instr instr); | 1137 static int GetLdrRegisterImmediateOffset(Instr instr); |
| 1119 static Instr SetLdrRegisterImmediateOffset(Instr instr, int offset); | 1138 static Instr SetLdrRegisterImmediateOffset(Instr instr, int offset); |
| 1120 static bool IsStrRegisterImmediate(Instr instr); | 1139 static bool IsStrRegisterImmediate(Instr instr); |
| 1121 static Instr SetStrRegisterImmediateOffset(Instr instr, int offset); | 1140 static Instr SetStrRegisterImmediateOffset(Instr instr, int offset); |
| 1122 static bool IsAddRegisterImmediate(Instr instr); | 1141 static bool IsAddRegisterImmediate(Instr instr); |
| 1123 static Instr SetAddRegisterImmediateOffset(Instr instr, int offset); | 1142 static Instr SetAddRegisterImmediateOffset(Instr instr, int offset); |
| 1124 static Register GetRd(Instr instr); | 1143 static Register GetRd(Instr instr); |
| 1144 static Register GetRn(Instr instr); |
| 1145 static Register GetRm(Instr instr); |
| 1125 static bool IsPush(Instr instr); | 1146 static bool IsPush(Instr instr); |
| 1126 static bool IsPop(Instr instr); | 1147 static bool IsPop(Instr instr); |
| 1127 static bool IsStrRegFpOffset(Instr instr); | 1148 static bool IsStrRegFpOffset(Instr instr); |
| 1128 static bool IsLdrRegFpOffset(Instr instr); | 1149 static bool IsLdrRegFpOffset(Instr instr); |
| 1129 static bool IsStrRegFpNegOffset(Instr instr); | 1150 static bool IsStrRegFpNegOffset(Instr instr); |
| 1130 static bool IsLdrRegFpNegOffset(Instr instr); | 1151 static bool IsLdrRegFpNegOffset(Instr instr); |
| 1131 static bool IsLdrPcImmediateOffset(Instr instr); | 1152 static bool IsLdrPcImmediateOffset(Instr instr); |
| 1153 static bool IsTstImmediate(Instr instr); |
| 1154 static bool IsCmpRegister(Instr instr); |
| 1155 static bool IsCmpImmediate(Instr instr); |
| 1156 static Register GetCmpImmediateRegister(Instr instr); |
| 1157 static int GetCmpImmediateRawImmediate(Instr instr); |
| 1132 static bool IsNop(Instr instr, int type = NON_MARKING_NOP); | 1158 static bool IsNop(Instr instr, int type = NON_MARKING_NOP); |
| 1133 | 1159 |
| 1134 // Check if is time to emit a constant pool for pending reloc info entries | 1160 // Check if is time to emit a constant pool for pending reloc info entries |
| 1135 void CheckConstPool(bool force_emit, bool require_jump); | 1161 void CheckConstPool(bool force_emit, bool require_jump); |
| 1136 | 1162 |
| 1137 protected: | 1163 protected: |
| 1138 int buffer_space() const { return reloc_info_writer.pos() - pc_; } | 1164 int buffer_space() const { return reloc_info_writer.pos() - pc_; } |
| 1139 | 1165 |
| 1140 // Read/patch instructions | 1166 // Read/patch instructions |
| 1141 Instr instr_at(int pos) { return *reinterpret_cast<Instr*>(buffer_ + pos); } | 1167 Instr instr_at(int pos) { return *reinterpret_cast<Instr*>(buffer_ + pos); } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1272 public: | 1298 public: |
| 1273 explicit EnsureSpace(Assembler* assembler) { | 1299 explicit EnsureSpace(Assembler* assembler) { |
| 1274 assembler->CheckBuffer(); | 1300 assembler->CheckBuffer(); |
| 1275 } | 1301 } |
| 1276 }; | 1302 }; |
| 1277 | 1303 |
| 1278 | 1304 |
| 1279 } } // namespace v8::internal | 1305 } } // namespace v8::internal |
| 1280 | 1306 |
| 1281 #endif // V8_ARM_ASSEMBLER_ARM_H_ | 1307 #endif // V8_ARM_ASSEMBLER_ARM_H_ |
| OLD | NEW |