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

Side by Side Diff: src/IceTargetLoweringMIPS32.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/IceTargetLoweringMIPS32.h ('k') | src/IceTargetLoweringX8632.cpp » ('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/IceTargetLoweringMIPS32.cpp - MIPS32 lowering ----------===// 1 //===- subzero/src/IceTargetLoweringMIPS32.cpp - MIPS32 lowering ----------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 30 matching lines...) Expand all
41 } 41 }
42 42
43 std::unique_ptr<::Ice::TargetHeaderLowering> 43 std::unique_ptr<::Ice::TargetHeaderLowering>
44 createTargetHeaderLowering(::Ice::GlobalContext *Ctx) { 44 createTargetHeaderLowering(::Ice::GlobalContext *Ctx) {
45 return ::Ice::MIPS32::TargetHeaderMIPS32::create(Ctx); 45 return ::Ice::MIPS32::TargetHeaderMIPS32::create(Ctx);
46 } 46 }
47 47
48 void staticInit(::Ice::GlobalContext *Ctx) { 48 void staticInit(::Ice::GlobalContext *Ctx) {
49 ::Ice::MIPS32::TargetMIPS32::staticInit(Ctx); 49 ::Ice::MIPS32::TargetMIPS32::staticInit(Ctx);
50 } 50 }
51
52 bool shouldBePooled(const ::Ice::Constant *C) {
53 return ::Ice::MIPS32::TargetMIPS32::shouldBePooled(C);
54 }
51 } // end of namespace MIPS32 55 } // end of namespace MIPS32
52 56
53 namespace Ice { 57 namespace Ice {
54 namespace MIPS32 { 58 namespace MIPS32 {
55 59
56 using llvm::isInt; 60 using llvm::isInt;
57 61
58 namespace { 62 namespace {
59 63
60 // The maximum number of arguments to pass in GPR registers. 64 // The maximum number of arguments to pass in GPR registers.
61 constexpr uint32_t MIPS32_MAX_GPR_ARG = 4; 65 constexpr uint32_t MIPS32_MAX_GPR_ARG = 4;
62 66
63 IceString getRegClassName(RegClass C) { 67 const char *getRegClassName(RegClass C) {
64 auto ClassNum = static_cast<RegClassMIPS32>(C); 68 auto ClassNum = static_cast<RegClassMIPS32>(C);
65 assert(ClassNum < RCMIPS32_NUM); 69 assert(ClassNum < RCMIPS32_NUM);
66 switch (ClassNum) { 70 switch (ClassNum) {
67 default: 71 default:
68 assert(C < RC_Target); 72 assert(C < RC_Target);
69 return regClassString(C); 73 return regClassString(C);
70 // Add handling of new register classes below. 74 // Add handling of new register classes below.
71 } 75 }
72 } 76 }
73 77
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 #undef X 293 #undef X
290 }; 294 };
291 295
292 } // end of anonymous namespace 296 } // end of anonymous namespace
293 297
294 const char *RegMIPS32::getRegName(RegNumT RegNum) { 298 const char *RegMIPS32::getRegName(RegNumT RegNum) {
295 RegNum.assertIsValid(); 299 RegNum.assertIsValid();
296 return RegNames[RegNum]; 300 return RegNames[RegNum];
297 } 301 }
298 302
299 IceString TargetMIPS32::getRegName(RegNumT RegNum, Type Ty) const { 303 const char *TargetMIPS32::getRegName(RegNumT RegNum, Type Ty) const {
300 (void)Ty; 304 (void)Ty;
301 return RegMIPS32::getRegName(RegNum); 305 return RegMIPS32::getRegName(RegNum);
302 } 306 }
303 307
304 Variable *TargetMIPS32::getPhysicalRegister(RegNumT RegNum, Type Ty) { 308 Variable *TargetMIPS32::getPhysicalRegister(RegNumT RegNum, Type Ty) {
305 if (Ty == IceType_void) 309 if (Ty == IceType_void)
306 Ty = IceType_i32; 310 Ty = IceType_i32;
307 if (PhysicalRegisters[Ty].empty()) 311 if (PhysicalRegisters[Ty].empty())
308 PhysicalRegisters[Ty].resize(RegMIPS32::Reg_NUM); 312 PhysicalRegisters[Ty].resize(RegMIPS32::Reg_NUM);
309 RegNum.assertIsValid(); 313 RegNum.assertIsValid();
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 1193
1190 void ConstantUndef::emit(GlobalContext *) const { 1194 void ConstantUndef::emit(GlobalContext *) const {
1191 llvm_unreachable("undef value encountered by emitter."); 1195 llvm_unreachable("undef value encountered by emitter.");
1192 } 1196 }
1193 */ 1197 */
1194 1198
1195 TargetDataMIPS32::TargetDataMIPS32(GlobalContext *Ctx) 1199 TargetDataMIPS32::TargetDataMIPS32(GlobalContext *Ctx)
1196 : TargetDataLowering(Ctx) {} 1200 : TargetDataLowering(Ctx) {}
1197 1201
1198 void TargetDataMIPS32::lowerGlobals(const VariableDeclarationList &Vars, 1202 void TargetDataMIPS32::lowerGlobals(const VariableDeclarationList &Vars,
1199 const IceString &SectionSuffix) { 1203 const std::string &SectionSuffix) {
1200 const bool IsPIC = Ctx->getFlags().getUseNonsfi(); 1204 const bool IsPIC = Ctx->getFlags().getUseNonsfi();
1201 switch (Ctx->getFlags().getOutFileType()) { 1205 switch (Ctx->getFlags().getOutFileType()) {
1202 case FT_Elf: { 1206 case FT_Elf: {
1203 ELFObjectWriter *Writer = Ctx->getObjectWriter(); 1207 ELFObjectWriter *Writer = Ctx->getObjectWriter();
1204 Writer->writeDataSection(Vars, llvm::ELF::R_MIPS_GLOB_DAT, SectionSuffix, 1208 Writer->writeDataSection(Vars, llvm::ELF::R_MIPS_GLOB_DAT, SectionSuffix,
1205 IsPIC); 1209 IsPIC);
1206 } break; 1210 } break;
1207 case FT_Asm: 1211 case FT_Asm:
1208 case FT_Iasm: { 1212 case FT_Iasm: {
1209 const IceString &TranslateOnly = Ctx->getFlags().getTranslateOnly(); 1213 const std::string TranslateOnly = Ctx->getFlags().getTranslateOnly();
1210 OstreamLocker L(Ctx); 1214 OstreamLocker L(Ctx);
1211 for (const VariableDeclaration *Var : Vars) { 1215 for (const VariableDeclaration *Var : Vars) {
1212 if (GlobalContext::matchSymbolName(Var->getName(), TranslateOnly)) { 1216 if (GlobalContext::matchSymbolName(Var->getName(), TranslateOnly)) {
1213 emitGlobal(*Var, SectionSuffix); 1217 emitGlobal(*Var, SectionSuffix);
1214 } 1218 }
1215 } 1219 }
1216 } break; 1220 } break;
1217 } 1221 }
1218 } 1222 }
1219 1223
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 Str << "\t.set\t" 1321 Str << "\t.set\t"
1318 << "nomips16\n"; 1322 << "nomips16\n";
1319 } 1323 }
1320 1324
1321 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM]; 1325 SmallBitVector TargetMIPS32::TypeToRegisterSet[RCMIPS32_NUM];
1322 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; 1326 SmallBitVector TargetMIPS32::TypeToRegisterSetUnfiltered[RCMIPS32_NUM];
1323 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM]; 1327 SmallBitVector TargetMIPS32::RegisterAliases[RegMIPS32::Reg_NUM];
1324 1328
1325 } // end of namespace MIPS32 1329 } // end of namespace MIPS32
1326 } // end of namespace Ice 1330 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLoweringMIPS32.h ('k') | src/IceTargetLoweringX8632.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698