| 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/base/flags.h" |
| 9 #include "src/compiler/machine-type.h" | 9 #include "src/compiler/machine-type.h" |
| 10 | 10 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 StoreRepresentation const& StoreRepresentationOf(Operator const*); | 53 StoreRepresentation const& StoreRepresentationOf(Operator const*); |
| 54 | 54 |
| 55 | 55 |
| 56 // Interface for building machine-level operators. These operators are | 56 // Interface for building machine-level operators. These operators are |
| 57 // machine-level but machine-independent and thus define a language suitable | 57 // machine-level but machine-independent and thus define a language suitable |
| 58 // for generating code to run on architectures such as ia32, x64, arm, etc. | 58 // for generating code to run on architectures such as ia32, x64, arm, etc. |
| 59 class MachineOperatorBuilder FINAL : public ZoneObject { | 59 class MachineOperatorBuilder FINAL : public ZoneObject { |
| 60 public: | 60 public: |
| 61 // Flags that specify which operations are available. This is useful | 61 // Flags that specify which operations are available. This is useful |
| 62 // for operations that are unsupported by some back-ends. | 62 // for operations that are unsupported by some back-ends. |
| 63 enum class Flag : unsigned { | 63 enum Flag { |
| 64 kNoFlags = 0, | 64 kNoFlags = 0u, |
| 65 kFloat64Floor = 1 << 0, | 65 kFloat64Floor = 1u << 0, |
| 66 kFloat64Ceil = 1 << 1, | 66 kFloat64Ceil = 1u << 1, |
| 67 kFloat64RoundTruncate = 1 << 2, | 67 kFloat64RoundTruncate = 1u << 2, |
| 68 kFloat64RoundTiesAway = 1 << 3 | 68 kFloat64RoundTiesAway = 1u << 3, |
| 69 kInt32DivIsSafe = 1u << 4, |
| 70 kInt32ModIsSafe = 1u << 5, |
| 71 kUint32DivIsSafe = 1u << 6, |
| 72 kUint32ModIsSafe = 1u << 7 |
| 69 }; | 73 }; |
| 70 typedef base::Flags<Flag, unsigned> Flags; | 74 typedef base::Flags<Flag, unsigned> Flags; |
| 71 | 75 |
| 72 explicit MachineOperatorBuilder(MachineType word = kMachPtr, | 76 explicit MachineOperatorBuilder(MachineType word = kMachPtr, |
| 73 Flags supportedOperators = Flag::kNoFlags); | 77 Flags supportedOperators = kNoFlags); |
| 74 | 78 |
| 75 const Operator* Word32And(); | 79 const Operator* Word32And(); |
| 76 const Operator* Word32Or(); | 80 const Operator* Word32Or(); |
| 77 const Operator* Word32Xor(); | 81 const Operator* Word32Xor(); |
| 78 const Operator* Word32Shl(); | 82 const Operator* Word32Shl(); |
| 79 const Operator* Word32Shr(); | 83 const Operator* Word32Shr(); |
| 80 const Operator* Word32Sar(); | 84 const Operator* Word32Sar(); |
| 81 const Operator* Word32Ror(); | 85 const Operator* Word32Ror(); |
| 82 const Operator* Word32Equal(); | 86 const Operator* Word32Equal(); |
| 83 | 87 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 97 const Operator* Int32Mul(); | 101 const Operator* Int32Mul(); |
| 98 const Operator* Int32MulHigh(); | 102 const Operator* Int32MulHigh(); |
| 99 const Operator* Int32Div(); | 103 const Operator* Int32Div(); |
| 100 const Operator* Int32Mod(); | 104 const Operator* Int32Mod(); |
| 101 const Operator* Int32LessThan(); | 105 const Operator* Int32LessThan(); |
| 102 const Operator* Int32LessThanOrEqual(); | 106 const Operator* Int32LessThanOrEqual(); |
| 103 const Operator* Uint32Div(); | 107 const Operator* Uint32Div(); |
| 104 const Operator* Uint32LessThan(); | 108 const Operator* Uint32LessThan(); |
| 105 const Operator* Uint32LessThanOrEqual(); | 109 const Operator* Uint32LessThanOrEqual(); |
| 106 const Operator* Uint32Mod(); | 110 const Operator* Uint32Mod(); |
| 111 bool Int32DivIsSafe() const { return flags_ & kInt32DivIsSafe; } |
| 112 bool Int32ModIsSafe() const { return flags_ & kInt32ModIsSafe; } |
| 113 bool Uint32DivIsSafe() const { return flags_ & kUint32DivIsSafe; } |
| 114 bool Uint32ModIsSafe() const { return flags_ & kUint32ModIsSafe; } |
| 107 | 115 |
| 108 const Operator* Int64Add(); | 116 const Operator* Int64Add(); |
| 109 const Operator* Int64Sub(); | 117 const Operator* Int64Sub(); |
| 110 const Operator* Int64Mul(); | 118 const Operator* Int64Mul(); |
| 111 const Operator* Int64Div(); | 119 const Operator* Int64Div(); |
| 112 const Operator* Int64Mod(); | 120 const Operator* Int64Mod(); |
| 113 const Operator* Int64LessThan(); | 121 const Operator* Int64LessThan(); |
| 114 const Operator* Int64LessThanOrEqual(); | 122 const Operator* Int64LessThanOrEqual(); |
| 115 const Operator* Uint64Div(); | 123 const Operator* Uint64Div(); |
| 116 const Operator* Uint64LessThan(); | 124 const Operator* Uint64LessThan(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 146 // Floating point comparisons complying to IEEE 754. | 154 // Floating point comparisons complying to IEEE 754. |
| 147 const Operator* Float64Equal(); | 155 const Operator* Float64Equal(); |
| 148 const Operator* Float64LessThan(); | 156 const Operator* Float64LessThan(); |
| 149 const Operator* Float64LessThanOrEqual(); | 157 const Operator* Float64LessThanOrEqual(); |
| 150 | 158 |
| 151 // Floating point rounding. | 159 // Floating point rounding. |
| 152 const Operator* Float64Floor(); | 160 const Operator* Float64Floor(); |
| 153 const Operator* Float64Ceil(); | 161 const Operator* Float64Ceil(); |
| 154 const Operator* Float64RoundTruncate(); | 162 const Operator* Float64RoundTruncate(); |
| 155 const Operator* Float64RoundTiesAway(); | 163 const Operator* Float64RoundTiesAway(); |
| 156 bool HasFloat64Floor() { return flags_ & Flag::kFloat64Floor; } | 164 bool HasFloat64Floor() { return flags_ & kFloat64Floor; } |
| 157 bool HasFloat64Ceil() { return flags_ & Flag::kFloat64Ceil; } | 165 bool HasFloat64Ceil() { return flags_ & kFloat64Ceil; } |
| 158 bool HasFloat64RoundTruncate() { | 166 bool HasFloat64RoundTruncate() { return flags_ & kFloat64RoundTruncate; } |
| 159 return flags_ & Flag::kFloat64RoundTruncate; | 167 bool HasFloat64RoundTiesAway() { return flags_ & kFloat64RoundTiesAway; } |
| 160 } | |
| 161 bool HasFloat64RoundTiesAway() { | |
| 162 return flags_ & Flag::kFloat64RoundTiesAway; | |
| 163 } | |
| 164 | 168 |
| 165 // load [base + index] | 169 // load [base + index] |
| 166 const Operator* Load(LoadRepresentation rep); | 170 const Operator* Load(LoadRepresentation rep); |
| 167 | 171 |
| 168 // store [base + index], value | 172 // store [base + index], value |
| 169 const Operator* Store(StoreRepresentation rep); | 173 const Operator* Store(StoreRepresentation rep); |
| 170 | 174 |
| 171 // Access to the machine stack. | 175 // Access to the machine stack. |
| 172 const Operator* LoadStackPointer(); | 176 const Operator* LoadStackPointer(); |
| 173 | 177 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 DISALLOW_COPY_AND_ASSIGN(MachineOperatorBuilder); | 216 DISALLOW_COPY_AND_ASSIGN(MachineOperatorBuilder); |
| 213 }; | 217 }; |
| 214 | 218 |
| 215 | 219 |
| 216 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) | 220 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) |
| 217 } // namespace compiler | 221 } // namespace compiler |
| 218 } // namespace internal | 222 } // namespace internal |
| 219 } // namespace v8 | 223 } // namespace v8 |
| 220 | 224 |
| 221 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ | 225 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ |
| OLD | NEW |