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

Side by Side Diff: src/IceAssemblerARM32.cpp

Issue 1838753002: Subzero: Remove IceString. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 4 years, 8 months 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 | « src/IceAssemblerARM32.h ('k') | src/IceBrowserCompileServer.h » ('j') | no next file with comments »
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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(); 596 const auto Symbol = symbol().toString();
597 const bool NeedsPCRelSuffix = 597 const bool NeedsPCRelSuffix =
598 (Asm.fixupIsPCRel(kind()) || Symbol == GlobalOffsetTable); 598 (Asm.fixupIsPCRel(kind()) || Symbol == GlobalOffsetTable);
599 Str << "\t" 599 Str << "\t"
600 "mov" << (IsMovw ? "w" : "t") << "\t" 600 "mov" << (IsMovw ? "w" : "t") << "\t"
601 << RegARM32::getRegName(RegNumT::fixme((Inst >> kRdShift) & 0xF)) 601 << RegARM32::getRegName(RegNumT::fixme((Inst >> kRdShift) & 0xF))
602 << ", #:" << (IsMovw ? "lower" : "upper") << "16:" << Symbol 602 << ", #:" << (IsMovw ? "lower" : "upper") << "16:" << Symbol
603 << (NeedsPCRelSuffix ? " - ." : "") << "\t@ .word " 603 << (NeedsPCRelSuffix ? " - ." : "") << "\t@ .word "
604 // TODO(jpp): This is broken, it also needs to add a magic constant. 604 // TODO(jpp): This is broken, it also needs to add a magic constant.
605 << llvm::format_hex_no_prefix(Inst, 8) << "\n"; 605 << llvm::format_hex_no_prefix(Inst, 8) << "\n";
606 return InstARM32::InstSize; 606 return InstARM32::InstSize;
607 } 607 }
608 608
609 IValueT AssemblerARM32::encodeElmtType(Type ElmtTy) { 609 IValueT AssemblerARM32::encodeElmtType(Type ElmtTy) {
610 switch (ElmtTy) { 610 switch (ElmtTy) {
611 case IceType_i8: 611 case IceType_i8:
612 return 0; 612 return 0;
613 case IceType_i16: 613 case IceType_i16:
614 return 1; 614 return 1;
615 case IceType_i32: 615 case IceType_i32:
616 case IceType_f32: 616 case IceType_f32:
617 return 2; 617 return 2;
618 case IceType_i64: 618 case IceType_i64:
619 return 3; 619 return 3;
620 default: 620 default:
621 llvm::report_fatal_error("SIMD op: Don't understand element type " + 621 llvm::report_fatal_error("SIMD op: Don't understand element type " +
622 typeIceString(ElmtTy)); 622 typeStdString(ElmtTy));
623 } 623 }
624 } 624 }
625 625
626 // This fixup points to an ARM32 instruction with the following format: 626 // This fixup points to an ARM32 instruction with the following format:
627 void MoveRelocatableFixup::emitOffset(Assembler *Asm) const { 627 void MoveRelocatableFixup::emitOffset(Assembler *Asm) const {
628 // cccc00110T00iiiiddddiiiiiiiiiiii where cccc=Cond, dddd=Rd, 628 // cccc00110T00iiiiddddiiiiiiiiiiii where cccc=Cond, dddd=Rd,
629 // iiiiiiiiiiiiiiii = Imm16, and T=1 for movt. 629 // iiiiiiiiiiiiiiii = Imm16, and T=1 for movt.
630 630
631 const IValueT Inst = Asm->load<IValueT>(position()); 631 const IValueT Inst = Asm->load<IValueT>(position());
632 constexpr IValueT Imm16Mask = 0x000F0FFF; 632 constexpr IValueT Imm16Mask = 0x000F0FFF;
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 assert(Rt != RegARM32::Encoded_Reg_pc); 1035 assert(Rt != RegARM32::Encoded_Reg_pc);
1036 assert(Rt != RegARM32::Encoded_Reg_sp); 1036 assert(Rt != RegARM32::Encoded_Reg_sp);
1037 assert(CondARM32::isDefined(Cond)); 1037 assert(CondARM32::isDefined(Cond));
1038 const uint32_t BitSize = typeWidthInBytes(OpRt->getType()) * CHAR_BIT; 1038 const uint32_t BitSize = typeWidthInBytes(OpRt->getType()) * CHAR_BIT;
1039 IValueT Opcode1 = 0; 1039 IValueT Opcode1 = 0;
1040 IValueT Opcode2 = 0; 1040 IValueT Opcode2 = 0;
1041 switch (BitSize) { 1041 switch (BitSize) {
1042 default: 1042 default:
1043 llvm::report_fatal_error(std::string(InstName) + 1043 llvm::report_fatal_error(std::string(InstName) +
1044 ": Unable to process type " + 1044 ": Unable to process type " +
1045 typeIceString(OpRt->getType())); 1045 typeStdString(OpRt->getType()));
1046 case 8: 1046 case 8:
1047 assert(Index < 16); 1047 assert(Index < 16);
1048 Dn = Dn | mask(Index, 3, 1); 1048 Dn = Dn | mask(Index, 3, 1);
1049 Opcode1 = B1 | mask(Index, 2, 1); 1049 Opcode1 = B1 | mask(Index, 2, 1);
1050 Opcode2 = mask(Index, 0, 2); 1050 Opcode2 = mask(Index, 0, 2);
1051 break; 1051 break;
1052 case 16: 1052 case 16:
1053 assert(Index < 8); 1053 assert(Index < 8);
1054 Dn = Dn | mask(Index, 2, 1); 1054 Dn = Dn | mask(Index, 2, 1);
1055 Opcode1 = mask(Index, 1, 1); 1055 Opcode1 = mask(Index, 1, 1);
(...skipping 2145 matching lines...) Expand 10 before | Expand all | Expand 10 after
3201 constexpr const char *Vsqrts = "vsqrts"; 3201 constexpr const char *Vsqrts = "vsqrts";
3202 IValueT Sd = encodeSRegister(OpSd, "Sd", Vsqrts); 3202 IValueT Sd = encodeSRegister(OpSd, "Sd", Vsqrts);
3203 IValueT Sm = encodeSRegister(OpSm, "Sm", Vsqrts); 3203 IValueT Sm = encodeSRegister(OpSm, "Sm", Vsqrts);
3204 constexpr IValueT VsqrtsOpcode = B23 | B21 | B20 | B16 | B7 | B6; 3204 constexpr IValueT VsqrtsOpcode = B23 | B21 | B20 | B16 | B7 | B6;
3205 constexpr IValueT S0 = 0; 3205 constexpr IValueT S0 = 0;
3206 emitVFPsss(Cond, VsqrtsOpcode, Sd, S0, Sm); 3206 emitVFPsss(Cond, VsqrtsOpcode, Sd, S0, Sm);
3207 } 3207 }
3208 3208
3209 } // end of namespace ARM32 3209 } // end of namespace ARM32
3210 } // end of namespace Ice 3210 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceAssemblerARM32.h ('k') | src/IceBrowserCompileServer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698