Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// | 1 //===- subzero/src/IceTargetLoweringX8632.cpp - x86-32 lowering -----------===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 4 // | 4 // |
| 5 //===----------------------------------------------------------------------===// | 5 //===----------------------------------------------------------------------===// |
| 6 // | 6 // |
| 7 // This file implements the TargetLoweringX8632 class, which | 7 // This file implements the TargetLoweringX8632 class, which |
| 8 // consists almost entirely of the lowering sequence for each | 8 // consists almost entirely of the lowering sequence for each |
| 9 // high-level instruction. | 9 // high-level instruction. |
| 10 // | 10 // |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 // representation of the vector. | 78 // representation of the vector. |
| 79 static Type getInVectorElementType(Type Ty) { | 79 static Type getInVectorElementType(Type Ty) { |
| 80 assert(isVectorType(Ty)); | 80 assert(isVectorType(Ty)); |
| 81 size_t Index = static_cast<size_t>(Ty); | 81 size_t Index = static_cast<size_t>(Ty); |
| 82 (void)Index; | 82 (void)Index; |
| 83 assert(Index < TableTypeX8632AttributesSize); | 83 assert(Index < TableTypeX8632AttributesSize); |
| 84 return TableTypeX8632Attributes[Ty].InVectorElementType; | 84 return TableTypeX8632Attributes[Ty].InVectorElementType; |
| 85 } | 85 } |
| 86 | 86 |
| 87 // The maximum number of arguments to pass in XMM registers | 87 // The maximum number of arguments to pass in XMM registers |
| 88 static constexpr uint32_t X86_MAX_XMM_ARGS = 4; | 88 static const uint32_t X86_MAX_XMM_ARGS = 4; |
|
Jim Stichnoth
2015/06/24 21:58:46
I'm curious why all these constexprs got downgrade
John
2015/06/24 22:56:24
It is dangerous to have them as constexpr as they
| |
| 89 // The number of bits in a byte | 89 // The number of bits in a byte |
| 90 static constexpr uint32_t X86_CHAR_BIT = 8; | 90 static const uint32_t X86_CHAR_BIT = 8; |
| 91 // Stack alignment | 91 // Stack alignment |
| 92 static const uint32_t X86_STACK_ALIGNMENT_BYTES; | 92 static const uint32_t X86_STACK_ALIGNMENT_BYTES; |
| 93 // Size of the return address on the stack | 93 // Size of the return address on the stack |
| 94 static constexpr uint32_t X86_RET_IP_SIZE_BYTES = 4; | 94 static const uint32_t X86_RET_IP_SIZE_BYTES = 4; |
| 95 // The number of different NOP instructions | 95 // The number of different NOP instructions |
| 96 static constexpr uint32_t X86_NUM_NOP_VARIANTS = 5; | 96 static const uint32_t X86_NUM_NOP_VARIANTS = 5; |
| 97 | 97 |
| 98 // Value is in bytes. Return Value adjusted to the next highest multiple | 98 // Value is in bytes. Return Value adjusted to the next highest multiple |
| 99 // of the stack alignment. | 99 // of the stack alignment. |
| 100 static uint32_t applyStackAlignment(uint32_t Value) { | 100 static uint32_t applyStackAlignment(uint32_t Value) { |
| 101 return Utils::applyAlignment(Value, X86_STACK_ALIGNMENT_BYTES); | 101 return Utils::applyAlignment(Value, X86_STACK_ALIGNMENT_BYTES); |
| 102 } | 102 } |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 const MachineTraits<TargetX8632>::TableFcmpType | 105 const MachineTraits<TargetX8632>::TableFcmpType |
| 106 MachineTraits<TargetX8632>::TableFcmp[] = { | 106 MachineTraits<TargetX8632>::TableFcmp[] = { |
| 107 #define X(val, dflt, swapS, C1, C2, swapV, pred) \ | 107 #define X(val, dflt, swapS, C1, C2, swapV, pred) \ |
| 108 { dflt, swapS, CondX86::C1, CondX86::C2, swapV, CondX86::pred } \ | 108 { dflt, swapS, CondX86::C1, CondX86::C2, swapV, CondX86::pred } \ |
| 109 , | 109 , |
| 110 FCMPX8632_TABLE | 110 FCMPX8632_TABLE |
| 111 #undef X | 111 #undef X |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 constexpr size_t MachineTraits<TargetX8632>::TableFcmpSize = | 114 const size_t MachineTraits<TargetX8632>::TableFcmpSize = |
| 115 llvm::array_lengthof(TableFcmp); | 115 llvm::array_lengthof(TableFcmp); |
| 116 | 116 |
| 117 const MachineTraits<TargetX8632>::TableIcmp32Type | 117 const MachineTraits<TargetX8632>::TableIcmp32Type |
| 118 MachineTraits<TargetX8632>::TableIcmp32[] = { | 118 MachineTraits<TargetX8632>::TableIcmp32[] = { |
| 119 #define X(val, C_32, C1_64, C2_64, C3_64) \ | 119 #define X(val, C_32, C1_64, C2_64, C3_64) \ |
| 120 { CondX86::C_32 } \ | 120 { CondX86::C_32 } \ |
| 121 , | 121 , |
| 122 ICMPX8632_TABLE | 122 ICMPX8632_TABLE |
| 123 #undef X | 123 #undef X |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 constexpr size_t MachineTraits<TargetX8632>::TableIcmp32Size = | 126 const size_t MachineTraits<TargetX8632>::TableIcmp32Size = |
| 127 llvm::array_lengthof(TableIcmp32); | 127 llvm::array_lengthof(TableIcmp32); |
| 128 | 128 |
| 129 const MachineTraits<TargetX8632>::TableIcmp64Type | 129 const MachineTraits<TargetX8632>::TableIcmp64Type |
| 130 MachineTraits<TargetX8632>::TableIcmp64[] = { | 130 MachineTraits<TargetX8632>::TableIcmp64[] = { |
| 131 #define X(val, C_32, C1_64, C2_64, C3_64) \ | 131 #define X(val, C_32, C1_64, C2_64, C3_64) \ |
| 132 { CondX86::C1_64, CondX86::C2_64, CondX86::C3_64 } \ | 132 { CondX86::C1_64, CondX86::C2_64, CondX86::C3_64 } \ |
| 133 , | 133 , |
| 134 ICMPX8632_TABLE | 134 ICMPX8632_TABLE |
| 135 #undef X | 135 #undef X |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 constexpr size_t MachineTraits<TargetX8632>::TableIcmp64Size = | 138 const size_t MachineTraits<TargetX8632>::TableIcmp64Size = |
| 139 llvm::array_lengthof(TableIcmp64); | 139 llvm::array_lengthof(TableIcmp64); |
| 140 | 140 |
| 141 const MachineTraits<TargetX8632>::TableTypeX8632AttributesType | 141 const MachineTraits<TargetX8632>::TableTypeX8632AttributesType |
| 142 MachineTraits<TargetX8632>::TableTypeX8632Attributes[] = { | 142 MachineTraits<TargetX8632>::TableTypeX8632Attributes[] = { |
| 143 #define X(tag, elementty, cvt, sdss, pack, width, fld) \ | 143 #define X(tag, elementty, cvt, sdss, pack, width, fld) \ |
| 144 { elementty } \ | 144 { elementty } \ |
| 145 , | 145 , |
| 146 ICETYPEX8632_TABLE | 146 ICETYPEX8632_TABLE |
| 147 #undef X | 147 #undef X |
| 148 }; | 148 }; |
| 149 | 149 |
| 150 constexpr size_t MachineTraits<TargetX8632>::TableTypeX8632AttributesSize = | 150 const size_t MachineTraits<TargetX8632>::TableTypeX8632AttributesSize = |
| 151 llvm::array_lengthof(TableTypeX8632Attributes); | 151 llvm::array_lengthof(TableTypeX8632Attributes); |
| 152 | 152 |
| 153 const uint32_t MachineTraits<TargetX8632>::X86_STACK_ALIGNMENT_BYTES = 16; | 153 const uint32_t MachineTraits<TargetX8632>::X86_STACK_ALIGNMENT_BYTES = 16; |
| 154 } // end of namespace X86Internal | 154 } // end of namespace X86Internal |
| 155 | 155 |
| 156 TargetX8632 *TargetX8632::create(Cfg *Func) { | 156 TargetX8632 *TargetX8632::create(Cfg *Func) { |
| 157 return X86Internal::TargetX86Base<TargetX8632>::create(Func); | 157 return X86Internal::TargetX86Base<TargetX8632>::create(Func); |
| 158 } | 158 } |
| 159 | 159 |
| 160 TargetDataX8632::TargetDataX8632(GlobalContext *Ctx) | 160 TargetDataX8632::TargetDataX8632(GlobalContext *Ctx) |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 415 // entries in case the high-level table has extra entries. | 415 // entries in case the high-level table has extra entries. |
| 416 #define X(tag, size, align, elts, elty, str) \ | 416 #define X(tag, size, align, elts, elty, str) \ |
| 417 static_assert(_table1_##tag == _table2_##tag, \ | 417 static_assert(_table1_##tag == _table2_##tag, \ |
| 418 "Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE"); | 418 "Inconsistency between ICETYPEX8632_TABLE and ICETYPE_TABLE"); |
| 419 ICETYPE_TABLE | 419 ICETYPE_TABLE |
| 420 #undef X | 420 #undef X |
| 421 } // end of namespace dummy3 | 421 } // end of namespace dummy3 |
| 422 } // end of anonymous namespace | 422 } // end of anonymous namespace |
| 423 | 423 |
| 424 } // end of namespace Ice | 424 } // end of namespace Ice |
| OLD | NEW |