Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(673)

Side by Side Diff: src/compiler/machine-operator.h

Issue 2112733003: [turbofan] Allow OptionalOperator to return a placeholder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/machine-operator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/machine-type.h" 9 #include "src/machine-type.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 namespace compiler { 13 namespace compiler {
14 14
15 // Forward declarations. 15 // Forward declarations.
16 struct MachineOperatorGlobalCache; 16 struct MachineOperatorGlobalCache;
17 class Operator; 17 class Operator;
18 18
19 19
20 // For operators that are not supported on all platforms. 20 // For operators that are not supported on all platforms.
21 class OptionalOperator final { 21 class OptionalOperator final {
22 public: 22 public:
23 explicit OptionalOperator(const Operator* op) : op_(op) {} 23 OptionalOperator(bool supported, const Operator* op)
24 : supported_(supported), op_(op) {}
24 25
25 bool IsSupported() const { return op_ != nullptr; } 26 bool IsSupported() const { return supported_; }
27 // Gets the operator only if it is supported.
26 const Operator* op() const { 28 const Operator* op() const {
27 DCHECK_NOT_NULL(op_); 29 DCHECK(supported_);
28 return op_; 30 return op_;
29 } 31 }
32 // Always gets the operator, even for unsupported operators. This is useful to
33 // use the operator as a placeholder in a graph, for instance.
34 const Operator* placeholder() const { return op_; }
30 35
31 private: 36 private:
37 bool supported_;
32 const Operator* const op_; 38 const Operator* const op_;
33 }; 39 };
34 40
35 41
36 // A Load needs a MachineType. 42 // A Load needs a MachineType.
37 typedef MachineType LoadRepresentation; 43 typedef MachineType LoadRepresentation;
38 44
39 LoadRepresentation LoadRepresentationOf(Operator const*); 45 LoadRepresentation LoadRepresentationOf(Operator const*);
40 46
41 // A Store needs a MachineType and a WriteBarrierKind in order to emit the 47 // A Store needs a MachineType and a WriteBarrierKind in order to emit the
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 const Operator* Word32Xor(); 208 const Operator* Word32Xor();
203 const Operator* Word32Shl(); 209 const Operator* Word32Shl();
204 const Operator* Word32Shr(); 210 const Operator* Word32Shr();
205 const Operator* Word32Sar(); 211 const Operator* Word32Sar();
206 const Operator* Word32Ror(); 212 const Operator* Word32Ror();
207 const Operator* Word32Equal(); 213 const Operator* Word32Equal();
208 const Operator* Word32Clz(); 214 const Operator* Word32Clz();
209 const OptionalOperator Word32Ctz(); 215 const OptionalOperator Word32Ctz();
210 const OptionalOperator Word32Popcnt(); 216 const OptionalOperator Word32Popcnt();
211 const OptionalOperator Word64Popcnt(); 217 const OptionalOperator Word64Popcnt();
212 const Operator* Word64PopcntPlaceholder();
213 const OptionalOperator Word32ReverseBits(); 218 const OptionalOperator Word32ReverseBits();
214 const OptionalOperator Word64ReverseBits(); 219 const OptionalOperator Word64ReverseBits();
215 bool Word32ShiftIsSafe() const { return flags_ & kWord32ShiftIsSafe; } 220 bool Word32ShiftIsSafe() const { return flags_ & kWord32ShiftIsSafe; }
216 221
217 const Operator* Word64And(); 222 const Operator* Word64And();
218 const Operator* Word64Or(); 223 const Operator* Word64Or();
219 const Operator* Word64Xor(); 224 const Operator* Word64Xor();
220 const Operator* Word64Shl(); 225 const Operator* Word64Shl();
221 const Operator* Word64Shr(); 226 const Operator* Word64Shr();
222 const Operator* Word64Sar(); 227 const Operator* Word64Sar();
223 const Operator* Word64Ror(); 228 const Operator* Word64Ror();
224 const Operator* Word64Clz(); 229 const Operator* Word64Clz();
225 const OptionalOperator Word64Ctz(); 230 const OptionalOperator Word64Ctz();
226 const Operator* Word64CtzPlaceholder();
227 const Operator* Word64Equal(); 231 const Operator* Word64Equal();
228 232
229 const Operator* Int32PairAdd(); 233 const Operator* Int32PairAdd();
230 const Operator* Int32PairSub(); 234 const Operator* Int32PairSub();
231 const Operator* Int32PairMul(); 235 const Operator* Int32PairMul();
232 const Operator* Word32PairShl(); 236 const Operator* Word32PairShl();
233 const Operator* Word32PairShr(); 237 const Operator* Word32PairShr();
234 const Operator* Word32PairSar(); 238 const Operator* Word32PairSar();
235 239
236 const Operator* Int32Add(); 240 const Operator* Int32Add();
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 }; 674 };
671 675
672 676
673 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags) 677 DEFINE_OPERATORS_FOR_FLAGS(MachineOperatorBuilder::Flags)
674 678
675 } // namespace compiler 679 } // namespace compiler
676 } // namespace internal 680 } // namespace internal
677 } // namespace v8 681 } // namespace v8
678 682
679 #endif // V8_COMPILER_MACHINE_OPERATOR_H_ 683 #endif // V8_COMPILER_MACHINE_OPERATOR_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler/machine-operator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698