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 2204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2215 // bit-manipulation problems below. | 2215 // bit-manipulation problems below. |
2216 const uint32_t AlignmentParam = std::max(1u, Instr->getAlignInBytes()); | 2216 const uint32_t AlignmentParam = std::max(1u, Instr->getAlignInBytes()); |
2217 | 2217 |
2218 // LLVM enforces power of 2 alignment. | 2218 // LLVM enforces power of 2 alignment. |
2219 assert(llvm::isPowerOf2_32(AlignmentParam)); | 2219 assert(llvm::isPowerOf2_32(AlignmentParam)); |
2220 assert(llvm::isPowerOf2_32(ARM32_STACK_ALIGNMENT_BYTES)); | 2220 assert(llvm::isPowerOf2_32(ARM32_STACK_ALIGNMENT_BYTES)); |
2221 | 2221 |
2222 const uint32_t Alignment = | 2222 const uint32_t Alignment = |
2223 std::max(AlignmentParam, ARM32_STACK_ALIGNMENT_BYTES); | 2223 std::max(AlignmentParam, ARM32_STACK_ALIGNMENT_BYTES); |
2224 const bool OverAligned = Alignment > ARM32_STACK_ALIGNMENT_BYTES; | 2224 const bool OverAligned = Alignment > ARM32_STACK_ALIGNMENT_BYTES; |
2225 const bool OptM1 = getFlags().getOptLevel() == Opt_m1; | 2225 const bool OptM1 = Func->getOptLevel() == Opt_m1; |
2226 const bool AllocaWithKnownOffset = Instr->getKnownFrameOffset(); | 2226 const bool AllocaWithKnownOffset = Instr->getKnownFrameOffset(); |
2227 const bool UseFramePointer = | 2227 const bool UseFramePointer = |
2228 hasFramePointer() || OverAligned || !AllocaWithKnownOffset || OptM1; | 2228 hasFramePointer() || OverAligned || !AllocaWithKnownOffset || OptM1; |
2229 | 2229 |
2230 if (UseFramePointer) | 2230 if (UseFramePointer) |
2231 setHasFramePointer(); | 2231 setHasFramePointer(); |
2232 | 2232 |
2233 Variable *SP = getPhysicalRegister(RegARM32::Reg_sp); | 2233 Variable *SP = getPhysicalRegister(RegARM32::Reg_sp); |
2234 if (OverAligned) { | 2234 if (OverAligned) { |
2235 Sandboxer(this).align_sp(Alignment); | 2235 Sandboxer(this).align_sp(Alignment); |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3319 Variable *Src1R = Srcs.unswappedSrc1R(this); | 3319 Variable *Src1R = Srcs.unswappedSrc1R(this); |
3320 if (isVectorType(DestTy)) { | 3320 if (isVectorType(DestTy)) { |
3321 _vsub(T, Src0R, Src1R); | 3321 _vsub(T, Src0R, Src1R); |
3322 } else { | 3322 } else { |
3323 _sub(T, Src0R, Src1R); | 3323 _sub(T, Src0R, Src1R); |
3324 } | 3324 } |
3325 _mov(Dest, T); | 3325 _mov(Dest, T); |
3326 return; | 3326 return; |
3327 } | 3327 } |
3328 case InstArithmetic::Mul: { | 3328 case InstArithmetic::Mul: { |
3329 const bool OptM1 = getFlags().getOptLevel() == Opt_m1; | 3329 const bool OptM1 = Func->getOptLevel() == Opt_m1; |
3330 if (!OptM1 && Srcs.hasConstOperand()) { | 3330 if (!OptM1 && Srcs.hasConstOperand()) { |
3331 constexpr std::size_t MaxShifts = 4; | 3331 constexpr std::size_t MaxShifts = 4; |
3332 std::array<StrengthReduction::AggregationElement, MaxShifts> Shifts; | 3332 std::array<StrengthReduction::AggregationElement, MaxShifts> Shifts; |
3333 SizeT NumOperations; | 3333 SizeT NumOperations; |
3334 int32_t Const = Srcs.getConstantValue(); | 3334 int32_t Const = Srcs.getConstantValue(); |
3335 const bool Invert = Const < 0; | 3335 const bool Invert = Const < 0; |
3336 const bool MultiplyByZero = Const == 0; | 3336 const bool MultiplyByZero = Const == 0; |
3337 Operand *_0 = | 3337 Operand *_0 = |
3338 legalize(Ctx->getConstantZero(DestTy), Legal_Reg | Legal_Flex); | 3338 legalize(Ctx->getConstantZero(DestTy), Legal_Reg | Legal_Flex); |
3339 | 3339 |
(...skipping 3025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6365 TmpRegNum); | 6365 TmpRegNum); |
6366 _bic(Reg, Reg, Mask); | 6366 _bic(Reg, Reg, Mask); |
6367 } else { | 6367 } else { |
6368 Mask = legalize(Ctx->getConstantInt32(-Align), Legal_Reg | Legal_Flex, | 6368 Mask = legalize(Ctx->getConstantInt32(-Align), Legal_Reg | Legal_Flex, |
6369 TmpRegNum); | 6369 TmpRegNum); |
6370 _and(Reg, Reg, Mask); | 6370 _and(Reg, Reg, Mask); |
6371 } | 6371 } |
6372 } | 6372 } |
6373 | 6373 |
6374 void TargetARM32::postLower() { | 6374 void TargetARM32::postLower() { |
6375 if (getFlags().getOptLevel() == Opt_m1) | 6375 if (Func->getOptLevel() == Opt_m1) |
6376 return; | 6376 return; |
6377 markRedefinitions(); | 6377 markRedefinitions(); |
6378 Context.availabilityUpdate(); | 6378 Context.availabilityUpdate(); |
6379 } | 6379 } |
6380 | 6380 |
6381 void TargetARM32::makeRandomRegisterPermutation( | 6381 void TargetARM32::makeRandomRegisterPermutation( |
6382 llvm::SmallVectorImpl<RegNumT> &Permutation, | 6382 llvm::SmallVectorImpl<RegNumT> &Permutation, |
6383 const SmallBitVector &ExcludeRegisters, uint64_t Salt) const { | 6383 const SmallBitVector &ExcludeRegisters, uint64_t Salt) const { |
6384 (void)Permutation; | 6384 (void)Permutation; |
6385 (void)ExcludeRegisters; | 6385 (void)ExcludeRegisters; |
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7147 // However, for compatibility with current NaCl LLVM, don't claim that. | 7147 // However, for compatibility with current NaCl LLVM, don't claim that. |
7148 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; | 7148 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; |
7149 } | 7149 } |
7150 | 7150 |
7151 SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM]; | 7151 SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM]; |
7152 SmallBitVector TargetARM32::TypeToRegisterSetUnfiltered[RegARM32::RCARM32_NUM]; | 7152 SmallBitVector TargetARM32::TypeToRegisterSetUnfiltered[RegARM32::RCARM32_NUM]; |
7153 SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; | 7153 SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; |
7154 | 7154 |
7155 } // end of namespace ARM32 | 7155 } // end of namespace ARM32 |
7156 } // end of namespace Ice | 7156 } // end of namespace Ice |
OLD | NEW |