OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_INSTRUCTION_SELECTOR_H_ | 5 #ifndef V8_COMPILER_INSTRUCTION_SELECTOR_H_ |
6 #define V8_COMPILER_INSTRUCTION_SELECTOR_H_ | 6 #define V8_COMPILER_INSTRUCTION_SELECTOR_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 78 |
79 bool IsSupported(CpuFeature feature) const { | 79 bool IsSupported(CpuFeature feature) const { |
80 return features_.Contains(feature); | 80 return features_.Contains(feature); |
81 } | 81 } |
82 | 82 |
83 // Returns the features supported on the target platform. | 83 // Returns the features supported on the target platform. |
84 static Features SupportedFeatures() { | 84 static Features SupportedFeatures() { |
85 return Features(CpuFeatures::SupportedFeatures()); | 85 return Features(CpuFeatures::SupportedFeatures()); |
86 } | 86 } |
87 | 87 |
88 // Checks if {node} is currently live. | |
89 bool IsLive(Node* node) const { return !IsDefined(node) && IsUsed(node); } | |
90 | |
91 private: | |
92 friend class OperandGenerator; | |
93 | |
94 // =========================================================================== | 88 // =========================================================================== |
95 // ============ Architecture-independent graph covering methods. ============= | 89 // ============ Architecture-independent graph covering methods. ============= |
96 // =========================================================================== | 90 // =========================================================================== |
97 | 91 |
98 // Checks if {block} will appear directly after {current_block_} when | |
99 // assembling code, in which case, a fall-through can be used. | |
100 bool IsNextInAssemblyOrder(const BasicBlock* block) const; | |
101 | |
102 // Used in pattern matching during code generation. | 92 // Used in pattern matching during code generation. |
103 // Check if {node} can be covered while generating code for the current | 93 // Check if {node} can be covered while generating code for the current |
104 // instruction. A node can be covered if the {user} of the node has the only | 94 // instruction. A node can be covered if the {user} of the node has the only |
105 // edge and the two are in the same basic block. | 95 // edge and the two are in the same basic block. |
106 bool CanCover(Node* user, Node* node) const; | 96 bool CanCover(Node* user, Node* node) const; |
107 | 97 |
108 // Checks if {node} was already defined, and therefore code was already | 98 // Checks if {node} was already defined, and therefore code was already |
109 // generated for it. | 99 // generated for it. |
110 bool IsDefined(Node* node) const; | 100 bool IsDefined(Node* node) const; |
111 | 101 |
112 // Inform the instruction selection that {node} was just defined. | |
113 void MarkAsDefined(Node* node); | |
114 | |
115 // Checks if {node} has any uses, and therefore code has to be generated for | 102 // Checks if {node} has any uses, and therefore code has to be generated for |
116 // it. | 103 // it. |
117 bool IsUsed(Node* node) const; | 104 bool IsUsed(Node* node) const; |
118 | 105 |
| 106 // Checks if {node} is currently live. |
| 107 bool IsLive(Node* node) const { return !IsDefined(node) && IsUsed(node); } |
| 108 |
| 109 private: |
| 110 friend class OperandGenerator; |
| 111 |
| 112 // Checks if {block} will appear directly after {current_block_} when |
| 113 // assembling code, in which case, a fall-through can be used. |
| 114 bool IsNextInAssemblyOrder(const BasicBlock* block) const; |
| 115 |
| 116 // Inform the instruction selection that {node} was just defined. |
| 117 void MarkAsDefined(Node* node); |
| 118 |
119 // Inform the instruction selection that {node} has at least one use and we | 119 // Inform the instruction selection that {node} has at least one use and we |
120 // will need to generate code for it. | 120 // will need to generate code for it. |
121 void MarkAsUsed(Node* node); | 121 void MarkAsUsed(Node* node); |
122 | 122 |
123 // Checks if {node} is marked as double. | 123 // Checks if {node} is marked as double. |
124 bool IsDouble(const Node* node) const; | 124 bool IsDouble(const Node* node) const; |
125 | 125 |
126 // Inform the register allocator of a double result. | 126 // Inform the register allocator of a double result. |
127 void MarkAsDouble(Node* node); | 127 void MarkAsDouble(Node* node); |
128 | 128 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 ZoneDeque<Instruction*> instructions_; | 202 ZoneDeque<Instruction*> instructions_; |
203 BoolVector defined_; | 203 BoolVector defined_; |
204 BoolVector used_; | 204 BoolVector used_; |
205 }; | 205 }; |
206 | 206 |
207 } // namespace compiler | 207 } // namespace compiler |
208 } // namespace internal | 208 } // namespace internal |
209 } // namespace v8 | 209 } // namespace v8 |
210 | 210 |
211 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_H_ | 211 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_H_ |
OLD | NEW |