Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: src/IceAssemblerARM32.cpp

Issue 1523873003: Subzero: Separate "\t" from "opcode" in asm emission. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Use string concatenation where possible Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/IceInst.cpp » ('j') | src/IceInstARM32.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | src/IceInst.cpp » ('j') | src/IceInstARM32.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698