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

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
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: case kUnsignedByte: return 0;
221 case kHalfword: case kUnsignedHalfword: return 1;
222 case kWord: case kUnsignedWord: return 2;
regis 2014/04/07 23:38:19 It would be more readable to use one case per line
zra 2014/04/08 15:14:13 Done.
223 case kDoubleWord: return 3;
224 case kSWord: return 2;
225 case kDWord: return 3;
226 default:
227 UNREACHABLE();
228 break;
229 }
230 return -1;
231 }
232
217 // Opcodes from C3 233 // Opcodes from C3
218 // C3.1. 234 // C3.1.
219 enum MainOp { 235 enum MainOp {
220 DPImmediateMask = 0x1c000000, 236 DPImmediateMask = 0x1c000000,
221 DPImmediateFixed = B28, 237 DPImmediateFixed = B28,
222 238
223 CompareBranchMask = 0x1c000000, 239 CompareBranchMask = 0x1c000000,
224 CompareBranchFixed = B28 | B26, 240 CompareBranchFixed = B28 | B26,
225 241
226 LoadStoreMask = B27 | B25, 242 LoadStoreMask = B27 | B25,
(...skipping 27 matching lines...) Expand all
254 270
255 // C3.2.7 271 // C3.2.7
256 enum UnconditionalBranchRegOp { 272 enum UnconditionalBranchRegOp {
257 UnconditionalBranchRegMask = 0xfe000000, 273 UnconditionalBranchRegMask = 0xfe000000,
258 UnconditionalBranchRegFixed = CompareBranchFixed | B31 | B30 | B25, 274 UnconditionalBranchRegFixed = CompareBranchFixed | B31 | B30 | B25,
259 BR = UnconditionalBranchRegFixed | B20 | B19 | B18 | B17 | B16, 275 BR = UnconditionalBranchRegFixed | B20 | B19 | B18 | B17 | B16,
260 BLR = BR | B21, 276 BLR = BR | B21,
261 RET = BR | B22, 277 RET = BR | B22,
262 }; 278 };
263 279
280 enum LoadStoreRegOp {
281 LoadStoreRegMask = 0x3a000000,
282 LoadStoreRegFixed = LoadStoreFixed | B29 | B28,
283 STR = LoadStoreRegFixed,
284 LDR = LoadStoreRegFixed | B22,
285 };
286
264 // C3.4.1 287 // C3.4.1
265 enum AddSubImmOp { 288 enum AddSubImmOp {
266 AddSubImmMask = 0x1f000000, 289 AddSubImmMask = 0x1f000000,
267 AddSubImmFixed = DPImmediateFixed | B24, 290 AddSubImmFixed = DPImmediateFixed | B24,
268 ADDI = AddSubImmFixed, 291 ADDI = AddSubImmFixed,
269 SUBI = AddSubImmFixed | B30, 292 SUBI = AddSubImmFixed | B30,
270 }; 293 };
271 294
272 // C3.4.5 295 // C3.4.5
273 enum MoveWideOp { 296 enum MoveWideOp {
(...skipping 15 matching lines...) Expand all
289 312
290 #define APPLY_OP_LIST(_V) \ 313 #define APPLY_OP_LIST(_V) \
291 _V(DPImmediate) \ 314 _V(DPImmediate) \
292 _V(CompareBranch) \ 315 _V(CompareBranch) \
293 _V(LoadStore) \ 316 _V(LoadStore) \
294 _V(DPRegister) \ 317 _V(DPRegister) \
295 _V(DPSimd1) \ 318 _V(DPSimd1) \
296 _V(DPSimd2) \ 319 _V(DPSimd2) \
297 _V(ExceptionGen) \ 320 _V(ExceptionGen) \
298 _V(System) \ 321 _V(System) \
322 _V(LoadStoreReg) \
299 _V(UnconditionalBranchReg) \ 323 _V(UnconditionalBranchReg) \
300 _V(AddSubImm) \ 324 _V(AddSubImm) \
301 _V(MoveWide) \ 325 _V(MoveWide) \
302 _V(AddSubShiftExt) \ 326 _V(AddSubShiftExt) \
303 327
304 328
305 enum Shift { 329 enum Shift {
306 kNoShift = -1, 330 kNoShift = -1,
307 LSL = 0, // Logical shift left 331 LSL = 0, // Logical shift left
308 LSR = 1, // Logical shift right 332 LSR = 1, // Logical shift right
(...skipping 25 matching lines...) Expand all
334 // instructions. Based on the "Figure 3-1 ARM instruction set summary". 358 // instructions. Based on the "Figure 3-1 ARM instruction set summary".
335 enum InstructionFields { 359 enum InstructionFields {
336 // S-bit (modify condition register) 360 // S-bit (modify condition register)
337 kSShift = 29, 361 kSShift = 29,
338 kSBits = 1, 362 kSBits = 1,
339 363
340 // sf field. 364 // sf field.
341 kSFShift = 31, 365 kSFShift = 31,
342 kSFBits = 1, 366 kSFBits = 1,
343 367
368 // size field,
369 kSzShift = 30,
370 kSzBits = 2,
371
344 // Registers. 372 // Registers.
345 kRdShift = 0, 373 kRdShift = 0,
346 kRdBits = 5, 374 kRdBits = 5,
347 kRnShift = 5, 375 kRnShift = 5,
348 kRnBits = 5, 376 kRnBits = 5,
349 kRaShift = 10, 377 kRaShift = 10,
350 kRaBits = 5, 378 kRaBits = 5,
351 kRmShift = 16, 379 kRmShift = 16,
352 kRmBits = 5, 380 kRmBits = 5,
381 kRtShift = 0,
382 kRtBits = 5,
353 383
354 // Immediates. 384 // Immediates.
355 kImm3Shift = 10, 385 kImm3Shift = 10,
356 kImm3Bits = 3, 386 kImm3Bits = 3,
357 kImm6Shift = 10, 387 kImm6Shift = 10,
358 kImm6Bits = 6, 388 kImm6Bits = 6,
389 kImm9Shift = 12,
390 kImm9Bits = 9,
359 kImm12Shift = 10, 391 kImm12Shift = 10,
360 kImm12Bits = 12, 392 kImm12Bits = 12,
361 kImm12ShiftShift = 22, 393 kImm12ShiftShift = 22,
362 kImm12ShiftBits = 2, 394 kImm12ShiftBits = 2,
363 kImm16Shift = 5, 395 kImm16Shift = 5,
364 kImm16Bits = 16, 396 kImm16Bits = 16,
365 397
366 kHWShift = 21, 398 kHWShift = 21,
367 kHWBits = 2, 399 kHWBits = 2,
368 400
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 } 459 }
428 460
429 // Read a bit field out of the instruction bits. 461 // Read a bit field out of the instruction bits.
430 inline int Bits(int shift, int count) const { 462 inline int Bits(int shift, int count) const {
431 return (InstructionBits() >> shift) & ((1 << count) - 1); 463 return (InstructionBits() >> shift) & ((1 << count) - 1);
432 } 464 }
433 465
434 466
435 inline int SField() const { return Bit(kSShift); } 467 inline int SField() const { return Bit(kSShift); }
436 inline int SFField() const { return Bit(kSFShift); } 468 inline int SFField() const { return Bit(kSFShift); }
469 inline int SzField() const { return Bits(kSzShift, kSzBits); }
437 inline Register RdField() const { return static_cast<Register>( 470 inline Register RdField() const { return static_cast<Register>(
438 Bits(kRdShift, kRdBits)); } 471 Bits(kRdShift, kRdBits)); }
439 inline Register RnField() const { return static_cast<Register>( 472 inline Register RnField() const { return static_cast<Register>(
440 Bits(kRnShift, kRnBits)); } 473 Bits(kRnShift, kRnBits)); }
441 inline Register RaField() const { return static_cast<Register>( 474 inline Register RaField() const { return static_cast<Register>(
442 Bits(kRaShift, kRaBits)); } 475 Bits(kRaShift, kRaBits)); }
443 inline Register RmField() const { return static_cast<Register>( 476 inline Register RmField() const { return static_cast<Register>(
444 Bits(kRmShift, kRmBits)); } 477 Bits(kRmShift, kRmBits)); }
478 inline Register RtField() const { return static_cast<Register>(
479 Bits(kRtShift, kRtBits)); }
445 480
446 // Immediates 481 // Immediates
447 inline int Imm3Field() const { return Bits(kImm3Shift, kImm3Bits); } 482 inline int Imm3Field() const { return Bits(kImm3Shift, kImm3Bits); }
448 inline int Imm6Field() const { return Bits(kImm6Shift, kImm6Bits); } 483 inline int Imm6Field() const { return Bits(kImm6Shift, kImm6Bits); }
484 inline int Imm9Field() const { return Bits(kImm9Shift, kImm9Bits); }
485 // Sign-extended Imm9Field()
486 inline int64_t SImm9Field() const {
487 return (static_cast<int32_t>(Imm9Field()) << 23) >> 23; }
449 inline int Imm12Field() const { return Bits(kImm12Shift, kImm12Bits); } 488 inline int Imm12Field() const { return Bits(kImm12Shift, kImm12Bits); }
450 inline int Imm16Field() const { return Bits(kImm16Shift, kImm16Bits); } 489 inline int Imm16Field() const { return Bits(kImm16Shift, kImm16Bits); }
451 490
452 inline int Imm12ShiftField() const { 491 inline int Imm12ShiftField() const {
453 return Bits(kImm12ShiftShift, kImm12ShiftBits); } 492 return Bits(kImm12ShiftShift, kImm12ShiftBits); }
454 inline int HWField() const { return Bits(kHWShift, kHWBits); } 493 inline int HWField() const { return Bits(kHWShift, kHWBits); }
455 494
456 // Shift and Extend. 495 // Shift and Extend.
457 inline bool IsShift() const { return (Bit(kShiftExtendShift) == 0); } 496 inline bool IsShift() const { return (Bit(kShiftExtendShift) == 0); }
458 inline bool IsExtend() const { return (Bit(kShiftExtendShift) == 1); } 497 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); } 553 static Instr* At(uword pc) { return reinterpret_cast<Instr*>(pc); }
515 554
516 private: 555 private:
517 DISALLOW_ALLOCATION(); 556 DISALLOW_ALLOCATION();
518 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr); 557 DISALLOW_IMPLICIT_CONSTRUCTORS(Instr);
519 }; 558 };
520 559
521 } // namespace dart 560 } // namespace dart
522 561
523 #endif // VM_CONSTANTS_ARM64_H_ 562 #endif // VM_CONSTANTS_ARM64_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698