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 <map> | 8 #include <map> |
9 | 9 |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // generated for it. | 142 // generated for it. |
143 bool IsDefined(Node* node) const; | 143 bool IsDefined(Node* node) const; |
144 | 144 |
145 // Checks if {node} has any uses, and therefore code has to be generated for | 145 // Checks if {node} has any uses, and therefore code has to be generated for |
146 // it. | 146 // it. |
147 bool IsUsed(Node* node) const; | 147 bool IsUsed(Node* node) const; |
148 | 148 |
149 // Checks if {node} is currently live. | 149 // Checks if {node} is currently live. |
150 bool IsLive(Node* node) const { return !IsDefined(node) && IsUsed(node); } | 150 bool IsLive(Node* node) const { return !IsDefined(node) && IsUsed(node); } |
151 | 151 |
| 152 // Gets the effect level of {node}. |
| 153 int GetEffectLevel(Node* node) const; |
| 154 |
152 int GetVirtualRegister(const Node* node); | 155 int GetVirtualRegister(const Node* node); |
153 const std::map<NodeId, int> GetVirtualRegistersForTesting() const; | 156 const std::map<NodeId, int> GetVirtualRegistersForTesting() const; |
154 | 157 |
155 Isolate* isolate() const { return sequence()->isolate(); } | 158 Isolate* isolate() const { return sequence()->isolate(); } |
156 | 159 |
157 private: | 160 private: |
158 friend class OperandGenerator; | 161 friend class OperandGenerator; |
159 | 162 |
160 void EmitTableSwitch(const SwitchInfo& sw, InstructionOperand& index_operand); | 163 void EmitTableSwitch(const SwitchInfo& sw, InstructionOperand& index_operand); |
161 void EmitLookupSwitch(const SwitchInfo& sw, | 164 void EmitLookupSwitch(const SwitchInfo& sw, |
162 InstructionOperand& value_operand); | 165 InstructionOperand& value_operand); |
163 | 166 |
164 // Inform the instruction selection that {node} was just defined. | 167 // Inform the instruction selection that {node} was just defined. |
165 void MarkAsDefined(Node* node); | 168 void MarkAsDefined(Node* node); |
166 | 169 |
167 // Inform the instruction selection that {node} has at least one use and we | 170 // Inform the instruction selection that {node} has at least one use and we |
168 // will need to generate code for it. | 171 // will need to generate code for it. |
169 void MarkAsUsed(Node* node); | 172 void MarkAsUsed(Node* node); |
170 | 173 |
| 174 // Sets the effect level of {node}. |
| 175 void SetEffectLevel(Node* node, int effect_level); |
| 176 |
171 // Inform the register allocation of the representation of the value produced | 177 // Inform the register allocation of the representation of the value produced |
172 // by {node}. | 178 // by {node}. |
173 void MarkAsRepresentation(MachineRepresentation rep, Node* node); | 179 void MarkAsRepresentation(MachineRepresentation rep, Node* node); |
174 void MarkAsWord32(Node* node) { | 180 void MarkAsWord32(Node* node) { |
175 MarkAsRepresentation(MachineRepresentation::kWord32, node); | 181 MarkAsRepresentation(MachineRepresentation::kWord32, node); |
176 } | 182 } |
177 void MarkAsWord64(Node* node) { | 183 void MarkAsWord64(Node* node) { |
178 MarkAsRepresentation(MachineRepresentation::kWord64, node); | 184 MarkAsRepresentation(MachineRepresentation::kWord64, node); |
179 } | 185 } |
180 void MarkAsFloat32(Node* node) { | 186 void MarkAsFloat32(Node* node) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 Linkage* const linkage_; | 268 Linkage* const linkage_; |
263 InstructionSequence* const sequence_; | 269 InstructionSequence* const sequence_; |
264 SourcePositionTable* const source_positions_; | 270 SourcePositionTable* const source_positions_; |
265 SourcePositionMode const source_position_mode_; | 271 SourcePositionMode const source_position_mode_; |
266 Features features_; | 272 Features features_; |
267 Schedule* const schedule_; | 273 Schedule* const schedule_; |
268 BasicBlock* current_block_; | 274 BasicBlock* current_block_; |
269 ZoneVector<Instruction*> instructions_; | 275 ZoneVector<Instruction*> instructions_; |
270 BoolVector defined_; | 276 BoolVector defined_; |
271 BoolVector used_; | 277 BoolVector used_; |
| 278 IntVector effect_level_; |
272 IntVector virtual_registers_; | 279 IntVector virtual_registers_; |
273 InstructionScheduler* scheduler_; | 280 InstructionScheduler* scheduler_; |
274 Frame* frame_; | 281 Frame* frame_; |
275 }; | 282 }; |
276 | 283 |
277 } // namespace compiler | 284 } // namespace compiler |
278 } // namespace internal | 285 } // namespace internal |
279 } // namespace v8 | 286 } // namespace v8 |
280 | 287 |
281 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_H_ | 288 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_H_ |
OLD | NEW |