Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_COMPILER_MACHINE_OPERATOR_H_ | 5 #ifndef V8_COMPILER_MACHINE_OPERATOR_H_ |
| 6 #define V8_COMPILER_MACHINE_OPERATOR_H_ | 6 #define V8_COMPILER_MACHINE_OPERATOR_H_ |
| 7 | 7 |
| 8 #include "src/base/flags.h" | |
| 8 #include "src/compiler/machine-type.h" | 9 #include "src/compiler/machine-type.h" |
| 9 | 10 |
| 10 namespace v8 { | 11 namespace v8 { |
| 11 namespace internal { | 12 namespace internal { |
| 12 namespace compiler { | 13 namespace compiler { |
| 13 | 14 |
| 14 // Forward declarations. | 15 // Forward declarations. |
| 15 struct MachineOperatorBuilderImpl; | 16 struct MachineOperatorBuilderImpl; |
| 16 class Operator; | 17 class Operator; |
| 17 | 18 |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 44 | 45 |
| 45 bool operator==(StoreRepresentation, StoreRepresentation); | 46 bool operator==(StoreRepresentation, StoreRepresentation); |
| 46 bool operator!=(StoreRepresentation, StoreRepresentation); | 47 bool operator!=(StoreRepresentation, StoreRepresentation); |
| 47 | 48 |
| 48 size_t hash_value(StoreRepresentation); | 49 size_t hash_value(StoreRepresentation); |
| 49 | 50 |
| 50 std::ostream& operator<<(std::ostream&, StoreRepresentation); | 51 std::ostream& operator<<(std::ostream&, StoreRepresentation); |
| 51 | 52 |
| 52 StoreRepresentation const& StoreRepresentationOf(Operator const*); | 53 StoreRepresentation const& StoreRepresentationOf(Operator const*); |
| 53 | 54 |
| 55 enum SupportedOperator { | |
|
Benedikt Meurer
2014/10/23 07:11:14
I'd not name it SupportedOperator, but rather move
sigurds
2014/10/23 10:37:56
Done.
| |
| 56 kNoSupportedOperators = 0, | |
| 57 kSupportsFloat64Floor = 1 << 0, | |
| 58 kSupportsFloat64Ceil = 1 << 1, | |
| 59 kSupportsFloat64RoundTiesAway = 1 << 2, | |
| 60 kSupportsFloat64RoundTiesTowards = 1 << 3 | |
| 61 }; | |
| 62 | |
| 63 typedef base::Flags<SupportedOperator, uint8_t> SupportedOperators; | |
| 64 DEFINE_OPERATORS_FOR_FLAGS(SupportedOperators) | |
| 54 | 65 |
| 55 // Interface for building machine-level operators. These operators are | 66 // Interface for building machine-level operators. These operators are |
| 56 // machine-level but machine-independent and thus define a language suitable | 67 // machine-level but machine-independent and thus define a language suitable |
| 57 // for generating code to run on architectures such as ia32, x64, arm, etc. | 68 // for generating code to run on architectures such as ia32, x64, arm, etc. |
| 58 class MachineOperatorBuilder FINAL { | 69 class MachineOperatorBuilder FINAL { |
| 59 public: | 70 public: |
| 60 explicit MachineOperatorBuilder(MachineType word = kMachPtr); | 71 explicit MachineOperatorBuilder( |
| 72 MachineType word = kMachPtr, | |
| 73 SupportedOperators supportedOperators = kNoSupportedOperators); | |
| 61 | 74 |
| 62 const Operator* Word32And(); | 75 const Operator* Word32And(); |
| 63 const Operator* Word32Or(); | 76 const Operator* Word32Or(); |
| 64 const Operator* Word32Xor(); | 77 const Operator* Word32Xor(); |
| 65 const Operator* Word32Shl(); | 78 const Operator* Word32Shl(); |
| 66 const Operator* Word32Shr(); | 79 const Operator* Word32Shr(); |
| 67 const Operator* Word32Sar(); | 80 const Operator* Word32Sar(); |
| 68 const Operator* Word32Ror(); | 81 const Operator* Word32Ror(); |
| 69 const Operator* Word32Equal(); | 82 const Operator* Word32Equal(); |
| 70 | 83 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 const Operator* Float64Mul(); | 141 const Operator* Float64Mul(); |
| 129 const Operator* Float64Div(); | 142 const Operator* Float64Div(); |
| 130 const Operator* Float64Mod(); | 143 const Operator* Float64Mod(); |
| 131 const Operator* Float64Sqrt(); | 144 const Operator* Float64Sqrt(); |
| 132 | 145 |
| 133 // Floating point comparisons complying to IEEE 754. | 146 // Floating point comparisons complying to IEEE 754. |
| 134 const Operator* Float64Equal(); | 147 const Operator* Float64Equal(); |
| 135 const Operator* Float64LessThan(); | 148 const Operator* Float64LessThan(); |
| 136 const Operator* Float64LessThanOrEqual(); | 149 const Operator* Float64LessThanOrEqual(); |
| 137 | 150 |
| 151 // Floating point rounding. | |
| 152 const Operator* Float64Floor(); | |
| 153 const Operator* Float64Ceil(); | |
| 154 const Operator* Float64RoundAwayFromZero(); | |
| 155 const Operator* Float64RoundToZero(); | |
| 156 bool HasFloat64Floor() { return supportedOperators_ & kSupportsFloat64Floor; } | |
| 157 bool HasFloat64Ceil() { return supportedOperators_ & kSupportsFloat64Ceil; } | |
| 158 bool HasFloat64RoundAwayFromZero() { | |
| 159 return supportedOperators_ & kSupportsFloat64RoundTiesAway; | |
| 160 } | |
| 161 bool HasFloat64RoundToZero() { | |
| 162 return supportedOperators_ & kSupportsFloat64RoundTiesTowards; | |
| 163 } | |
| 164 | |
| 138 // load [base + index] | 165 // load [base + index] |
| 139 const Operator* Load(LoadRepresentation rep); | 166 const Operator* Load(LoadRepresentation rep); |
| 140 | 167 |
| 141 // store [base + index], value | 168 // store [base + index], value |
| 142 const Operator* Store(StoreRepresentation rep); | 169 const Operator* Store(StoreRepresentation rep); |
| 143 | 170 |
| 144 // Access to the machine stack. | 171 // Access to the machine stack. |
| 145 const Operator* LoadStackPointer(); | 172 const Operator* LoadStackPointer(); |
| 146 | 173 |
| 147 // Target machine word-size assumed by this builder. | 174 // Target machine word-size assumed by this builder. |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 174 const Operator* Prefix##Suffix() { \ | 201 const Operator* Prefix##Suffix() { \ |
| 175 return Is32() ? Prefix##32##Suffix() : Prefix##64##Suffix(); \ | 202 return Is32() ? Prefix##32##Suffix() : Prefix##64##Suffix(); \ |
| 176 } | 203 } |
| 177 PSEUDO_OP_LIST(PSEUDO_OP) | 204 PSEUDO_OP_LIST(PSEUDO_OP) |
| 178 #undef PSEUDO_OP | 205 #undef PSEUDO_OP |
| 179 #undef PSEUDO_OP_LIST | 206 #undef PSEUDO_OP_LIST |
| 180 | 207 |
| 181 private: | 208 private: |
| 182 const MachineOperatorBuilderImpl& impl_; | 209 const MachineOperatorBuilderImpl& impl_; |
| 183 const MachineType word_; | 210 const MachineType word_; |
| 211 const SupportedOperators supportedOperators_; | |
| 184 }; | 212 }; |
| 185 | 213 |
| 186 } // namespace compiler | 214 } // namespace compiler |
| 187 } // namespace internal | 215 } // namespace internal |
| 188 } // namespace v8 | 216 } // namespace v8 |
| 189 | 217 |
| 190 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 218 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
| OLD | NEW |