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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 size_t MoveRelocatableFixup::emit(GlobalContext *Ctx, | 492 size_t MoveRelocatableFixup::emit(GlobalContext *Ctx, |
493 const Assembler &Asm) const { | 493 const Assembler &Asm) const { |
494 if (!BuildDefs::dump()) | 494 if (!BuildDefs::dump()) |
495 return InstARM32::InstSize; | 495 return InstARM32::InstSize; |
496 Ostream &Str = Ctx->getStrEmit(); | 496 Ostream &Str = Ctx->getStrEmit(); |
497 IValueT Inst = Asm.load<IValueT>(position()); | 497 IValueT Inst = Asm.load<IValueT>(position()); |
498 Str << "\t" | 498 Str << "\t" |
499 "mov" << (kind() == llvm::ELF::R_ARM_MOVW_ABS_NC ? "w" : "t") << "\t" | 499 "mov" << (kind() == llvm::ELF::R_ARM_MOVW_ABS_NC ? "w" : "t") << "\t" |
500 << RegARM32::getRegName((Inst >> kRdShift) & 0xF) | 500 << RegARM32::getRegName((Inst >> kRdShift) & 0xF) |
501 << ", #:" << (kind() == llvm::ELF::R_ARM_MOVW_ABS_NC ? "lower" : "upper") | 501 << ", #:" << (kind() == llvm::ELF::R_ARM_MOVW_ABS_NC ? "lower" : "upper") |
502 << "16:" << symbol(Ctx) << "\t@ .word " | 502 << "16:" << symbol(Ctx, &Asm) << "\t@ .word " |
503 << llvm::format_hex_no_prefix(Inst, 8) << "\n"; | 503 << llvm::format_hex_no_prefix(Inst, 8) << "\n"; |
504 return InstARM32::InstSize; | 504 return InstARM32::InstSize; |
505 } | 505 } |
506 | 506 |
507 MoveRelocatableFixup *AssemblerARM32::createMoveFixup(bool IsMovW, | 507 MoveRelocatableFixup *AssemblerARM32::createMoveFixup(bool IsMovW, |
508 const Constant *Value) { | 508 const Constant *Value) { |
509 MoveRelocatableFixup *F = | 509 MoveRelocatableFixup *F = |
510 new (allocate<MoveRelocatableFixup>()) MoveRelocatableFixup(); | 510 new (allocate<MoveRelocatableFixup>()) MoveRelocatableFixup(); |
511 F->set_kind(IsMovW ? llvm::ELF::R_ARM_MOVW_ABS_NC | 511 F->set_kind(IsMovW ? llvm::ELF::R_ARM_MOVW_ABS_NC |
512 : llvm::ELF::R_ARM_MOVT_ABS); | 512 : llvm::ELF::R_ARM_MOVT_ABS); |
513 F->set_value(Value); | 513 F->set_value(Value); |
514 Buffer.installFixup(F); | 514 Buffer.installFixup(F); |
515 return F; | 515 return F; |
516 } | 516 } |
517 | 517 |
518 size_t BlRelocatableFixup::emit(GlobalContext *Ctx, | 518 size_t BlRelocatableFixup::emit(GlobalContext *Ctx, |
519 const Assembler &Asm) const { | 519 const Assembler &Asm) const { |
520 if (!BuildDefs::dump()) | 520 if (!BuildDefs::dump()) |
521 return InstARM32::InstSize; | 521 return InstARM32::InstSize; |
522 Ostream &Str = Ctx->getStrEmit(); | 522 Ostream &Str = Ctx->getStrEmit(); |
523 IValueT Inst = Asm.load<IValueT>(position()); | 523 IValueT Inst = Asm.load<IValueT>(position()); |
524 Str << "\t" | 524 Str << "\t" |
525 "bl\t" << symbol(Ctx) << "\t@ .word " | 525 "bl\t" << symbol(Ctx, &Asm) << "\t@ .word " |
526 << llvm::format_hex_no_prefix(Inst, 8) << "\n"; | 526 << llvm::format_hex_no_prefix(Inst, 8) << "\n"; |
527 return InstARM32::InstSize; | 527 return InstARM32::InstSize; |
528 } | 528 } |
529 | 529 |
530 void AssemblerARM32::padWithNop(intptr_t Padding) { | 530 void AssemblerARM32::padWithNop(intptr_t Padding) { |
531 constexpr intptr_t InstWidth = sizeof(IValueT); | 531 constexpr intptr_t InstWidth = sizeof(IValueT); |
532 assert(Padding % InstWidth == 0 && | 532 assert(Padding % InstWidth == 0 && |
533 "Padding not multiple of instruction size"); | 533 "Padding not multiple of instruction size"); |
534 for (intptr_t i = 0; i < Padding; i += InstWidth) | 534 for (intptr_t i = 0; i < Padding; i += InstWidth) |
535 nop(); | 535 nop(); |
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2051 // cccc11010D101101dddd1010iiiiiiii where cccc=Cond, ddddD=BaseReg, and | 2051 // cccc11010D101101dddd1010iiiiiiii where cccc=Cond, ddddD=BaseReg, and |
2052 // iiiiiiii=NumConsecRegs. | 2052 // iiiiiiii=NumConsecRegs. |
2053 constexpr const char *VpushName = "vpush"; | 2053 constexpr const char *VpushName = "vpush"; |
2054 constexpr IValueT VpushOpcode = | 2054 constexpr IValueT VpushOpcode = |
2055 B27 | B26 | B24 | B21 | B19 | B18 | B16 | B11 | B9; | 2055 B27 | B26 | B24 | B21 | B19 | B18 | B16 | B11 | B9; |
2056 emitVStackOp(Cond, VpushOpcode, OpBaseReg, NumConsecRegs, VpushName); | 2056 emitVStackOp(Cond, VpushOpcode, OpBaseReg, NumConsecRegs, VpushName); |
2057 } | 2057 } |
2058 | 2058 |
2059 } // end of namespace ARM32 | 2059 } // end of namespace ARM32 |
2060 } // end of namespace Ice | 2060 } // end of namespace Ice |
OLD | NEW |