Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: src/arm/assembler-arm.h

Issue 23530065: Thumb2 Backend: Branch, load, store, misc. instruction encoding methods Base URL: HEAD^
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/arm/assembler-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 817
818 // Insert the smallest number of nop instructions 818 // Insert the smallest number of nop instructions
819 // possible to align the pc offset to a multiple 819 // possible to align the pc offset to a multiple
820 // of m. m must be a power of 2 (>= 4). 820 // of m. m must be a power of 2 (>= 4).
821 void Align(int m); 821 void Align(int m);
822 // Aligns code to something that's optimal for a jump target for the platform. 822 // Aligns code to something that's optimal for a jump target for the platform.
823 void CodeTargetAlign(); 823 void CodeTargetAlign();
824 824
825 // Branch instructions 825 // Branch instructions
826 void b(int branch_offset, Condition cond = al); 826 void b(int branch_offset, Condition cond = al);
827 void b_thumb(int branch_offset, Condition cond);
827 void bl(int branch_offset, Condition cond = al); 828 void bl(int branch_offset, Condition cond = al);
828 void blx(int branch_offset); // v5 and above 829 void blx(int branch_offset); // v5 and above
829 void blx(Register target, Condition cond = al); // v5 and above 830 void blx(Register target, Condition cond = al); // v5 and above
830 void bx(Register target, Condition cond = al); // v5 and above, plus v4t 831 void bx(Register target, Condition cond = al); // v5 and above, plus v4t
831 832
832 // Convenience branch instructions using labels 833 // Convenience branch instructions using labels
833 void b(Label* L, Condition cond = al) { 834 void b(Label* L, Condition cond = al) {
834 b(branch_offset(L, cond == al), cond); 835 b(branch_offset(L, cond == al), cond);
835 } 836 }
836 void b(Condition cond, Label* L) { b(branch_offset(L, cond == al), cond); } 837 void b(Condition cond, Label* L) { b(branch_offset(L, cond == al), cond); }
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 uint32_t i, uint32_t imm3, uint32_t imm8); 1017 uint32_t i, uint32_t imm3, uint32_t imm8);
1017 void mvn_reg_t2(Register dst, const Operand& src, 1018 void mvn_reg_t2(Register dst, const Operand& src,
1018 SBit s, Condition cond); 1019 SBit s, Condition cond);
1019 void mvn_thumb(Register dst, const Operand& src, 1020 void mvn_thumb(Register dst, const Operand& src,
1020 SBit s, Condition cond); 1021 SBit s, Condition cond);
1021 1022
1022 // Multiply instructions 1023 // Multiply instructions
1023 1024
1024 void mla(Register dst, Register src1, Register src2, Register srcA, 1025 void mla(Register dst, Register src1, Register src2, Register srcA,
1025 SBit s = LeaveCC, Condition cond = al); 1026 SBit s = LeaveCC, Condition cond = al);
1027 void mla_thumb(Register dst, Register src1, Register src2, Register srcA,
1028 SBit s, Condition cond);
1026 1029
1027 void mls(Register dst, Register src1, Register src2, Register srcA, 1030 void mls(Register dst, Register src1, Register src2, Register srcA,
1028 Condition cond = al); 1031 Condition cond = al);
1032 void mls_thumb(Register dst, Register src1, Register src2, Register srcA,
1033 Condition cond);
1029 1034
1030 void sdiv(Register dst, Register src1, Register src2, 1035 void sdiv(Register dst, Register src1, Register src2,
1031 Condition cond = al); 1036 Condition cond = al);
1037 void sdiv_thumb(Register dst, Register src1, Register src2,
1038 Condition cond);
1032 1039
1033 void mul(Register dst, Register src1, Register src2, 1040 void mul(Register dst, Register src1, Register src2,
1034 SBit s = LeaveCC, Condition cond = al); 1041 SBit s = LeaveCC, Condition cond = al);
1035 void mul_t2(Register dst, Register src1, Register src2, 1042 void mul_t2(Register dst, Register src1, Register src2,
1036 SBit s, Condition cond); 1043 SBit s, Condition cond);
1037 void mul_thumb(Register dst, Register src1, Register src2, 1044 void mul_thumb(Register dst, Register src1, Register src2,
1038 SBit s, Condition cond); 1045 SBit s, Condition cond);
1039 1046
1040 void smlal(Register dstL, Register dstH, Register src1, Register src2, 1047 void smlal(Register dstL, Register dstH, Register src1, Register src2,
1041 SBit s = LeaveCC, Condition cond = al); 1048 SBit s = LeaveCC, Condition cond = al);
1049 void smlal_thumb(Register dstL, Register dstH, Register src1, Register src2,
1050 SBit s, Condition cond);
1042 1051
1043 void smull(Register dstL, Register dstH, Register src1, Register src2, 1052 void smull(Register dstL, Register dstH, Register src1, Register src2,
1044 SBit s = LeaveCC, Condition cond = al); 1053 SBit s = LeaveCC, Condition cond = al);
1054 void smull_thumb(Register dstL, Register dstH, Register src1, Register src2,
1055 SBit s, Condition cond);
1045 1056
1046 void umlal(Register dstL, Register dstH, Register src1, Register src2, 1057 void umlal(Register dstL, Register dstH, Register src1, Register src2,
1047 SBit s = LeaveCC, Condition cond = al); 1058 SBit s = LeaveCC, Condition cond = al);
1059 void umlal_thumb(Register dstL, Register dstH, Register src1, Register src2,
1060 SBit s, Condition cond);
1048 1061
1049 void umull(Register dstL, Register dstH, Register src1, Register src2, 1062 void umull(Register dstL, Register dstH, Register src1, Register src2,
1050 SBit s = LeaveCC, Condition cond = al); 1063 SBit s = LeaveCC, Condition cond = al);
1064 void umull_thumb(Register dstL, Register dstH, Register src1, Register src2,
1065 SBit s, Condition cond);
1051 1066
1052 // Miscellaneous arithmetic instructions 1067 // Miscellaneous arithmetic instructions
1053 1068
1054 void clz(Register dst, Register src, Condition cond = al); // v5 and above 1069 void clz(Register dst, Register src, Condition cond = al); // v5 and above
1055 1070
1056 // Saturating instructions. v6 and above. 1071 // Saturating instructions. v6 and above.
1057 1072
1058 // Unsigned saturate. 1073 // Unsigned saturate.
1059 // 1074 //
1060 // Saturate an optionally shifted signed value to an unsigned range. 1075 // Saturate an optionally shifted signed value to an unsigned range.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 1113
1099 void uxtb16(Register dst, const Operand& src, Condition cond = al); 1114 void uxtb16(Register dst, const Operand& src, Condition cond = al);
1100 1115
1101 // Status register access instructions 1116 // Status register access instructions
1102 1117
1103 void mrs(Register dst, SRegister s, Condition cond = al); 1118 void mrs(Register dst, SRegister s, Condition cond = al);
1104 void msr(SRegisterFieldMask fields, const Operand& src, Condition cond = al); 1119 void msr(SRegisterFieldMask fields, const Operand& src, Condition cond = al);
1105 1120
1106 // Load/Store instructions 1121 // Load/Store instructions
1107 void ldr(Register dst, const MemOperand& src, Condition cond = al); 1122 void ldr(Register dst, const MemOperand& src, Condition cond = al);
1123 void ldr_thumb(Register dst, const MemOperand& src);
1124 void ldr_thumb_immediate(Register dst, const MemOperand& src);
1125 void ldr_thumb_register(Register dst, const MemOperand& src);
1126
1108 void str(Register src, const MemOperand& dst, Condition cond = al); 1127 void str(Register src, const MemOperand& dst, Condition cond = al);
1128 void str_thumb(Register src, const MemOperand& dst);
1129 void str_thumb_register(Register src, const MemOperand& dst);
1130 void str_thumb_immediate(Register src, const MemOperand& dst);
1131
1109 void ldrb(Register dst, const MemOperand& src, Condition cond = al); 1132 void ldrb(Register dst, const MemOperand& src, Condition cond = al);
1133 void ldrb_thumb_immediate(Register dst, const MemOperand& src);
1134 void ldrb_thumb_register(Register dst, const MemOperand& src);
1135 void ldrb_thumb(Register dst, const MemOperand& src);
1136
1110 void strb(Register src, const MemOperand& dst, Condition cond = al); 1137 void strb(Register src, const MemOperand& dst, Condition cond = al);
1138 void strb_thumb_immediate(Register src, const MemOperand& dst);
1139 void strb_thumb_register(Register src, const MemOperand& dst);
1140 void strb_thumb(Register src, const MemOperand& dst);
1141
1111 void ldrh(Register dst, const MemOperand& src, Condition cond = al); 1142 void ldrh(Register dst, const MemOperand& src, Condition cond = al);
1143 void ldrh_thumb_immediate(Register dst, const MemOperand& src);
1144 void ldrh_thumb_register(Register dst, const MemOperand& src);
1145 void ldrh_thumb(Register dst, const MemOperand& src);
1146
1112 void strh(Register src, const MemOperand& dst, Condition cond = al); 1147 void strh(Register src, const MemOperand& dst, Condition cond = al);
1148 void strh_thumb_immediate(Register src, const MemOperand& dst); // 4_4
1149 void strh_thumb_register(Register src, const MemOperand& dst); // 4_1
1150 void strh_thumb(Register src, const MemOperand& dst);
1151
1113 void ldrsb(Register dst, const MemOperand& src, Condition cond = al); 1152 void ldrsb(Register dst, const MemOperand& src, Condition cond = al);
1153 void ldrsb_thumb_immediate(Register dst, const MemOperand& src);
1154 void ldrsb_thumb_register(Register dst, const MemOperand& src);
1155 void ldrsb_thumb(Register dst, const MemOperand& src);
1156
1114 void ldrsh(Register dst, const MemOperand& src, Condition cond = al); 1157 void ldrsh(Register dst, const MemOperand& src, Condition cond = al);
1158 void ldrsh_thumb(Register dst, const MemOperand& src);
1159 void ldrsh_thumb_immediate(Register dst, const MemOperand& src);
1160 void ldrsh_thumb_register(Register dst, const MemOperand& src);
1161
1115 void ldrd(Register dst1, 1162 void ldrd(Register dst1,
1116 Register dst2, 1163 Register dst2,
1117 const MemOperand& src, Condition cond = al); 1164 const MemOperand& src, Condition cond = al);
1118 void ldrd_imm_t1(Register dst1, 1165 void ldrd_imm_t1(Register dst1,
1119 Register dst2, 1166 Register dst2,
1120 const MemOperand& src); 1167 const MemOperand& src);
1121 void strd(Register src1, 1168 void strd(Register src1,
1122 Register src2, 1169 Register src2,
1123 const MemOperand& dst, Condition cond = al); 1170 const MemOperand& dst, Condition cond = al);
1124 void strd_imm_t1(Register src1, 1171 void strd_imm_t1(Register src1,
1125 Register src2, 1172 Register src2,
1126 const MemOperand& dst); 1173 const MemOperand& dst);
1127 1174
1128 // Preload instructions 1175 // Preload instructions
1129 void pld(const MemOperand& address); 1176 void pld(const MemOperand& address);
1130 1177
1131 // Load/Store multiple instructions 1178 // Load/Store multiple instructions
1132 void ldm(BlockAddrMode am, Register base, RegList dst, Condition cond = al); 1179 void ldm(BlockAddrMode am, Register base, RegList dst, Condition cond = al);
1180 void ldm_thumb(BlockAddrMode am, Register base, RegList dst, Condition cond);
1181
1133 void stm(BlockAddrMode am, Register base, RegList src, Condition cond = al); 1182 void stm(BlockAddrMode am, Register base, RegList src, Condition cond = al);
1183 void stm_thumb(BlockAddrMode am, Register base, RegList dst, Condition cond);
1134 1184
1135 // Exception-generating instructions and debugging support 1185 // Exception-generating instructions and debugging support
1136 void stop(const char* msg, 1186 void stop(const char* msg,
1137 Condition cond = al, 1187 Condition cond = al,
1138 int32_t code = kDefaultStopCode); 1188 int32_t code = kDefaultStopCode);
1139 1189
1140 void bkpt(uint32_t imm16); // v5 and above 1190 void bkpt(uint32_t imm16); // v5 and above
1141 void svc(uint32_t imm24, Condition cond = al); 1191 void svc(uint32_t imm24, Condition cond = al);
1142 1192
1143 // Coprocessor instructions 1193 // Coprocessor instructions
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 void pop() { 1432 void pop() {
1383 add(sp, sp, Operand(kPointerSize)); 1433 add(sp, sp, Operand(kPointerSize));
1384 } 1434 }
1385 1435
1386 // Jump unconditionally to given label. 1436 // Jump unconditionally to given label.
1387 void jmp(Label* L) { b(L, al); } 1437 void jmp(Label* L) { b(L, al); }
1388 1438
1389 void it_thumb(Condition cond, int num_instr, bool cond2 = false, 1439 void it_thumb(Condition cond, int num_instr, bool cond2 = false,
1390 bool cond3 = false, bool cond4 = false); 1440 bool cond3 = false, bool cond4 = false);
1391 inline void emit_it(Condition cond); 1441 inline void emit_it(Condition cond);
1442 void ldr_pc_thumb(Register dst, const Operand& src);
1392 1443
1393 static bool use_immediate_embedded_pointer_loads( 1444 static bool use_immediate_embedded_pointer_loads(
1394 const Assembler* assembler) { 1445 const Assembler* assembler) {
1395 return CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS) && 1446 return CpuFeatures::IsSupported(MOVW_MOVT_IMMEDIATE_LOADS) &&
1396 (assembler == NULL || !assembler->predictable_code_size()); 1447 (assembler == NULL || !assembler->predictable_code_size());
1397 } 1448 }
1398 1449
1399 // Check the code size generated from label to here. 1450 // Check the code size generated from label to here.
1400 int SizeOfCodeGeneratedSince(Label* label) { 1451 int SizeOfCodeGeneratedSince(Label* label) {
1401 return pc_offset() - label->pos(); 1452 return pc_offset() - label->pos();
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 void GrowBuffer(); 1707 void GrowBuffer();
1657 inline void emit(Instr x); 1708 inline void emit(Instr x);
1658 inline void emit16(Instr16 x, bool check_buffer = true); 1709 inline void emit16(Instr16 x, bool check_buffer = true);
1659 inline void emit32(Instr x); // proper half-word order for thumb 1710 inline void emit32(Instr x); // proper half-word order for thumb
1660 1711
1661 // 32-bit immediate values 1712 // 32-bit immediate values
1662 void move_32_bit_immediate(Condition cond, 1713 void move_32_bit_immediate(Condition cond,
1663 Register rd, 1714 Register rd,
1664 SBit s, 1715 SBit s,
1665 const Operand& x); 1716 const Operand& x);
1717 void move_32_bit_immediate_thumb(Register rd,
1718 SBit s,
1719 const Operand& x,
1720 Condition cond = al);
1666 1721
1667 // Instruction generation 1722 // Instruction generation
1668 void addrmod1(Instr instr, Register rn, Register rd, const Operand& x); 1723 void addrmod1(Instr instr, Register rn, Register rd, const Operand& x);
1669 void addrmod2(Instr instr, Register rd, const MemOperand& x); 1724 void addrmod2(Instr instr, Register rd, const MemOperand& x);
1670 void addrmod3(Instr instr, Register rd, const MemOperand& x); 1725 void addrmod3(Instr instr, Register rd, const MemOperand& x);
1671 void addrmod4(Instr instr, Register rn, RegList rl); 1726 void addrmod4(Instr instr, Register rn, RegList rl);
1672 void addrmod5(Instr instr, CRegister crd, const MemOperand& x); 1727 void addrmod5(Instr instr, CRegister crd, const MemOperand& x);
1673 1728
1674 Instr16 thumb16_mode1(ThumbMode1Opcode16 op); // A6.2.1 -> mode1 1729 Instr16 thumb16_mode1(ThumbMode1Opcode16 op); // A6.2.1 -> mode1
1675 Instr16 thumb16_mode2(ThumbMode2Opcode16 op); // A6.2.2 -> mode2 1730 Instr16 thumb16_mode2(ThumbMode2Opcode16 op); // A6.2.2 -> mode2
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1803 public: 1858 public:
1804 explicit EnsureSpace(Assembler* assembler) { 1859 explicit EnsureSpace(Assembler* assembler) {
1805 assembler->CheckBuffer(); 1860 assembler->CheckBuffer();
1806 } 1861 }
1807 }; 1862 };
1808 1863
1809 1864
1810 } } // namespace v8::internal 1865 } } // namespace v8::internal
1811 1866
1812 #endif // V8_ARM_ASSEMBLER_ARM_H_ 1867 #endif // V8_ARM_ASSEMBLER_ARM_H_
OLDNEW
« no previous file with comments | « no previous file | src/arm/assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698