OLD | NEW |
1 //===- subzero/src/IceAssemblerARM32.cpp - Assembler for ARM32 --*- C++ -*-===// | 1 //===- subzero/src/IceAssemblerARM32.cpp - Assembler for ARM32 --*- C++ -*-===// |
2 // | 2 // |
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
4 // for details. All rights reserved. Use of this source code is governed by a | 4 // for details. All rights reserved. Use of this source code is governed by a |
5 // BSD-style license that can be found in the LICENSE file. | 5 // BSD-style license that can be found in the LICENSE file. |
6 // | 6 // |
7 // Modified by the Subzero authors. | 7 // Modified by the Subzero authors. |
8 // | 8 // |
9 //===----------------------------------------------------------------------===// | 9 //===----------------------------------------------------------------------===// |
10 // | 10 // |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 namespace ARM32 { | 586 namespace ARM32 { |
587 | 587 |
588 size_t MoveRelocatableFixup::emit(GlobalContext *Ctx, | 588 size_t MoveRelocatableFixup::emit(GlobalContext *Ctx, |
589 const Assembler &Asm) const { | 589 const Assembler &Asm) const { |
590 if (!BuildDefs::dump()) | 590 if (!BuildDefs::dump()) |
591 return InstARM32::InstSize; | 591 return InstARM32::InstSize; |
592 Ostream &Str = Ctx->getStrEmit(); | 592 Ostream &Str = Ctx->getStrEmit(); |
593 IValueT Inst = Asm.load<IValueT>(position()); | 593 IValueT Inst = Asm.load<IValueT>(position()); |
594 const bool IsMovw = kind() == llvm::ELF::R_ARM_MOVW_ABS_NC || | 594 const bool IsMovw = kind() == llvm::ELF::R_ARM_MOVW_ABS_NC || |
595 kind() == llvm::ELF::R_ARM_MOVW_PREL_NC; | 595 kind() == llvm::ELF::R_ARM_MOVW_PREL_NC; |
| 596 const IceString Symbol = symbol(); |
| 597 const bool NeedsPCRelSuffix = |
| 598 (Asm.fixupIsPCRel(kind()) || Symbol == GlobalOffsetTable); |
596 Str << "\t" | 599 Str << "\t" |
597 "mov" << (IsMovw ? "w" : "t") << "\t" | 600 "mov" << (IsMovw ? "w" : "t") << "\t" |
598 << RegARM32::getRegName(RegNumT::fixme((Inst >> kRdShift) & 0xF)) | 601 << RegARM32::getRegName(RegNumT::fixme((Inst >> kRdShift) & 0xF)) |
599 << ", #:" << (IsMovw ? "lower" : "upper") << "16:" << symbol(&Asm) | 602 << ", #:" << (IsMovw ? "lower" : "upper") << "16:" << Symbol |
600 << "\t@ .word " << llvm::format_hex_no_prefix(Inst, 8) << "\n"; | 603 << (NeedsPCRelSuffix ? " - ." : "") << "\t@ .word " |
| 604 // TODO(jpp): This is broken, it also needs to add a magic constant. |
| 605 << llvm::format_hex_no_prefix(Inst, 8) << "\n"; |
601 return InstARM32::InstSize; | 606 return InstARM32::InstSize; |
602 } | 607 } |
603 | 608 |
604 IValueT AssemblerARM32::encodeElmtType(Type ElmtTy) { | 609 IValueT AssemblerARM32::encodeElmtType(Type ElmtTy) { |
605 switch (ElmtTy) { | 610 switch (ElmtTy) { |
606 case IceType_i8: | 611 case IceType_i8: |
607 return 0; | 612 return 0; |
608 case IceType_i16: | 613 case IceType_i16: |
609 return 1; | 614 return 1; |
610 case IceType_i32: | 615 case IceType_i32: |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 return F; | 648 return F; |
644 } | 649 } |
645 | 650 |
646 size_t BlRelocatableFixup::emit(GlobalContext *Ctx, | 651 size_t BlRelocatableFixup::emit(GlobalContext *Ctx, |
647 const Assembler &Asm) const { | 652 const Assembler &Asm) const { |
648 if (!BuildDefs::dump()) | 653 if (!BuildDefs::dump()) |
649 return InstARM32::InstSize; | 654 return InstARM32::InstSize; |
650 Ostream &Str = Ctx->getStrEmit(); | 655 Ostream &Str = Ctx->getStrEmit(); |
651 IValueT Inst = Asm.load<IValueT>(position()); | 656 IValueT Inst = Asm.load<IValueT>(position()); |
652 Str << "\t" | 657 Str << "\t" |
653 "bl\t" << symbol(&Asm) << "\t@ .word " | 658 "bl\t" << symbol() << "\t@ .word " |
654 << llvm::format_hex_no_prefix(Inst, 8) << "\n"; | 659 << llvm::format_hex_no_prefix(Inst, 8) << "\n"; |
655 return InstARM32::InstSize; | 660 return InstARM32::InstSize; |
656 } | 661 } |
657 | 662 |
658 void BlRelocatableFixup::emitOffset(Assembler *Asm) const { | 663 void BlRelocatableFixup::emitOffset(Assembler *Asm) const { |
659 // cccc101liiiiiiiiiiiiiiiiiiiiiiii where cccc=Cond, l=Link, and | 664 // cccc101liiiiiiiiiiiiiiiiiiiiiiii where cccc=Cond, l=Link, and |
660 // iiiiiiiiiiiiiiiiiiiiiiii= | 665 // iiiiiiiiiiiiiiiiiiiiiiii= |
661 // EncodedBranchOffset(cccc101l000000000000000000000000, Offset); | 666 // EncodedBranchOffset(cccc101l000000000000000000000000, Offset); |
662 const IValueT Inst = Asm->load<IValueT>(position()); | 667 const IValueT Inst = Asm->load<IValueT>(position()); |
663 constexpr IValueT OffsetMask = 0x00FFFFFF; | 668 constexpr IValueT OffsetMask = 0x00FFFFFF; |
(...skipping 2532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3196 constexpr const char *Vsqrts = "vsqrts"; | 3201 constexpr const char *Vsqrts = "vsqrts"; |
3197 IValueT Sd = encodeSRegister(OpSd, "Sd", Vsqrts); | 3202 IValueT Sd = encodeSRegister(OpSd, "Sd", Vsqrts); |
3198 IValueT Sm = encodeSRegister(OpSm, "Sm", Vsqrts); | 3203 IValueT Sm = encodeSRegister(OpSm, "Sm", Vsqrts); |
3199 constexpr IValueT VsqrtsOpcode = B23 | B21 | B20 | B16 | B7 | B6; | 3204 constexpr IValueT VsqrtsOpcode = B23 | B21 | B20 | B16 | B7 | B6; |
3200 constexpr IValueT S0 = 0; | 3205 constexpr IValueT S0 = 0; |
3201 emitVFPsss(Cond, VsqrtsOpcode, Sd, S0, Sm); | 3206 emitVFPsss(Cond, VsqrtsOpcode, Sd, S0, Sm); |
3202 } | 3207 } |
3203 | 3208 |
3204 } // end of namespace ARM32 | 3209 } // end of namespace ARM32 |
3205 } // end of namespace Ice | 3210 } // end of namespace Ice |
OLD | NEW |