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

Side by Side Diff: src/compiler/instruction-selector.h

Issue 837423002: [turbofan] Cleanup duplicated/unused code in InstructionSelector. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix win64 Created 5 years, 11 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/instruction-selector.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 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 <map>
9 9
10 #include "src/compiler/common-operator.h" 10 #include "src/compiler/common-operator.h"
11 #include "src/compiler/instruction.h" 11 #include "src/compiler/instruction.h"
12 #include "src/compiler/machine-operator.h" 12 #include "src/compiler/machine-operator.h"
13 #include "src/zone-containers.h" 13 #include "src/zone-containers.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 namespace internal { 16 namespace internal {
17 namespace compiler { 17 namespace compiler {
18 18
19 // Forward declarations. 19 // Forward declarations.
20 struct CallBuffer; // TODO(bmeurer): Remove this. 20 struct CallBuffer; // TODO(bmeurer): Remove this.
21 class FlagsContinuation; 21 class FlagsContinuation;
22 class Linkage; 22 class Linkage;
23 23
24 typedef IntVector NodeToVregMap;
25
26 class InstructionSelector FINAL { 24 class InstructionSelector FINAL {
27 public: 25 public:
28 static const int kNodeUnmapped = -1;
29
30 // Forward declarations. 26 // Forward declarations.
31 class Features; 27 class Features;
32 28
33 // TODO(dcarney): pass in vreg mapping instead of graph. 29 InstructionSelector(Zone* zone, size_t node_count, Linkage* linkage,
34 InstructionSelector(Zone* local_zone, Graph* graph, Linkage* linkage,
35 InstructionSequence* sequence, Schedule* schedule, 30 InstructionSequence* sequence, Schedule* schedule,
36 SourcePositionTable* source_positions, 31 SourcePositionTable* source_positions,
37 Features features = SupportedFeatures()); 32 Features features = SupportedFeatures());
38 33
39 // Visit code for the entire graph with the included schedule. 34 // Visit code for the entire graph with the included schedule.
40 void SelectInstructions(); 35 void SelectInstructions();
41 36
42 // =========================================================================== 37 // ===========================================================================
43 // ============= Architecture-independent code emission methods. ============= 38 // ============= Architecture-independent code emission methods. =============
44 // =========================================================================== 39 // ===========================================================================
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 bool IsDefined(Node* node) const; 114 bool IsDefined(Node* node) const;
120 115
121 // Checks if {node} has any uses, and therefore code has to be generated for 116 // Checks if {node} has any uses, and therefore code has to be generated for
122 // it. 117 // it.
123 bool IsUsed(Node* node) const; 118 bool IsUsed(Node* node) const;
124 119
125 // Checks if {node} is currently live. 120 // Checks if {node} is currently live.
126 bool IsLive(Node* node) const { return !IsDefined(node) && IsUsed(node); } 121 bool IsLive(Node* node) const { return !IsDefined(node) && IsUsed(node); }
127 122
128 int GetVirtualRegister(const Node* node); 123 int GetVirtualRegister(const Node* node);
129 // Gets the current mapping if it exists, kNodeUnmapped otherwise. 124 const std::map<NodeId, int> GetVirtualRegistersForTesting() const;
130 int GetMappedVirtualRegister(const Node* node) const;
131 const NodeToVregMap& GetNodeMapForTesting() const { return node_map_; }
132 125
133 private: 126 private:
134 friend class OperandGenerator; 127 friend class OperandGenerator;
135 128
136 // Inform the instruction selection that {node} was just defined. 129 // Inform the instruction selection that {node} was just defined.
137 void MarkAsDefined(Node* node); 130 void MarkAsDefined(Node* node);
138 131
139 // Inform the instruction selection that {node} has at least one use and we 132 // Inform the instruction selection that {node} has at least one use and we
140 // will need to generate code for it. 133 // will need to generate code for it.
141 void MarkAsUsed(Node* node); 134 void MarkAsUsed(Node* node);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 Zone* zone() const { return zone_; } 208 Zone* zone() const { return zone_; }
216 209
217 // =========================================================================== 210 // ===========================================================================
218 211
219 Zone* const zone_; 212 Zone* const zone_;
220 Linkage* const linkage_; 213 Linkage* const linkage_;
221 InstructionSequence* const sequence_; 214 InstructionSequence* const sequence_;
222 SourcePositionTable* const source_positions_; 215 SourcePositionTable* const source_positions_;
223 Features features_; 216 Features features_;
224 Schedule* const schedule_; 217 Schedule* const schedule_;
225 NodeToVregMap node_map_;
226 BasicBlock* current_block_; 218 BasicBlock* current_block_;
227 ZoneDeque<Instruction*> instructions_; 219 ZoneVector<Instruction*> instructions_;
228 BoolVector defined_; 220 BoolVector defined_;
229 BoolVector used_; 221 BoolVector used_;
222 IntVector virtual_registers_;
230 }; 223 };
231 224
232 } // namespace compiler 225 } // namespace compiler
233 } // namespace internal 226 } // namespace internal
234 } // namespace v8 227 } // namespace v8
235 228
236 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_H_ 229 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler/instruction-selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698