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

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

Issue 23560010: Thumb2 Backend: 16-bit instruction encoding helper 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 136
137 // ----------------------------------------------------------------------------- 137 // -----------------------------------------------------------------------------
138 // Instructions encoding. 138 // Instructions encoding.
139 139
140 // Instr is merely used by the Assembler to distinguish 32bit integers 140 // Instr is merely used by the Assembler to distinguish 32bit integers
141 // representing instructions from usual 32 bit values. 141 // representing instructions from usual 32 bit values.
142 // Instruction objects are pointers to 32bit values, and provide methods to 142 // Instruction objects are pointers to 32bit values, and provide methods to
143 // access the various ISA fields. 143 // access the various ISA fields.
144 typedef int32_t Instr; 144 typedef int32_t Instr;
145 145 typedef int16_t Instr16;
rmcilroy_google 2013/09/17 17:28:16 Add a comment, as per the comment for Instr above.
146 146
147 // Opcodes for Data-processing instructions (instructions with a type 0 and 1) 147 // Opcodes for Data-processing instructions (instructions with a type 0 and 1)
148 // as defined in section A3.4 148 // as defined in section A3.4
149 enum Opcode { 149 enum Opcode {
150 AND = 0 << 21, // Logical AND. 150 AND = 0 << 21, // Logical AND.
151 EOR = 1 << 21, // Logical Exclusive OR. 151 EOR = 1 << 21, // Logical Exclusive OR.
152 SUB = 2 << 21, // Subtract. 152 SUB = 2 << 21, // Subtract.
153 RSB = 3 << 21, // Reverse Subtract. 153 RSB = 3 << 21, // Reverse Subtract.
154 ADD = 4 << 21, // Add. 154 ADD = 4 << 21, // Add.
155 ADC = 5 << 21, // Add with Carry. 155 ADC = 5 << 21, // Add with Carry.
156 SBC = 6 << 21, // Subtract with Carry. 156 SBC = 6 << 21, // Subtract with Carry.
157 RSC = 7 << 21, // Reverse Subtract with Carry. 157 RSC = 7 << 21, // Reverse Subtract with Carry.
158 TST = 8 << 21, // Test. 158 TST = 8 << 21, // Test.
159 TEQ = 9 << 21, // Test Equivalence. 159 TEQ = 9 << 21, // Test Equivalence.
160 CMP = 10 << 21, // Compare. 160 CMP = 10 << 21, // Compare.
161 CMN = 11 << 21, // Compare Negated. 161 CMN = 11 << 21, // Compare Negated.
162 ORR = 12 << 21, // Logical (inclusive) OR. 162 ORR = 12 << 21, // Logical (inclusive) OR.
163 MOV = 13 << 21, // Move. 163 MOV = 13 << 21, // Move.
164 BIC = 14 << 21, // Bit Clear. 164 BIC = 14 << 21, // Bit Clear.
165 MVN = 15 << 21 // Move Not. 165 MVN = 15 << 21 // Move Not.
166 }; 166 };
167 167
168 168
169 // NOTE: these are opcode or opB
170 enum ThumbMode1Opcode16 {
rmcilroy_google 2013/09/17 17:28:16 I'm not keen on having these multiple enums for di
171 ADD_REG_1 = 3 << 2,
172 ADD_IMM_1 = 7 << 1,
173 ADD_IMM_2 = 3 << 3,
174 SUB_REG = 13,
175 SUB_IMM_1 = 15,
176 SUB_IMM_2 = 7 << 2,
177 MOV_IMM = 4 << 2,
178 CMP_IMM = 5 << 2,
179 LSL_IMM = 0,
180 LSR_IMM = 4,
181 ROR_IMM = 3 << 2,
182 RRX_IMM = 3 << 2,
183 ASR_IMM = 8
184 };
185
186
187 // NOTE: these are opcodes
188 enum ThumbMode2Opcode16 {
189 CMP_REG_1 = 10,
190 AND_REG = 0,
191 EOR_REG = 1,
192 LSL_REG = 2,
193 LSR_REG = 3,
194 ASR_REG = 4,
195 ADC_REG = 5,
196 SBC_REG = 6,
197 ROR_REG = 7,
198 TST_REG = 8,
199 RSB_IMM = 9,
200 CMN_REG = 11,
201 ORR_REG = 12,
202 MUL_REG = 13,
203 BIC_REG = 14,
204 MVN_REG = 15
205 };
206
207
208 // NOTE: these are opcodes
209 enum ThumbMode3Opcode16 {
210 ADD_REG_2 = 0,
211 CMP_REG_2 = 4,
212 MOV_REG_1 = 8,
213 MOV_REG_2 = 0, // all zeros - so do not call mode function
214 BX_REG = 12,
215 BLX_REG = 14
216 };
217
218
219 // NOTE: for mode_4 these are opB codes
220 enum ThumbMode4_1Opcode16 {
221 STR_REG = 0,
222 STRH_REG = 1,
223 STRB_REG = 2,
224 LDR_REG_1 = 4,
225 LDR_REG_2 = 4,
226 LDRH_REG = 5,
227 LDRB_REG = 6,
228 LDRSB_REG = 3,
229 LDRSH_REG = 7
230 };
231
232
233 enum ThumbMode4_2Opcode16 {
234 LDR_IMM_1 = 4,
235 STR_IMM_1 = 0
236 };
237
238
239 enum ThumbMode4_3Opcode16 {
240 LDRB_IMM = 4,
241 STRB_IMM = 0
242 };
243
244
245 enum ThumbMode4_4Opcode16 {
246 LDRH_IMM = 4,
247 STRH_IMM = 0
248 };
249
250
251 enum ThumbMode4_5Opcode16 {
252 LDR_IMM_2 = 4,
253 STR_IMM_2 = 0
254 };
255
256
169 // The bits for bit 7-4 for some type 0 miscellaneous instructions. 257 // The bits for bit 7-4 for some type 0 miscellaneous instructions.
170 enum MiscInstructionsBits74 { 258 enum MiscInstructionsBits74 {
171 // With bits 22-21 01. 259 // With bits 22-21 01.
172 BX = 1 << 4, 260 BX = 1 << 4,
173 BXJ = 2 << 4, 261 BXJ = 2 << 4,
174 BLX = 3 << 4, 262 BLX = 3 << 4,
175 BKPT = 7 << 4, 263 BKPT = 7 << 4,
176 264
177 // With bits 22-21 11. 265 // With bits 22-21 11.
178 CLZ = 1 << 4 266 CLZ = 1 << 4
179 }; 267 };
180 268
181 269
182 // Instruction encoding bits and masks. 270 // Instruction encoding bits and masks.
183 enum { 271 enum {
184 H = 1 << 5, // Halfword (or byte). 272 H = 1 << 5, // Halfword (or byte).
185 S6 = 1 << 6, // Signed (or unsigned). 273 S6 = 1 << 6, // Signed (or unsigned).
186 L = 1 << 20, // Load (or store). 274 L = 1 << 20, // Load (or store).
187 S = 1 << 20, // Set condition code (or leave unchanged). 275 S = 1 << 20, // Set condition code (or leave unchanged).
188 W = 1 << 21, // Writeback base register (or leave unchanged). 276 W = 1 << 21, // Writeback base register (or leave unchanged).
189 A = 1 << 21, // Accumulate in multiply instruction (or not). 277 A = 1 << 21, // Accumulate in multiply instruction (or not).
190 B = 1 << 22, // Unsigned byte (or word). 278 B = 1 << 22, // Unsigned byte (or word).
191 N = 1 << 22, // Long (or short). 279 N = 1 << 22, // Long (or short).
192 U = 1 << 23, // Positive (or negative) offset/index. 280 U = 1 << 23, // Positive (or negative) offset/index.
193 P = 1 << 24, // Offset/pre-indexed addressing (or post-indexed addressing). 281 P = 1 << 24, // Offset/pre-indexed addressing (or post-indexed addressing).
194 I = 1 << 25, // Immediate shifter operand (or not). 282 I = 1 << 25, // Immediate shifter operand (or not).
195 283
284 B3 = 1 << 3,
196 B4 = 1 << 4, 285 B4 = 1 << 4,
197 B5 = 1 << 5, 286 B5 = 1 << 5,
198 B6 = 1 << 6, 287 B6 = 1 << 6,
199 B7 = 1 << 7, 288 B7 = 1 << 7,
200 B8 = 1 << 8, 289 B8 = 1 << 8,
201 B9 = 1 << 9, 290 B9 = 1 << 9,
291 B10 = 1 << 10,
292 B11 = 1 << 11,
202 B12 = 1 << 12, 293 B12 = 1 << 12,
294 B13 = 1 << 13,
295 B14 = 1 << 14,
296 B15 = 1 << 15,
203 B16 = 1 << 16, 297 B16 = 1 << 16,
204 B18 = 1 << 18, 298 B18 = 1 << 18,
205 B19 = 1 << 19, 299 B19 = 1 << 19,
206 B20 = 1 << 20, 300 B20 = 1 << 20,
207 B21 = 1 << 21, 301 B21 = 1 << 21,
208 B22 = 1 << 22, 302 B22 = 1 << 22,
209 B23 = 1 << 23, 303 B23 = 1 << 23,
210 B24 = 1 << 24, 304 B24 = 1 << 24,
211 B25 = 1 << 25, 305 B25 = 1 << 25,
212 B26 = 1 << 26, 306 B26 = 1 << 26,
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 static int Number(const char* name, bool* is_double); 855 static int Number(const char* name, bool* is_double);
762 856
763 private: 857 private:
764 static const char* names_[kNumVFPRegisters]; 858 static const char* names_[kNumVFPRegisters];
765 }; 859 };
766 860
767 861
768 } } // namespace v8::internal 862 } } // namespace v8::internal
769 863
770 #endif // V8_ARM_CONSTANTS_ARM_H_ 864 #endif // V8_ARM_CONSTANTS_ARM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698