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 2605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2616 | 2616 |
2617 bool aggregateWithAdd() const { | 2617 bool aggregateWithAdd() const { |
2618 switch (Op) { | 2618 switch (Op) { |
2619 case AO_Invalid: | 2619 case AO_Invalid: |
2620 llvm::report_fatal_error("Invalid Strength Reduction Operations."); | 2620 llvm::report_fatal_error("Invalid Strength Reduction Operations."); |
2621 case AO_Add: | 2621 case AO_Add: |
2622 return true; | 2622 return true; |
2623 case AO_Sub: | 2623 case AO_Sub: |
2624 return false; | 2624 return false; |
2625 } | 2625 } |
| 2626 llvm_unreachable("(silence g++ warning)"); |
2626 } | 2627 } |
2627 | 2628 |
2628 uint32_t shAmt() const { return ShAmt; } | 2629 uint32_t shAmt() const { return ShAmt; } |
2629 | 2630 |
2630 private: | 2631 private: |
2631 AggregationOperation Op = AO_Invalid; | 2632 AggregationOperation Op = AO_Invalid; |
2632 uint32_t ShAmt; | 2633 uint32_t ShAmt; |
2633 }; | 2634 }; |
2634 | 2635 |
2635 // [RangeStart, RangeEnd] is a range of 1s in Src. | 2636 // [RangeStart, RangeEnd] is a range of 1s in Src. |
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3760 _fcmp_ll_NUM | 3761 _fcmp_ll_NUM |
3761 }; | 3762 }; |
3762 | 3763 |
3763 enum { | 3764 enum { |
3764 #define X(tag, str) _fcmp_hl_##tag = InstFcmp::tag, | 3765 #define X(tag, str) _fcmp_hl_##tag = InstFcmp::tag, |
3765 ICEINSTFCMP_TABLE | 3766 ICEINSTFCMP_TABLE |
3766 #undef X | 3767 #undef X |
3767 _fcmp_hl_NUM | 3768 _fcmp_hl_NUM |
3768 }; | 3769 }; |
3769 | 3770 |
3770 static_assert(_fcmp_hl_NUM == _fcmp_ll_NUM, | 3771 static_assert((uint32_t)_fcmp_hl_NUM == (uint32_t)_fcmp_ll_NUM, |
3771 "Inconsistency between high-level and low-level fcmp tags."); | 3772 "Inconsistency between high-level and low-level fcmp tags."); |
3772 #define X(tag, str) \ | 3773 #define X(tag, str) \ |
3773 static_assert( \ | 3774 static_assert( \ |
3774 _fcmp_hl_##tag == _fcmp_ll_##tag, \ | 3775 (uint32_t)_fcmp_hl_##tag == (uint32_t)_fcmp_ll_##tag, \ |
3775 "Inconsistency between high-level and low-level fcmp tag " #tag); | 3776 "Inconsistency between high-level and low-level fcmp tag " #tag); |
3776 ICEINSTFCMP_TABLE | 3777 ICEINSTFCMP_TABLE |
3777 #undef X | 3778 #undef X |
3778 | 3779 |
3779 struct { | 3780 struct { |
3780 CondARM32::Cond CC0; | 3781 CondARM32::Cond CC0; |
3781 CondARM32::Cond CC1; | 3782 CondARM32::Cond CC1; |
3782 } TableFcmp[] = { | 3783 } TableFcmp[] = { |
3783 #define X(val, CC0, CC1) \ | 3784 #define X(val, CC0, CC1) \ |
3784 { CondARM32::CC0, CondARM32::CC1 } \ | 3785 { CondARM32::CC0, CondARM32::CC1 } \ |
(...skipping 2510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6295 template <> struct ConstantPoolEmitterTraits<float> { | 6296 template <> struct ConstantPoolEmitterTraits<float> { |
6296 using ConstantType = ConstantFloat; | 6297 using ConstantType = ConstantFloat; |
6297 static constexpr Type IceType = IceType_f32; | 6298 static constexpr Type IceType = IceType_f32; |
6298 // AsmTag and TypeName can't be constexpr because llvm::StringRef is unhappy | 6299 // AsmTag and TypeName can't be constexpr because llvm::StringRef is unhappy |
6299 // about them being constexpr. | 6300 // about them being constexpr. |
6300 static const char AsmTag[]; | 6301 static const char AsmTag[]; |
6301 static const char TypeName[]; | 6302 static const char TypeName[]; |
6302 static uint64_t bitcastToUint64(float Value) { | 6303 static uint64_t bitcastToUint64(float Value) { |
6303 static_assert(sizeof(Value) == sizeof(uint32_t), | 6304 static_assert(sizeof(Value) == sizeof(uint32_t), |
6304 "Float should be 4 bytes."); | 6305 "Float should be 4 bytes."); |
6305 uint32_t IntValue = *reinterpret_cast<uint32_t *>(&Value); | 6306 const uint32_t IntValue = Utils::bitCopy<uint32_t>(Value); |
6306 return static_cast<uint64_t>(IntValue); | 6307 return static_cast<uint64_t>(IntValue); |
6307 } | 6308 } |
6308 }; | 6309 }; |
6309 const char ConstantPoolEmitterTraits<float>::AsmTag[] = ".long"; | 6310 const char ConstantPoolEmitterTraits<float>::AsmTag[] = ".long"; |
6310 const char ConstantPoolEmitterTraits<float>::TypeName[] = "f32"; | 6311 const char ConstantPoolEmitterTraits<float>::TypeName[] = "f32"; |
6311 | 6312 |
6312 template <> struct ConstantPoolEmitterTraits<double> { | 6313 template <> struct ConstantPoolEmitterTraits<double> { |
6313 using ConstantType = ConstantDouble; | 6314 using ConstantType = ConstantDouble; |
6314 static constexpr Type IceType = IceType_f64; | 6315 static constexpr Type IceType = IceType_f64; |
6315 static const char AsmTag[]; | 6316 static const char AsmTag[]; |
6316 static const char TypeName[]; | 6317 static const char TypeName[]; |
6317 static uint64_t bitcastToUint64(double Value) { | 6318 static uint64_t bitcastToUint64(double Value) { |
6318 static_assert(sizeof(double) == sizeof(uint64_t), | 6319 static_assert(sizeof(double) == sizeof(uint64_t), |
6319 "Double should be 8 bytes."); | 6320 "Double should be 8 bytes."); |
6320 return *reinterpret_cast<uint64_t *>(&Value); | 6321 return Utils::bitCopy<uint64_t>(Value); |
6321 } | 6322 } |
6322 }; | 6323 }; |
6323 const char ConstantPoolEmitterTraits<double>::AsmTag[] = ".quad"; | 6324 const char ConstantPoolEmitterTraits<double>::AsmTag[] = ".quad"; |
6324 const char ConstantPoolEmitterTraits<double>::TypeName[] = "f64"; | 6325 const char ConstantPoolEmitterTraits<double>::TypeName[] = "f64"; |
6325 | 6326 |
6326 template <typename T> | 6327 template <typename T> |
6327 void emitConstant( | 6328 void emitConstant( |
6328 Ostream &Str, const GlobalContext *Ctx, | 6329 Ostream &Str, const GlobalContext *Ctx, |
6329 const typename ConstantPoolEmitterTraits<T>::ConstantType *Const) { | 6330 const typename ConstantPoolEmitterTraits<T>::ConstantType *Const) { |
6330 using Traits = ConstantPoolEmitterTraits<T>; | 6331 using Traits = ConstantPoolEmitterTraits<T>; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6448 // However, for compatibility with current NaCl LLVM, don't claim that. | 6449 // However, for compatibility with current NaCl LLVM, don't claim that. |
6449 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; | 6450 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; |
6450 } | 6451 } |
6451 | 6452 |
6452 llvm::SmallBitVector TargetARM32::TypeToRegisterSet[IceType_NUM]; | 6453 llvm::SmallBitVector TargetARM32::TypeToRegisterSet[IceType_NUM]; |
6453 llvm::SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; | 6454 llvm::SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; |
6454 llvm::SmallBitVector TargetARM32::ScratchRegs; | 6455 llvm::SmallBitVector TargetARM32::ScratchRegs; |
6455 | 6456 |
6456 } // end of namespace ARM32 | 6457 } // end of namespace ARM32 |
6457 } // end of namespace Ice | 6458 } // end of namespace Ice |
OLD | NEW |