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 15 matching lines...) Expand all Loading... |
26 | 26 |
27 typedef ZoneVector<InstructionOperand> InstructionOperandVector; | 27 typedef ZoneVector<InstructionOperand> InstructionOperandVector; |
28 | 28 |
29 | 29 |
30 // Instruction selection generates an InstructionSequence for a given Schedule. | 30 // Instruction selection generates an InstructionSequence for a given Schedule. |
31 class InstructionSelector final { | 31 class InstructionSelector final { |
32 public: | 32 public: |
33 // Forward declarations. | 33 // Forward declarations. |
34 class Features; | 34 class Features; |
35 | 35 |
36 InstructionSelector(Zone* zone, size_t node_count, Linkage* linkage, | 36 enum SourcePositionMode { kCallSourcePositions, kAllSourcePositions }; |
37 InstructionSequence* sequence, Schedule* schedule, | 37 |
38 SourcePositionTable* source_positions, | 38 InstructionSelector( |
39 Features features = SupportedFeatures()); | 39 Zone* zone, size_t node_count, Linkage* linkage, |
| 40 InstructionSequence* sequence, Schedule* schedule, |
| 41 SourcePositionTable* source_positions, |
| 42 SourcePositionMode source_position_mode = kCallSourcePositions, |
| 43 Features features = SupportedFeatures()); |
40 | 44 |
41 // Visit code for the entire graph with the included schedule. | 45 // Visit code for the entire graph with the included schedule. |
42 void SelectInstructions(); | 46 void SelectInstructions(); |
43 | 47 |
44 // =========================================================================== | 48 // =========================================================================== |
45 // ============= Architecture-independent code emission methods. ============= | 49 // ============= Architecture-independent code emission methods. ============= |
46 // =========================================================================== | 50 // =========================================================================== |
47 | 51 |
48 Instruction* Emit(InstructionCode opcode, InstructionOperand output, | 52 Instruction* Emit(InstructionCode opcode, InstructionOperand output, |
49 size_t temp_count = 0, InstructionOperand* temps = NULL); | 53 size_t temp_count = 0, InstructionOperand* temps = NULL); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 InstructionSequence* sequence() const { return sequence_; } | 216 InstructionSequence* sequence() const { return sequence_; } |
213 Zone* instruction_zone() const { return sequence()->zone(); } | 217 Zone* instruction_zone() const { return sequence()->zone(); } |
214 Zone* zone() const { return zone_; } | 218 Zone* zone() const { return zone_; } |
215 | 219 |
216 // =========================================================================== | 220 // =========================================================================== |
217 | 221 |
218 Zone* const zone_; | 222 Zone* const zone_; |
219 Linkage* const linkage_; | 223 Linkage* const linkage_; |
220 InstructionSequence* const sequence_; | 224 InstructionSequence* const sequence_; |
221 SourcePositionTable* const source_positions_; | 225 SourcePositionTable* const source_positions_; |
| 226 SourcePositionMode const source_position_mode_; |
222 Features features_; | 227 Features features_; |
223 Schedule* const schedule_; | 228 Schedule* const schedule_; |
224 BasicBlock* current_block_; | 229 BasicBlock* current_block_; |
225 ZoneVector<Instruction*> instructions_; | 230 ZoneVector<Instruction*> instructions_; |
226 BoolVector defined_; | 231 BoolVector defined_; |
227 BoolVector used_; | 232 BoolVector used_; |
228 IntVector virtual_registers_; | 233 IntVector virtual_registers_; |
229 }; | 234 }; |
230 | 235 |
231 } // namespace compiler | 236 } // namespace compiler |
232 } // namespace internal | 237 } // namespace internal |
233 } // namespace v8 | 238 } // namespace v8 |
234 | 239 |
235 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_H_ | 240 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_H_ |
OLD | NEW |