Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // This is forked from Dart revision df52deea9f25690eb8b66c5995da92b70f7ac1fe | 5 // This is forked from Dart revision df52deea9f25690eb8b66c5995da92b70f7ac1fe |
| 6 // Please update the (git) revision if we merge changes from Dart. | 6 // Please update the (git) revision if we merge changes from Dart. |
| 7 // https://code.google.com/p/dart/wiki/GettingTheSource | 7 // https://code.google.com/p/dart/wiki/GettingTheSource |
| 8 | 8 |
| 9 #ifndef VM_ASSEMBLER_ARM_H_ | 9 #ifndef VM_ASSEMBLER_ARM_H_ |
| 10 #define VM_ASSEMBLER_ARM_H_ | 10 #define VM_ASSEMBLER_ARM_H_ |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 133 } | 133 } |
| 134 | 134 |
| 135 // Data-processing operands - Immediate. | 135 // Data-processing operands - Immediate. |
| 136 explicit Operand(uint32_t immediate) { | 136 explicit Operand(uint32_t immediate) { |
| 137 ASSERT(immediate < (1 << kImmed8Bits)); | 137 ASSERT(immediate < (1 << kImmed8Bits)); |
| 138 type_ = 1; | 138 type_ = 1; |
| 139 encoding_ = immediate; | 139 encoding_ = immediate; |
| 140 } | 140 } |
| 141 | 141 |
| 142 #if 0 | 142 #if 0 |
| 143 // Moved to decode in IceAssemblerARM32.cpp | 143 // Moved to decodeOperand() in IceAssemblerARM32.cpp |
| 144 // Data-processing operands - Rotated immediate. | 144 // Data-processing operands - Rotated immediate. |
| 145 Operand(uint32_t rotate, uint32_t immed8) { | 145 Operand(uint32_t rotate, uint32_t immed8) { |
| 146 ASSERT((rotate < (1 << kRotateBits)) && (immed8 < (1 << kImmed8Bits))); | 146 ASSERT((rotate < (1 << kRotateBits)) && (immed8 < (1 << kImmed8Bits))); |
| 147 type_ = 1; | 147 type_ = 1; |
| 148 encoding_ = (rotate << kRotateShift) | (immed8 << kImmed8Shift); | 148 encoding_ = (rotate << kRotateShift) | (immed8 << kImmed8Shift); |
| 149 } | 149 } |
| 150 #endif | 150 #endif |
| 151 | 151 |
| 152 #if 0 | 152 #if 0 |
| 153 // Moved to decode in IceAssemblerARM32.cpp | 153 // Moved to decodeOperand() in IceAssemblerARM32.cpp |
| 154 // Data-processing operands - Register. | 154 // Data-processing operands - Register. |
| 155 explicit Operand(Register rm) { | 155 explicit Operand(Register rm) { |
| 156 type_ = 0; | 156 type_ = 0; |
| 157 encoding_ = static_cast<uint32_t>(rm); | 157 encoding_ = static_cast<uint32_t>(rm); |
| 158 } | 158 } |
| 159 #endif | 159 #endif |
| 160 | 160 |
| 161 // Data-processing operands - Logical shift/rotate by immediate. | 161 // Data-processing operands - Logical shift/rotate by immediate. |
| 162 Operand(Register rm, Shift shift, uint32_t shift_imm) { | 162 Operand(Register rm, Shift shift, uint32_t shift_imm) { |
| 163 ASSERT(shift_imm < (1 << kShiftImmBits)); | 163 ASSERT(shift_imm < (1 << kShiftImmBits)); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 Address& operator=(const Address& other) { | 270 Address& operator=(const Address& other) { |
| 271 encoding_ = other.encoding_; | 271 encoding_ = other.encoding_; |
| 272 kind_ = other.kind_; | 272 kind_ = other.kind_; |
| 273 return *this; | 273 return *this; |
| 274 } | 274 } |
| 275 | 275 |
| 276 bool Equals(const Address& other) const { | 276 bool Equals(const Address& other) const { |
| 277 return (encoding_ == other.encoding_) && (kind_ == other.kind_); | 277 return (encoding_ == other.encoding_) && (kind_ == other.kind_); |
| 278 } | 278 } |
| 279 | 279 |
| 280 #if 0 | |
| 281 // Moved to decodeImmRegOffset() in IceAssemblerARM32.cpp. | |
| 282 // Used to model stack offsets. | |
| 280 explicit Address(Register rn, int32_t offset = 0, Mode am = Offset) { | 283 explicit Address(Register rn, int32_t offset = 0, Mode am = Offset) { |
| 281 ASSERT(Utils::IsAbsoluteUint(12, offset)); | 284 ASSERT(Utils::IsAbsoluteUint(12, offset)); |
| 282 kind_ = Immediate; | 285 kind_ = Immediate; |
| 283 if (offset < 0) { | 286 if (offset < 0) { |
| 284 encoding_ = (am ^ (1 << kUShift)) | -offset; // Flip U to adjust sign. | 287 encoding_ = (am ^ (1 << kUShift)) | -offset; // Flip U to adjust sign. |
| 285 } else { | 288 } else { |
| 286 encoding_ = am | offset; | 289 encoding_ = am | offset; |
| 287 } | 290 } |
| 288 encoding_ |= static_cast<uint32_t>(rn) << kRnShift; | 291 encoding_ |= static_cast<uint32_t>(rn) << kRnShift; |
| 289 } | 292 } |
| 293 #endif | |
| 290 | 294 |
| 291 // There is no register offset mode unless Mode is Offset, in which case the | 295 // There is no register offset mode unless Mode is Offset, in which case the |
| 292 // shifted register case below should be used. | 296 // shifted register case below should be used. |
| 293 Address(Register rn, Register r, Mode am); | 297 Address(Register rn, Register r, Mode am); |
| 294 | 298 |
| 295 Address(Register rn, Register rm, | 299 Address(Register rn, Register rm, |
| 296 Shift shift = LSL, uint32_t shift_imm = 0, Mode am = Offset) { | 300 Shift shift = LSL, uint32_t shift_imm = 0, Mode am = Offset) { |
| 297 Operand o(rm, shift, shift_imm); | 301 Operand o(rm, shift, shift_imm); |
| 298 | 302 |
| 299 if ((shift == LSL) && (shift_imm == 0)) { | 303 if ((shift == LSL) && (shift_imm == 0)) { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 433 | 437 |
| 434 static const char* RegisterName(Register reg); | 438 static const char* RegisterName(Register reg); |
| 435 | 439 |
| 436 static const char* FpuRegisterName(FpuRegister reg); | 440 static const char* FpuRegisterName(FpuRegister reg); |
| 437 | 441 |
| 438 // Data-processing instructions. | 442 // Data-processing instructions. |
| 439 void and_(Register rd, Register rn, Operand o, Condition cond = AL); | 443 void and_(Register rd, Register rn, Operand o, Condition cond = AL); |
| 440 | 444 |
| 441 void eor(Register rd, Register rn, Operand o, Condition cond = AL); | 445 void eor(Register rd, Register rn, Operand o, Condition cond = AL); |
| 442 | 446 |
| 447 #if 0 | |
|
Jim Stichnoth
2015/10/15 20:41:29
Missing #endif ?
Karl
2015/10/15 22:03:33
Done.
| |
| 448 // Moved to ARM32::AssemberARM32::sub() | |
| 443 void sub(Register rd, Register rn, Operand o, Condition cond = AL); | 449 void sub(Register rd, Register rn, Operand o, Condition cond = AL); |
| 444 void subs(Register rd, Register rn, Operand o, Condition cond = AL); | 450 void subs(Register rd, Register rn, Operand o, Condition cond = AL); |
| 445 | 451 |
| 446 void rsb(Register rd, Register rn, Operand o, Condition cond = AL); | 452 void rsb(Register rd, Register rn, Operand o, Condition cond = AL); |
| 447 void rsbs(Register rd, Register rn, Operand o, Condition cond = AL); | 453 void rsbs(Register rd, Register rn, Operand o, Condition cond = AL); |
| 448 | 454 |
| 449 #if 0 | 455 #if 0 |
| 450 // Moved to IceAssemblerARM32::mov | 456 // Moved to ARM32::AssemblerARM32::add() |
| 451 void add(Register rd, Register rn, Operand o, Condition cond = AL); | 457 void add(Register rd, Register rn, Operand o, Condition cond = AL); |
| 452 | 458 |
| 453 void adds(Register rd, Register rn, Operand o, Condition cond = AL); | 459 void adds(Register rd, Register rn, Operand o, Condition cond = AL); |
| 454 #endif | 460 #endif |
| 455 | 461 |
| 456 void adc(Register rd, Register rn, Operand o, Condition cond = AL); | 462 void adc(Register rd, Register rn, Operand o, Condition cond = AL); |
| 457 | 463 |
| 458 void adcs(Register rd, Register rn, Operand o, Condition cond = AL); | 464 void adcs(Register rd, Register rn, Operand o, Condition cond = AL); |
| 459 | 465 |
| 460 void sbc(Register rd, Register rn, Operand o, Condition cond = AL); | 466 void sbc(Register rd, Register rn, Operand o, Condition cond = AL); |
| 461 | 467 |
| 462 void sbcs(Register rd, Register rn, Operand o, Condition cond = AL); | 468 void sbcs(Register rd, Register rn, Operand o, Condition cond = AL); |
| 463 | 469 |
| 464 void rsc(Register rd, Register rn, Operand o, Condition cond = AL); | 470 void rsc(Register rd, Register rn, Operand o, Condition cond = AL); |
| 465 | 471 |
| 466 void tst(Register rn, Operand o, Condition cond = AL); | 472 void tst(Register rn, Operand o, Condition cond = AL); |
| 467 | 473 |
| 468 void teq(Register rn, Operand o, Condition cond = AL); | 474 void teq(Register rn, Operand o, Condition cond = AL); |
| 469 | 475 |
| 470 void cmp(Register rn, Operand o, Condition cond = AL); | 476 void cmp(Register rn, Operand o, Condition cond = AL); |
| 471 | 477 |
| 472 void cmn(Register rn, Operand o, Condition cond = AL); | 478 void cmn(Register rn, Operand o, Condition cond = AL); |
| 473 | 479 |
| 474 void orr(Register rd, Register rn, Operand o, Condition cond = AL); | 480 void orr(Register rd, Register rn, Operand o, Condition cond = AL); |
| 475 void orrs(Register rd, Register rn, Operand o, Condition cond = AL); | 481 void orrs(Register rd, Register rn, Operand o, Condition cond = AL); |
| 476 | 482 |
| 477 #if 0 | 483 #if 0 |
| 478 // Moved to IceAssemblerARM32::mov | 484 // Moved to IceAssemblerARM32::mov() |
| 479 void mov(Register rd, Operand o, Condition cond = AL); | 485 void mov(Register rd, Operand o, Condition cond = AL); |
| 480 void movs(Register rd, Operand o, Condition cond = AL); | 486 void movs(Register rd, Operand o, Condition cond = AL); |
| 481 #endif | 487 #endif |
| 482 | 488 |
| 483 void bic(Register rd, Register rn, Operand o, Condition cond = AL); | 489 void bic(Register rd, Register rn, Operand o, Condition cond = AL); |
| 484 void bics(Register rd, Register rn, Operand o, Condition cond = AL); | 490 void bics(Register rd, Register rn, Operand o, Condition cond = AL); |
| 485 | 491 |
| 486 void mvn(Register rd, Operand o, Condition cond = AL); | 492 void mvn(Register rd, Operand o, Condition cond = AL); |
| 487 void mvns(Register rd, Operand o, Condition cond = AL); | 493 void mvns(Register rd, Operand o, Condition cond = AL); |
| 488 | 494 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 507 | 513 |
| 508 // Emulation of this instruction uses IP and the condition codes. Therefore, | 514 // Emulation of this instruction uses IP and the condition codes. Therefore, |
| 509 // none of the registers can be IP, and the instruction can only be used | 515 // none of the registers can be IP, and the instruction can only be used |
| 510 // unconditionally. | 516 // unconditionally. |
| 511 void umaal(Register rd_lo, Register rd_hi, Register rn, Register rm); | 517 void umaal(Register rd_lo, Register rd_hi, Register rn, Register rm); |
| 512 | 518 |
| 513 // Division instructions. | 519 // Division instructions. |
| 514 void sdiv(Register rd, Register rn, Register rm, Condition cond = AL); | 520 void sdiv(Register rd, Register rn, Register rm, Condition cond = AL); |
| 515 void udiv(Register rd, Register rn, Register rm, Condition cond = AL); | 521 void udiv(Register rd, Register rn, Register rm, Condition cond = AL); |
| 516 | 522 |
| 523 #if 0 | |
| 524 // Moved to AssemblerARM32::ldr() | |
| 517 // Load/store instructions. | 525 // Load/store instructions. |
| 518 void ldr(Register rd, Address ad, Condition cond = AL); | 526 void ldr(Register rd, Address ad, Condition cond = AL); |
| 527 // Moved to AssemblerARM32::str() | |
| 519 void str(Register rd, Address ad, Condition cond = AL); | 528 void str(Register rd, Address ad, Condition cond = AL); |
| 520 | 529 |
| 530 // Moved to AssemblerARM32::ldr() | |
| 521 void ldrb(Register rd, Address ad, Condition cond = AL); | 531 void ldrb(Register rd, Address ad, Condition cond = AL); |
| 532 // Moved to AssemblerARM32::str() | |
| 522 void strb(Register rd, Address ad, Condition cond = AL); | 533 void strb(Register rd, Address ad, Condition cond = AL); |
| 534 #endif | |
| 523 | 535 |
| 524 void ldrh(Register rd, Address ad, Condition cond = AL); | 536 void ldrh(Register rd, Address ad, Condition cond = AL); |
| 525 void strh(Register rd, Address ad, Condition cond = AL); | 537 void strh(Register rd, Address ad, Condition cond = AL); |
| 526 | 538 |
| 527 void ldrsb(Register rd, Address ad, Condition cond = AL); | 539 void ldrsb(Register rd, Address ad, Condition cond = AL); |
| 528 void ldrsh(Register rd, Address ad, Condition cond = AL); | 540 void ldrsh(Register rd, Address ad, Condition cond = AL); |
| 529 | 541 |
| 530 // ldrd and strd actually support the full range of addressing modes, but | 542 // ldrd and strd actually support the full range of addressing modes, but |
| 531 // we don't use them, and we need to split them up into two instructions for | 543 // we don't use them, and we need to split them up into two instructions for |
| 532 // ARMv5TE, so we only support the base + offset mode. | 544 // ARMv5TE, so we only support the base + offset mode. |
| 533 void ldrd(Register rd, Register rn, int32_t offset, Condition cond = AL); | 545 void ldrd(Register rd, Register rn, int32_t offset, Condition cond = AL); |
| 534 void strd(Register rd, Register rn, int32_t offset, Condition cond = AL); | 546 void strd(Register rd, Register rn, int32_t offset, Condition cond = AL); |
| 535 | 547 |
| 536 void ldm(BlockAddressMode am, Register base, | 548 void ldm(BlockAddressMode am, Register base, |
| 537 RegList regs, Condition cond = AL); | 549 RegList regs, Condition cond = AL); |
| 538 void stm(BlockAddressMode am, Register base, | 550 void stm(BlockAddressMode am, Register base, |
| 539 RegList regs, Condition cond = AL); | 551 RegList regs, Condition cond = AL); |
| 540 | 552 |
| 541 void ldrex(Register rd, Register rn, Condition cond = AL); | 553 void ldrex(Register rd, Register rn, Condition cond = AL); |
| 542 void strex(Register rd, Register rt, Register rn, Condition cond = AL); | 554 void strex(Register rd, Register rt, Register rn, Condition cond = AL); |
| 543 | 555 |
| 544 // Miscellaneous instructions. | 556 // Miscellaneous instructions. |
| 545 void clrex(); | 557 void clrex(); |
| 546 void nop(Condition cond = AL); | 558 void nop(Condition cond = AL); |
| 547 | 559 |
| 548 #if 0 | 560 #if 0 |
| 549 // Moved to: ARM32::AssemblerARM32. | 561 // Moved to: ARM32::AssemblerARM32::bkpt() |
| 550 // Note that gdb sets breakpoints using the undefined instruction 0xe7f001f0. | 562 // Note that gdb sets breakpoints using the undefined instruction 0xe7f001f0. |
| 551 void bkpt(uint16_t imm16); | 563 void bkpt(uint16_t imm16); |
| 552 | 564 |
| 553 static int32_t BkptEncoding(uint16_t imm16) { | 565 static int32_t BkptEncoding(uint16_t imm16) { |
| 554 // bkpt requires that the cond field is AL. | 566 // bkpt requires that the cond field is AL. |
| 555 return (AL << kConditionShift) | B24 | B21 | | 567 return (AL << kConditionShift) | B24 | B21 | |
| 556 ((imm16 >> 4) << 8) | B6 | B5 | B4 | (imm16 & 0xf); | 568 ((imm16 >> 4) << 8) | B6 | B5 | B4 | (imm16 & 0xf); |
| 557 } | 569 } |
| 558 #endif | 570 #endif |
| 559 | 571 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 670 void vtbl(DRegister dd, DRegister dn, int length, DRegister dm); | 682 void vtbl(DRegister dd, DRegister dn, int length, DRegister dm); |
| 671 | 683 |
| 672 // The words of qd and qm are interleaved with the low words of the result | 684 // The words of qd and qm are interleaved with the low words of the result |
| 673 // in qd and the high words in qm. | 685 // in qd and the high words in qm. |
| 674 void vzipqw(QRegister qd, QRegister qm); | 686 void vzipqw(QRegister qd, QRegister qm); |
| 675 | 687 |
| 676 // Branch instructions. | 688 // Branch instructions. |
| 677 void b(Label* label, Condition cond = AL); | 689 void b(Label* label, Condition cond = AL); |
| 678 void bl(Label* label, Condition cond = AL); | 690 void bl(Label* label, Condition cond = AL); |
| 679 #if 0 | 691 #if 0 |
| 680 // Moved to: ARM32::AssemblerARM32. | 692 // Moved to: ARM32::AssemblerARM32::bx() |
| 681 void bx(Register rm, Condition cond = AL); | 693 void bx(Register rm, Condition cond = AL); |
| 682 #endif | 694 #endif |
| 683 void blx(Register rm, Condition cond = AL); | 695 void blx(Register rm, Condition cond = AL); |
| 684 | 696 |
| 685 void Branch(const StubEntry& stub_entry, | 697 void Branch(const StubEntry& stub_entry, |
| 686 Patchability patchable = kNotPatchable, | 698 Patchability patchable = kNotPatchable, |
| 687 Register pp = PP, | 699 Register pp = PP, |
| 688 Condition cond = AL); | 700 Condition cond = AL); |
| 689 | 701 |
| 690 void BranchLink(const StubEntry& stub_entry, | 702 void BranchLink(const StubEntry& stub_entry, |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1090 | 1102 |
| 1091 bool constant_pool_allowed_; | 1103 bool constant_pool_allowed_; |
| 1092 | 1104 |
| 1093 void LoadObjectHelper(Register rd, | 1105 void LoadObjectHelper(Register rd, |
| 1094 const Object& object, | 1106 const Object& object, |
| 1095 Condition cond, | 1107 Condition cond, |
| 1096 bool is_unique, | 1108 bool is_unique, |
| 1097 Register pp); | 1109 Register pp); |
| 1098 | 1110 |
| 1099 #if 0 | 1111 #if 0 |
| 1100 // Moved to class AssemblerARM32. | 1112 // Moved to ARM32::AssemblerARM32::emitType01() |
| 1101 void EmitType01(Condition cond, | 1113 void EmitType01(Condition cond, |
| 1102 int type, | 1114 int type, |
| 1103 Opcode opcode, | 1115 Opcode opcode, |
| 1104 int set_cc, | 1116 int set_cc, |
| 1105 Register rn, | 1117 Register rn, |
| 1106 Register rd, | 1118 Register rd, |
| 1107 Operand o); | 1119 Operand o); |
| 1108 #endif | 1120 #endif |
| 1109 | 1121 |
| 1110 void EmitType5(Condition cond, int32_t offset, bool link); | 1122 void EmitType5(Condition cond, int32_t offset, bool link); |
| 1111 | 1123 |
| 1124 #if 0 | |
| 1125 // Moved to ARM32::AssemberARM32::emitMemOp() | |
| 1112 void EmitMemOp(Condition cond, | 1126 void EmitMemOp(Condition cond, |
| 1113 bool load, | 1127 bool load, |
| 1114 bool byte, | 1128 bool byte, |
| 1115 Register rd, | 1129 Register rd, |
| 1116 Address ad); | 1130 Address ad); |
| 1131 #endif | |
| 1117 | 1132 |
| 1118 void EmitMemOpAddressMode3(Condition cond, | 1133 void EmitMemOpAddressMode3(Condition cond, |
| 1119 int32_t mode, | 1134 int32_t mode, |
| 1120 Register rd, | 1135 Register rd, |
| 1121 Address ad); | 1136 Address ad); |
| 1122 | 1137 |
| 1123 void EmitMultiMemOp(Condition cond, | 1138 void EmitMultiMemOp(Condition cond, |
| 1124 BlockAddressMode am, | 1139 BlockAddressMode am, |
| 1125 bool load, | 1140 bool load, |
| 1126 Register base, | 1141 Register base, |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1227 Register new_value, | 1242 Register new_value, |
| 1228 FieldContent old_content); | 1243 FieldContent old_content); |
| 1229 | 1244 |
| 1230 DISALLOW_ALLOCATION(); | 1245 DISALLOW_ALLOCATION(); |
| 1231 DISALLOW_COPY_AND_ASSIGN(Assembler); | 1246 DISALLOW_COPY_AND_ASSIGN(Assembler); |
| 1232 }; | 1247 }; |
| 1233 | 1248 |
| 1234 } // namespace dart | 1249 } // namespace dart |
| 1235 | 1250 |
| 1236 #endif // VM_ASSEMBLER_ARM_H_ | 1251 #endif // VM_ASSEMBLER_ARM_H_ |
| OLD | NEW |