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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 | 446 |
447 namespace Ice { | 447 namespace Ice { |
448 namespace ARM32 { | 448 namespace ARM32 { |
449 | 449 |
450 size_t MoveRelocatableFixup::emit(GlobalContext *Ctx, | 450 size_t MoveRelocatableFixup::emit(GlobalContext *Ctx, |
451 const Assembler &Asm) const { | 451 const Assembler &Asm) const { |
452 if (!BuildDefs::dump()) | 452 if (!BuildDefs::dump()) |
453 return InstARM32::InstSize; | 453 return InstARM32::InstSize; |
454 Ostream &Str = Ctx->getStrEmit(); | 454 Ostream &Str = Ctx->getStrEmit(); |
455 IValueT Inst = Asm.load<IValueT>(position()); | 455 IValueT Inst = Asm.load<IValueT>(position()); |
456 Str << "\tmov" << (kind() == llvm::ELF::R_ARM_MOVW_ABS_NC ? "w" : "t") << "\t" | 456 Str << "\t" |
| 457 "mov" << (kind() == llvm::ELF::R_ARM_MOVW_ABS_NC ? "w" : "t") << "\t" |
457 << RegARM32::RegNames[(Inst >> kRdShift) & 0xF] | 458 << RegARM32::RegNames[(Inst >> kRdShift) & 0xF] |
458 << ", #:" << (kind() == llvm::ELF::R_ARM_MOVW_ABS_NC ? "lower" : "upper") | 459 << ", #:" << (kind() == llvm::ELF::R_ARM_MOVW_ABS_NC ? "lower" : "upper") |
459 << "16:" << symbol(Ctx) << "\t@ .word " | 460 << "16:" << symbol(Ctx) << "\t@ .word " |
460 << llvm::format_hex_no_prefix(Inst, 8) << "\n"; | 461 << llvm::format_hex_no_prefix(Inst, 8) << "\n"; |
461 return InstARM32::InstSize; | 462 return InstARM32::InstSize; |
462 } | 463 } |
463 | 464 |
464 MoveRelocatableFixup *AssemblerARM32::createMoveFixup(bool IsMovW, | 465 MoveRelocatableFixup *AssemblerARM32::createMoveFixup(bool IsMovW, |
465 const Constant *Value) { | 466 const Constant *Value) { |
466 MoveRelocatableFixup *F = | 467 MoveRelocatableFixup *F = |
467 new (allocate<MoveRelocatableFixup>()) MoveRelocatableFixup(); | 468 new (allocate<MoveRelocatableFixup>()) MoveRelocatableFixup(); |
468 F->set_kind(IsMovW ? llvm::ELF::R_ARM_MOVW_ABS_NC | 469 F->set_kind(IsMovW ? llvm::ELF::R_ARM_MOVW_ABS_NC |
469 : llvm::ELF::R_ARM_MOVT_ABS); | 470 : llvm::ELF::R_ARM_MOVT_ABS); |
470 F->set_value(Value); | 471 F->set_value(Value); |
471 Buffer.installFixup(F); | 472 Buffer.installFixup(F); |
472 return F; | 473 return F; |
473 } | 474 } |
474 | 475 |
475 size_t BlRelocatableFixup::emit(GlobalContext *Ctx, | 476 size_t BlRelocatableFixup::emit(GlobalContext *Ctx, |
476 const Assembler &Asm) const { | 477 const Assembler &Asm) const { |
477 if (!BuildDefs::dump()) | 478 if (!BuildDefs::dump()) |
478 return InstARM32::InstSize; | 479 return InstARM32::InstSize; |
479 Ostream &Str = Ctx->getStrEmit(); | 480 Ostream &Str = Ctx->getStrEmit(); |
480 IValueT Inst = Asm.load<IValueT>(position()); | 481 IValueT Inst = Asm.load<IValueT>(position()); |
481 Str << "\t" | 482 Str << "\t" |
482 << "bl\t" << symbol(Ctx) << "\t@ .word " | 483 "bl\t" << symbol(Ctx) << "\t@ .word " |
483 << llvm::format_hex_no_prefix(Inst, 8) << "\n"; | 484 << llvm::format_hex_no_prefix(Inst, 8) << "\n"; |
484 return InstARM32::InstSize; | 485 return InstARM32::InstSize; |
485 } | 486 } |
486 | 487 |
487 void AssemblerARM32::padWithNop(intptr_t Padding) { | 488 void AssemblerARM32::padWithNop(intptr_t Padding) { |
488 constexpr intptr_t InstWidth = sizeof(IValueT); | 489 constexpr intptr_t InstWidth = sizeof(IValueT); |
489 assert(Padding % InstWidth == 0 && | 490 assert(Padding % InstWidth == 0 && |
490 "Padding not multiple of instruction size"); | 491 "Padding not multiple of instruction size"); |
491 for (intptr_t i = 0; i < Padding; i += InstWidth) | 492 for (intptr_t i = 0; i < Padding; i += InstWidth) |
492 nop(); | 493 nop(); |
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1778 | 1779 |
1779 void AssemblerARM32::uxt(const Operand *OpRd, const Operand *OpSrc0, | 1780 void AssemblerARM32::uxt(const Operand *OpRd, const Operand *OpSrc0, |
1780 CondARM32::Cond Cond) { | 1781 CondARM32::Cond Cond) { |
1781 constexpr const char *UxtName = "uxt"; | 1782 constexpr const char *UxtName = "uxt"; |
1782 constexpr IValueT UxtOpcode = B26 | B25 | B23 | B22 | B21; | 1783 constexpr IValueT UxtOpcode = B26 | B25 | B23 | B22 | B21; |
1783 emitSignExtend(Cond, UxtOpcode, OpRd, OpSrc0, UxtName); | 1784 emitSignExtend(Cond, UxtOpcode, OpRd, OpSrc0, UxtName); |
1784 } | 1785 } |
1785 | 1786 |
1786 } // end of namespace ARM32 | 1787 } // end of namespace ARM32 |
1787 } // end of namespace Ice | 1788 } // end of namespace Ice |
OLD | NEW |