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

Side by Side Diff: runtime/vm/constants_arm64.h

Issue 227593012: Adds ldr and str to arm64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/assembler_arm64_test.cc ('k') | runtime/vm/disassembler_arm64.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_CONSTANTS_ARM64_H_ 5 #ifndef VM_CONSTANTS_ARM64_H_
6 #define VM_CONSTANTS_ARM64_H_ 6 #define VM_CONSTANTS_ARM64_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 29 matching lines...) Expand all
40 R25 = 25, // IP0 40 R25 = 25, // IP0
41 R26 = 26, // IP1 41 R26 = 26, // IP1
42 R27 = 27, // PP 42 R27 = 27, // PP
43 R28 = 28, // CTX 43 R28 = 28, // CTX
44 R29 = 29, // FP 44 R29 = 29, // FP
45 R30 = 30, // LR 45 R30 = 30, // LR
46 R31 = 31, // ZR, SP 46 R31 = 31, // ZR, SP
47 kNumberOfCpuRegisters = 32, 47 kNumberOfCpuRegisters = 32,
48 kNoRegister = -1, 48 kNoRegister = -1,
49 49
50 // These registers both use the encoding R31, but to avoid mistakes we give
51 // them different values, and then translate before encoding.
52 SP = 32,
53 ZR = 33,
54
50 // Aliases. 55 // Aliases.
51 IP0 = R25, 56 IP0 = R25,
52 IP1 = R26, 57 IP1 = R26,
53 FP = R29, 58 FP = R29,
54 LR = R30, 59 LR = R30,
55
56 // Left abstract so we can avoid misuse.
57 SP,
58 ZR,
59 }; 60 };
60 61
61 enum VRegister { 62 enum VRegister {
62 V0 = 0, 63 V0 = 0,
63 V1 = 1, 64 V1 = 1,
64 V2 = 2, 65 V2 = 2,
65 V3 = 3, 66 V3 = 3,
66 V4 = 4, 67 V4 = 4,
67 V5 = 5, 68 V5 = 5,
68 V6 = 6, 69 V6 = 6,
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 kUnsignedByte, 208 kUnsignedByte,
208 kHalfword, 209 kHalfword,
209 kUnsignedHalfword, 210 kUnsignedHalfword,
210 kWord, 211 kWord,
211 kUnsignedWord, 212 kUnsignedWord,
212 kDoubleWord, 213 kDoubleWord,
213 kSWord, 214 kSWord,
214 kDWord, 215 kDWord,
215 }; 216 };
216 217
218 static inline int Log2OperandSizeBytes(OperandSize os) {
219 switch (os) {
220 case kByte:
221 case kUnsignedByte:
222 return 0;
223 case kHalfword:
224 case kUnsignedHalfword:
225 return 1;
226 case kWord:
227 case kUnsignedWord:
228 case kSWord:
229 return 2;
230 case kDoubleWord:
231 case kDWord:
232 return 3;
233 default:
234 UNREACHABLE();
235 break;
236 }
237 return -1;
238 }
239
217 // Opcodes from C3 240 // Opcodes from C3
218 // C3.1. 241 // C3.1.
219 enum MainOp { 242 enum MainOp {
220 DPImmediateMask = 0x1c000000, 243 DPImmediateMask = 0x1c000000,
221 DPImmediateFixed = B28, 244 DPImmediateFixed = B28,
222 245
223 CompareBranchMask = 0x1c000000, 246 CompareBranchMask = 0x1c000000,
224 CompareBranchFixed = B28 | B26, 247 CompareBranchFixed = B28 | B26,
225 248
226 LoadStoreMask = B27 | B25, 249 LoadStoreMask = B27 | B25,
(...skipping 27 matching lines...) Expand all
254 277
255 // C3.2.7 278 // C3.2.7
256 enum UnconditionalBranchRegOp { 279 enum UnconditionalBranchRegOp {
257 UnconditionalBranchRegMask = 0xfe000000, 280 UnconditionalBranchRegMask = 0xfe000000,
258 UnconditionalBranchRegFixed = CompareBranchFixed | B31 | B30 | B25, 281 UnconditionalBranchRegFixed = CompareBranchFixed | B31 | B30 | B25,
259 BR = UnconditionalBranchRegFixed | B20 | B19 | B18 | B17 | B16, 282 BR = UnconditionalBranchRegFixed | B20 | B19 | B18 | B17 | B16,
260 BLR = BR | B21, 283 BLR = BR | B21,
261 RET = BR | B22, 284 RET = BR | B22,
262 }; 285 };
263 286
287 enum LoadStoreRegOp {
288 LoadStoreRegMask = 0x3a000000,
289 LoadStoreRegFixed = LoadStoreFixed | B29 | B28,
290 STR = LoadStoreRegFixed,
291 LDR = LoadStoreRegFixed | B22,
292 };
293
264 // C3.4.1 294 // C3.4.1
265 enum AddSubImmOp { 295 enum AddSubImmOp {
266 AddSubImmMask = 0x1f000000, 296 AddSubImmMask = 0x1f000000,
267 AddSubImmFixed = DPImmediateFixed | B24, 297 AddSubImmFixed = DPImmediateFixed | B24,
268 ADDI = AddSubImmFixed, 298 ADDI = AddSubImmFixed,
269 SUBI = AddSubImmFixed | B30, 299 SUBI = AddSubImmFixed | B30,
270 }; 300 };
271 301
272 // C3.4.5 302 // C3.4.5
273 enum MoveWideOp { 303 enum MoveWideOp {
(...skipping 15 matching lines...) Expand all
289 319
290 #define APPLY_OP_LIST(_V) \ 320 #define APPLY_OP_LIST(_V) \
291 _V(DPImmediate) \ 321 _V(DPImmediate) \
292 _V(CompareBranch) \ 322 _V(CompareBranch) \
293 _V(LoadStore) \ 323 _V(LoadStore) \
294 _V(DPRegister) \ 324 _V(DPRegister) \
295 _V(DPSimd1) \ 325 _V(DPSimd1) \
296 _V(DPSimd2) \ 326 _V(DPSimd2) \
297 _V(ExceptionGen) \ 327 _V(ExceptionGen) \
298 _V(System) \ 328 _V(System) \
329 _V(LoadStoreReg) \
299 _V(UnconditionalBranchReg) \ 330 _V(UnconditionalBranchReg) \
300 _V(AddSubImm) \ 331 _V(AddSubImm) \
301 _V(MoveWide) \ 332 _V(MoveWide) \
302 _V(AddSubShiftExt) \ 333 _V(AddSubShiftExt) \
303 334
304 335
305 enum Shift { 336 enum Shift {
306 kNoShift = -1, 337 kNoShift = -1,
307 LSL = 0, // Logical shift left 338 LSL = 0, // Logical shift left
308 LSR = 1, // Logical shift right 339 LSR = 1, // Logical shift right
(...skipping 25 matching lines...) Expand all
334 // instructions. Based on the "Figure 3-1 ARM instruction set summary". 365 // instructions. Based on the "Figure 3-1 ARM instruction set summary".
335 enum InstructionFields { 366 enum InstructionFields {
336 // S-bit (modify condition register) 367 // S-bit (modify condition register)
337 kSShift = 29, 368 kSShift = 29,
338 kSBits = 1, 369 kSBits = 1,
339 370
340 // sf field. 371 // sf field.
341 kSFShift = 31, 372 kSFShift = 31,
342 kSFBits = 1, 373 kSFBits = 1,
343 374
375 // size field,
376 kSzShift = 30,
377 kSzBits = 2,
378
344 // Registers. 379 // Registers.
345 kRdShift = 0, 380 kRdShift = 0,
346 kRdBits = 5, 381 kRdBits = 5,
347 kRnShift = 5, 382 kRnShift = 5,
348 kRnBits = 5, 383 kRnBits = 5,
349 kRaShift = 10, 384 kRaShift = 10,
350 kRaBits = 5, 385 kRaBits = 5,
351 kRmShift = 16, 386 kRmShift = 16,
352 kRmBits = 5, 387 kRmBits = 5,
388 kRtShift = 0,
389 kRtBits = 5,
353 390
354 // Immediates. 391 // Immediates.
355 kImm3Shift = 10, 392 kImm3Shift = 10,
356 kImm3Bits = 3, 393 kImm3Bits = 3,
357 kImm6Shift = 10, 394 kImm6Shift = 10,
358 kImm6Bits = 6, 395 kImm6Bits = 6,
396 kImm9Shift = 12,
397 kImm9Bits = 9,
359 kImm12Shift = 10, 398 kImm12Shift = 10,
360 kImm12Bits = 12, 399 kImm12Bits = 12,
361 kImm12ShiftShift = 22, 400 kImm12ShiftShift = 22,
362 kImm12ShiftBits = 2, 401 kImm12ShiftBits = 2,
363 kImm16Shift = 5, 402 kImm16Shift = 5,
364 kImm16Bits = 16, 403 kImm16Bits = 16,
365 404
366 kHWShift = 21, 405 kHWShift = 21,
367 kHWBits = 2, 406 kHWBits = 2,
368 407
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 } 466 }
428 467
429 // Read a bit field out of the instruction bits. 468 // Read a bit field out of the instruction bits.
430 inline int Bits(int shift, int count) const { 469 inline int Bits(int shift, int count) const {
431 return (InstructionBits() >> shift) & ((1 << count) - 1); 470 return (InstructionBits() >> shift) & ((1 << count) - 1);
432 } 471 }
433 472
434 473
435 inline int SField() const { return Bit(kSShift); } 474 inline int SField() const { return Bit(kSShift); }
436 inline int SFField() const { return Bit(kSFShift); } 475 inline int SFField() const { return Bit(kSFShift); }
476 inline int SzField() const { return Bits(kSzShift, kSzBits); }
437 inline Register RdField() const { return static_cast<Register>( 477 inline Register RdField() const { return static_cast<Register>(
438 Bits(kRdShift, kRdBits)); } 478 Bits(kRdShift, kRdBits)); }
439 inline Register RnField() const { return static_cast<Register>( 479 inline Register RnField() const { return static_cast<Register>(
440 Bits(kRnShift, kRnBits)); } 480 Bits(kRnShift, kRnBits)); }
441 inline Register RaField() const { return static_cast<Register>( 481 inline Register RaField() const { return static_cast<Register>(
442 Bits(kRaShift, kRaBits)); } 482 Bits(kRaShift, kRaBits)); }
443 inline Register RmField() const { return static_cast<Register>( 483 inline Register RmField() const { return static_cast<Register>(
444 Bits(kRmShift, kRmBits)); } 484 Bits(kRmShift, kRmBits)); }
485 inline Register RtField() const { return static_cast<Register>(
486 Bits(kRtShift, kRtBits)); }
445 487
446 // Immediates 488 // Immediates
447 inline int Imm3Field() const { return Bits(kImm3Shift, kImm3Bits); } 489 inline int Imm3Field() const { return Bits(kImm3Shift, kImm3Bits); }
448 inline int Imm6Field() const { return Bits(kImm6Shift, kImm6Bits); } 490 inline int Imm6Field() const { return Bits(kImm6Shift, kImm6Bits); }
491 inline int Imm9Field() const { return Bits(kImm9Shift, kImm9Bits); }
492 // Sign-extended Imm9Field()
493 inline int64_t SImm9Field() const {
494 return (static_cast<int32_t>(Imm9Field()) << 23) >> 23; }
449 inline int Imm12Field() const { return Bits(kImm12Shift, kImm12Bits); } 495 inline int Imm12Field() const { return Bits(kImm12Shift, kImm12Bits); }
450 inline int Imm16Field() const { return Bits(kImm16Shift, kImm16Bits); } 496 inline int Imm16Field() const { return Bits(kImm16Shift, kImm16Bits); }
451 497
452 inline int Imm12ShiftField() const { 498 inline int Imm12ShiftField() const {
453 return Bits(kImm12ShiftShift, kImm12ShiftBits); } 499 return Bits(kImm12ShiftShift, kImm12ShiftBits); }
454 inline int HWField() const { return Bits(kHWShift, kHWBits); } 500 inline int HWField() const { return Bits(kHWShift, kHWBits); }
455 501
456 // Shift and Extend. 502 // Shift and Extend.
457 inline bool IsShift() const { return (Bit(kShiftExtendShift) == 0); } 503 inline bool IsShift() const { return (Bit(kShiftExtendShift) == 0); }
458 inline bool IsExtend() const { return (Bit(kShiftExtendShift) == 1); } 504 inline bool IsExtend() const { return (Bit(kShiftExtendShift) == 1); }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); } 560 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); }
515 561
516 private: 562 private:
517 DISALLOW_ALLOCATION(); 563 DISALLOW_ALLOCATION();
518 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); 564 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr);
519 }; 565 };
520 566
521 } // namespace dart 567 } // namespace dart
522 568
523 #endif // VM_CONSTANTS_ARM64_H_ 569 #endif // VM_CONSTANTS_ARM64_H_
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm64_test.cc ('k') | runtime/vm/disassembler_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698