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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // Checks if {block} will appear directly after {current_block_} when | 64 // Checks if {block} will appear directly after {current_block_} when |
65 // assembling code, in which case, a fall-through can be used. | 65 // assembling code, in which case, a fall-through can be used. |
66 bool IsNextInAssemblyOrder(const BasicBlock* block) const; | 66 bool IsNextInAssemblyOrder(const BasicBlock* block) const; |
67 | 67 |
68 // Used in pattern matching during code generation. | 68 // Used in pattern matching during code generation. |
69 // Check if {node} can be covered while generating code for the current | 69 // Check if {node} can be covered while generating code for the current |
70 // instruction. A node can be covered if the {user} of the node has the only | 70 // instruction. A node can be covered if the {user} of the node has the only |
71 // edge and the two are in the same basic block. | 71 // edge and the two are in the same basic block. |
72 bool CanCover(Node* user, Node* node) const; | 72 bool CanCover(Node* user, Node* node) const; |
73 | 73 |
| 74 // Checks if {node} was already defined, and therefore code was already |
| 75 // generated for it. |
| 76 bool IsDefined(Node* node) const; |
| 77 |
| 78 // Inform the instruction selection that {node} was just defined. |
| 79 void MarkAsDefined(Node* node); |
| 80 |
74 // Checks if {node} has any uses, and therefore code has to be generated for | 81 // Checks if {node} has any uses, and therefore code has to be generated for |
75 // it. | 82 // it. |
76 bool IsUsed(Node* node) const; | 83 bool IsUsed(Node* node) const; |
77 | 84 |
78 // Inform the instruction selection that {node} has at least one use and we | 85 // Inform the instruction selection that {node} has at least one use and we |
79 // will need to generate code for it. | 86 // will need to generate code for it. |
80 void MarkAsUsed(Node* node); | 87 void MarkAsUsed(Node* node); |
81 | 88 |
82 // Checks if {node} is marked as double. | 89 // Checks if {node} is marked as double. |
83 bool IsDouble(const Node* node) const; | 90 bool IsDouble(const Node* node) const; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // code if necessary. | 123 // code if necessary. |
117 void VisitControl(BasicBlock* block); | 124 void VisitControl(BasicBlock* block); |
118 | 125 |
119 // Visit the node and generate code, if any. | 126 // Visit the node and generate code, if any. |
120 void VisitNode(Node* node); | 127 void VisitNode(Node* node); |
121 | 128 |
122 #define DECLARE_GENERATOR(x) void Visit##x(Node* node); | 129 #define DECLARE_GENERATOR(x) void Visit##x(Node* node); |
123 MACHINE_OP_LIST(DECLARE_GENERATOR) | 130 MACHINE_OP_LIST(DECLARE_GENERATOR) |
124 #undef DECLARE_GENERATOR | 131 #undef DECLARE_GENERATOR |
125 | 132 |
| 133 void VisitInt32AddWithOverflow(Node* node, FlagsContinuation* cont); |
| 134 void VisitInt32SubWithOverflow(Node* node, FlagsContinuation* cont); |
| 135 |
126 void VisitWord32Test(Node* node, FlagsContinuation* cont); | 136 void VisitWord32Test(Node* node, FlagsContinuation* cont); |
127 void VisitWord64Test(Node* node, FlagsContinuation* cont); | 137 void VisitWord64Test(Node* node, FlagsContinuation* cont); |
128 void VisitWord32Compare(Node* node, FlagsContinuation* cont); | 138 void VisitWord32Compare(Node* node, FlagsContinuation* cont); |
129 void VisitWord64Compare(Node* node, FlagsContinuation* cont); | 139 void VisitWord64Compare(Node* node, FlagsContinuation* cont); |
130 void VisitFloat64Compare(Node* node, FlagsContinuation* cont); | 140 void VisitFloat64Compare(Node* node, FlagsContinuation* cont); |
131 | 141 |
132 void VisitParameter(Node* node); | 142 void VisitParameter(Node* node); |
133 void VisitPhi(Node* node); | 143 void VisitPhi(Node* node); |
134 void VisitProjection(Node* node); | 144 void VisitProjection(Node* node); |
135 void VisitConstant(Node* node); | 145 void VisitConstant(Node* node); |
(...skipping 17 matching lines...) Expand all Loading... |
153 // =========================================================================== | 163 // =========================================================================== |
154 | 164 |
155 typedef zone_allocator<Instruction*> InstructionPtrZoneAllocator; | 165 typedef zone_allocator<Instruction*> InstructionPtrZoneAllocator; |
156 typedef std::deque<Instruction*, InstructionPtrZoneAllocator> Instructions; | 166 typedef std::deque<Instruction*, InstructionPtrZoneAllocator> Instructions; |
157 | 167 |
158 Zone zone_; | 168 Zone zone_; |
159 InstructionSequence* sequence_; | 169 InstructionSequence* sequence_; |
160 SourcePositionTable* source_positions_; | 170 SourcePositionTable* source_positions_; |
161 BasicBlock* current_block_; | 171 BasicBlock* current_block_; |
162 Instructions instructions_; | 172 Instructions instructions_; |
| 173 BoolVector defined_; |
163 BoolVector used_; | 174 BoolVector used_; |
164 }; | 175 }; |
165 | 176 |
166 } // namespace compiler | 177 } // namespace compiler |
167 } // namespace internal | 178 } // namespace internal |
168 } // namespace v8 | 179 } // namespace v8 |
169 | 180 |
170 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_H_ | 181 #endif // V8_COMPILER_INSTRUCTION_SELECTOR_H_ |
OLD | NEW |