| 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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 size_t MoveRelocatableFixup::emit(GlobalContext *Ctx, | 483 size_t MoveRelocatableFixup::emit(GlobalContext *Ctx, |
| 484 const Assembler &Asm) const { | 484 const Assembler &Asm) const { |
| 485 if (!BuildDefs::dump()) | 485 if (!BuildDefs::dump()) |
| 486 return InstARM32::InstSize; | 486 return InstARM32::InstSize; |
| 487 Ostream &Str = Ctx->getStrEmit(); | 487 Ostream &Str = Ctx->getStrEmit(); |
| 488 IValueT Inst = Asm.load<IValueT>(position()); | 488 IValueT Inst = Asm.load<IValueT>(position()); |
| 489 Str << "\t" | 489 Str << "\t" |
| 490 "mov" << (kind() == llvm::ELF::R_ARM_MOVW_ABS_NC ? "w" : "t") << "\t" | 490 "mov" << (kind() == llvm::ELF::R_ARM_MOVW_ABS_NC ? "w" : "t") << "\t" |
| 491 << RegARM32::RegNames[(Inst >> kRdShift) & 0xF] | 491 << RegARM32::RegNames[(Inst >> kRdShift) & 0xF] |
| 492 << ", #:" << (kind() == llvm::ELF::R_ARM_MOVW_ABS_NC ? "lower" : "upper") | 492 << ", #:" << (kind() == llvm::ELF::R_ARM_MOVW_ABS_NC ? "lower" : "upper") |
| 493 << "16:" << symbol(Ctx) << "\t@ .word " | 493 << "16:" << symbol(Ctx, &Asm) << "\t@ .word " |
| 494 << llvm::format_hex_no_prefix(Inst, 8) << "\n"; | 494 << llvm::format_hex_no_prefix(Inst, 8) << "\n"; |
| 495 return InstARM32::InstSize; | 495 return InstARM32::InstSize; |
| 496 } | 496 } |
| 497 | 497 |
| 498 MoveRelocatableFixup *AssemblerARM32::createMoveFixup(bool IsMovW, | 498 MoveRelocatableFixup *AssemblerARM32::createMoveFixup(bool IsMovW, |
| 499 const Constant *Value) { | 499 const Constant *Value) { |
| 500 MoveRelocatableFixup *F = | 500 MoveRelocatableFixup *F = |
| 501 new (allocate<MoveRelocatableFixup>()) MoveRelocatableFixup(); | 501 new (allocate<MoveRelocatableFixup>()) MoveRelocatableFixup(); |
| 502 F->set_kind(IsMovW ? llvm::ELF::R_ARM_MOVW_ABS_NC | 502 F->set_kind(IsMovW ? llvm::ELF::R_ARM_MOVW_ABS_NC |
| 503 : llvm::ELF::R_ARM_MOVT_ABS); | 503 : llvm::ELF::R_ARM_MOVT_ABS); |
| 504 F->set_value(Value); | 504 F->set_value(Value); |
| 505 Buffer.installFixup(F); | 505 Buffer.installFixup(F); |
| 506 return F; | 506 return F; |
| 507 } | 507 } |
| 508 | 508 |
| 509 size_t BlRelocatableFixup::emit(GlobalContext *Ctx, | 509 size_t BlRelocatableFixup::emit(GlobalContext *Ctx, |
| 510 const Assembler &Asm) const { | 510 const Assembler &Asm) const { |
| 511 if (!BuildDefs::dump()) | 511 if (!BuildDefs::dump()) |
| 512 return InstARM32::InstSize; | 512 return InstARM32::InstSize; |
| 513 Ostream &Str = Ctx->getStrEmit(); | 513 Ostream &Str = Ctx->getStrEmit(); |
| 514 IValueT Inst = Asm.load<IValueT>(position()); | 514 IValueT Inst = Asm.load<IValueT>(position()); |
| 515 Str << "\t" | 515 Str << "\t" |
| 516 "bl\t" << symbol(Ctx) << "\t@ .word " | 516 "bl\t" << symbol(Ctx, &Asm) << "\t@ .word " |
| 517 << llvm::format_hex_no_prefix(Inst, 8) << "\n"; | 517 << llvm::format_hex_no_prefix(Inst, 8) << "\n"; |
| 518 return InstARM32::InstSize; | 518 return InstARM32::InstSize; |
| 519 } | 519 } |
| 520 | 520 |
| 521 void AssemblerARM32::padWithNop(intptr_t Padding) { | 521 void AssemblerARM32::padWithNop(intptr_t Padding) { |
| 522 constexpr intptr_t InstWidth = sizeof(IValueT); | 522 constexpr intptr_t InstWidth = sizeof(IValueT); |
| 523 assert(Padding % InstWidth == 0 && | 523 assert(Padding % InstWidth == 0 && |
| 524 "Padding not multiple of instruction size"); | 524 "Padding not multiple of instruction size"); |
| 525 for (intptr_t i = 0; i < Padding; i += InstWidth) | 525 for (intptr_t i = 0; i < Padding; i += InstWidth) |
| 526 nop(); | 526 nop(); |
| (...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1956 | 1956 |
| 1957 void AssemblerARM32::uxt(const Operand *OpRd, const Operand *OpSrc0, | 1957 void AssemblerARM32::uxt(const Operand *OpRd, const Operand *OpSrc0, |
| 1958 CondARM32::Cond Cond) { | 1958 CondARM32::Cond Cond) { |
| 1959 constexpr const char *UxtName = "uxt"; | 1959 constexpr const char *UxtName = "uxt"; |
| 1960 constexpr IValueT UxtOpcode = B26 | B25 | B23 | B22 | B21; | 1960 constexpr IValueT UxtOpcode = B26 | B25 | B23 | B22 | B21; |
| 1961 emitSignExtend(Cond, UxtOpcode, OpRd, OpSrc0, UxtName); | 1961 emitSignExtend(Cond, UxtOpcode, OpRd, OpSrc0, UxtName); |
| 1962 } | 1962 } |
| 1963 | 1963 |
| 1964 } // end of namespace ARM32 | 1964 } // end of namespace ARM32 |
| 1965 } // end of namespace Ice | 1965 } // end of namespace Ice |
| OLD | NEW |