OLD | NEW |
1 //===- subzero/src/IceTargetLoweringARM32.cpp - ARM32 lowering ------------===// | 1 //===- subzero/src/IceTargetLoweringARM32.cpp - ARM32 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 std::array<uint32_t, NumFP64Args> FP64ArgInitializer; | 264 std::array<uint32_t, NumFP64Args> FP64ArgInitializer; |
265 | 265 |
266 constexpr SizeT NumVec128Args = | 266 constexpr SizeT NumVec128Args = |
267 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \ | 267 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \ |
268 isGPR, isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \ | 268 isGPR, isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \ |
269 +(((cc_arg > 0)) ? 1 : 0) | 269 +(((cc_arg > 0)) ? 1 : 0) |
270 REGARM32_VEC128_TABLE | 270 REGARM32_VEC128_TABLE |
271 #undef X | 271 #undef X |
272 ; | 272 ; |
273 std::array<uint32_t, NumVec128Args> Vec128ArgInitializer; | 273 std::array<uint32_t, NumVec128Args> Vec128ArgInitializer; |
| 274 |
| 275 IceString getRegClassName(RegClass C) { |
| 276 auto ClassNum = static_cast<RegARM32::RegClassARM32>(C); |
| 277 assert(ClassNum < RegARM32::RCARM32_NUM); |
| 278 switch (ClassNum) { |
| 279 default: |
| 280 assert(C < RC_Target); |
| 281 return regClassString(C); |
| 282 // Add handling of new register classes below. |
| 283 } |
| 284 } |
| 285 |
274 } // end of anonymous namespace | 286 } // end of anonymous namespace |
275 | 287 |
276 TargetARM32::TargetARM32(Cfg *Func) | 288 TargetARM32::TargetARM32(Cfg *Func) |
277 : TargetLowering(Func), NeedSandboxing(Ctx->getFlags().getUseSandboxing()), | 289 : TargetLowering(Func), NeedSandboxing(Ctx->getFlags().getUseSandboxing()), |
278 CPUFeatures(Func->getContext()->getFlags()) {} | 290 CPUFeatures(Func->getContext()->getFlags()) {} |
279 | 291 |
280 void TargetARM32::staticInit(GlobalContext *Ctx) { | 292 void TargetARM32::staticInit(GlobalContext *Ctx) { |
281 | 293 |
282 // Limit this size (or do all bitsets need to be the same width)??? | 294 // Limit this size (or do all bitsets need to be the same width)??? |
283 llvm::SmallBitVector IntegerRegisters(RegARM32::Reg_NUM); | 295 llvm::SmallBitVector IntegerRegisters(RegARM32::Reg_NUM); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 TypeToRegisterSet[IceType_f64] = Float64Registers; | 336 TypeToRegisterSet[IceType_f64] = Float64Registers; |
325 TypeToRegisterSet[IceType_v4i1] = VectorRegisters; | 337 TypeToRegisterSet[IceType_v4i1] = VectorRegisters; |
326 TypeToRegisterSet[IceType_v8i1] = VectorRegisters; | 338 TypeToRegisterSet[IceType_v8i1] = VectorRegisters; |
327 TypeToRegisterSet[IceType_v16i1] = VectorRegisters; | 339 TypeToRegisterSet[IceType_v16i1] = VectorRegisters; |
328 TypeToRegisterSet[IceType_v16i8] = VectorRegisters; | 340 TypeToRegisterSet[IceType_v16i8] = VectorRegisters; |
329 TypeToRegisterSet[IceType_v8i16] = VectorRegisters; | 341 TypeToRegisterSet[IceType_v8i16] = VectorRegisters; |
330 TypeToRegisterSet[IceType_v4i32] = VectorRegisters; | 342 TypeToRegisterSet[IceType_v4i32] = VectorRegisters; |
331 TypeToRegisterSet[IceType_v4f32] = VectorRegisters; | 343 TypeToRegisterSet[IceType_v4f32] = VectorRegisters; |
332 | 344 |
333 filterTypeToRegisterSet( | 345 filterTypeToRegisterSet( |
334 Ctx, RegARM32::Reg_NUM, TypeToRegisterSet, RegARM32::RCARM32_NUM, | 346 Ctx, RegARM32::Reg_NUM, TypeToRegisterSet, |
335 [](int32_t RegNum) -> IceString { | 347 llvm::array_lengthof(TypeToRegisterSet), [](int32_t RegNum) -> IceString { |
| 348 // This function simply removes ", " from the register name. |
336 IceString Name = RegARM32::getRegName(RegNum); | 349 IceString Name = RegARM32::getRegName(RegNum); |
337 constexpr const char RegSeparator[] = ", "; | 350 constexpr const char RegSeparator[] = ", "; |
338 constexpr size_t RegSeparatorWidth = | 351 constexpr size_t RegSeparatorWidth = |
339 llvm::array_lengthof(RegSeparator) - 1; | 352 llvm::array_lengthof(RegSeparator) - 1; |
340 for (size_t Pos = Name.find(RegSeparator); Pos != std::string::npos; | 353 for (size_t Pos = Name.find(RegSeparator); Pos != std::string::npos; |
341 Pos = Name.find(RegSeparator)) { | 354 Pos = Name.find(RegSeparator)) { |
342 Name.replace(Pos, RegSeparatorWidth, ":"); | 355 Name.replace(Pos, RegSeparatorWidth, ""); |
343 } | 356 } |
344 return Name; | 357 return Name; |
345 }); | 358 }, getRegClassName); |
346 } | 359 } |
347 | 360 |
348 namespace { | 361 namespace { |
349 void copyRegAllocFromInfWeightVariable64On32(const VarList &Vars) { | 362 void copyRegAllocFromInfWeightVariable64On32(const VarList &Vars) { |
350 for (Variable *Var : Vars) { | 363 for (Variable *Var : Vars) { |
351 auto *Var64 = llvm::dyn_cast<Variable64On32>(Var); | 364 auto *Var64 = llvm::dyn_cast<Variable64On32>(Var); |
352 if (!Var64) { | 365 if (!Var64) { |
353 // This is not the variable we are looking for. | 366 // This is not the variable we are looking for. |
354 continue; | 367 continue; |
355 } | 368 } |
(...skipping 6092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6448 << ".eabi_attribute 42, 1 @ Tag_MPextension_use\n" | 6461 << ".eabi_attribute 42, 1 @ Tag_MPextension_use\n" |
6449 << ".eabi_attribute 68, 1 @ Tag_Virtualization_use\n"; | 6462 << ".eabi_attribute 68, 1 @ Tag_Virtualization_use\n"; |
6450 if (CPUFeatures.hasFeature(TargetARM32Features::HWDivArm)) { | 6463 if (CPUFeatures.hasFeature(TargetARM32Features::HWDivArm)) { |
6451 Str << ".eabi_attribute 44, 2 @ Tag_DIV_use\n"; | 6464 Str << ".eabi_attribute 44, 2 @ Tag_DIV_use\n"; |
6452 } | 6465 } |
6453 // Technically R9 is used for TLS with Sandboxing, and we reserve it. | 6466 // Technically R9 is used for TLS with Sandboxing, and we reserve it. |
6454 // However, for compatibility with current NaCl LLVM, don't claim that. | 6467 // However, for compatibility with current NaCl LLVM, don't claim that. |
6455 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; | 6468 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; |
6456 } | 6469 } |
6457 | 6470 |
6458 llvm::SmallBitVector TargetARM32::TypeToRegisterSet[IceType_NUM]; | 6471 llvm::SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM]; |
6459 llvm::SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; | 6472 llvm::SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; |
6460 | 6473 |
6461 } // end of namespace ARM32 | 6474 } // end of namespace ARM32 |
6462 } // end of namespace Ice | 6475 } // end of namespace Ice |
OLD | NEW |