instruction-selector.h revision 958fae7ec3f466955f8e5b50fa5b8d38b9e91675
1b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch// Copyright 2014 the V8 project authors. All rights reserved.
2b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch// Use of this source code is governed by a BSD-style license that can be
3b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch// found in the LICENSE file.
4b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
5b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch#ifndef V8_COMPILER_INSTRUCTION_SELECTOR_H_
6b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch#define V8_COMPILER_INSTRUCTION_SELECTOR_H_
7b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
8b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch#include <deque>
9b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
10b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch#include "src/compiler/common-operator.h"
11b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch#include "src/compiler/instruction.h"
12b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch#include "src/compiler/machine-operator.h"
13b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch#include "src/zone-containers.h"
14b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
15b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdochnamespace v8 {
16b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdochnamespace internal {
17b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdochnamespace compiler {
18b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
19b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch// Forward declarations.
20b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdochstruct CallBuffer;  // TODO(bmeurer): Remove this.
21b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdochclass FlagsContinuation;
22958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernierclass Linkage;
23958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier
24958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Berniertypedef IntVector NodeToVregMap;
25b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
26b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdochclass InstructionSelector FINAL {
27b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch public:
28958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  static const int kNodeUnmapped = -1;
29958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier
30b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // Forward declarations.
31b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  class Features;
32b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
33958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  // TODO(dcarney): pass in vreg mapping instead of graph.
34958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  InstructionSelector(Zone* local_zone, Graph* graph, Linkage* linkage,
35958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier                      InstructionSequence* sequence, Schedule* schedule,
36b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                      SourcePositionTable* source_positions,
37b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                      Features features = SupportedFeatures());
38b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
39b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // Visit code for the entire graph with the included schedule.
40b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void SelectInstructions();
41b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
42b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // ===========================================================================
43b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // ============= Architecture-independent code emission methods. =============
44b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // ===========================================================================
45b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
46b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  Instruction* Emit(InstructionCode opcode, InstructionOperand* output,
47b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                    size_t temp_count = 0, InstructionOperand* *temps = NULL);
48b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  Instruction* Emit(InstructionCode opcode, InstructionOperand* output,
49b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                    InstructionOperand* a, size_t temp_count = 0,
50b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                    InstructionOperand* *temps = NULL);
51b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  Instruction* Emit(InstructionCode opcode, InstructionOperand* output,
52b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                    InstructionOperand* a, InstructionOperand* b,
53b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                    size_t temp_count = 0, InstructionOperand* *temps = NULL);
54b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  Instruction* Emit(InstructionCode opcode, InstructionOperand* output,
55b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                    InstructionOperand* a, InstructionOperand* b,
56b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                    InstructionOperand* c, size_t temp_count = 0,
57b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                    InstructionOperand* *temps = NULL);
58b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  Instruction* Emit(InstructionCode opcode, InstructionOperand* output,
59b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                    InstructionOperand* a, InstructionOperand* b,
60b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                    InstructionOperand* c, InstructionOperand* d,
61b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                    size_t temp_count = 0, InstructionOperand* *temps = NULL);
62958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  Instruction* Emit(InstructionCode opcode, InstructionOperand* output,
63958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier                    InstructionOperand* a, InstructionOperand* b,
64958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier                    InstructionOperand* c, InstructionOperand* d,
65958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier                    InstructionOperand* e, size_t temp_count = 0,
66958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier                    InstructionOperand* *temps = NULL);
67958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  Instruction* Emit(InstructionCode opcode, InstructionOperand* output,
68958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier                    InstructionOperand* a, InstructionOperand* b,
69958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier                    InstructionOperand* c, InstructionOperand* d,
70958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier                    InstructionOperand* e, InstructionOperand* f,
71958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier                    size_t temp_count = 0, InstructionOperand* *temps = NULL);
72b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  Instruction* Emit(InstructionCode opcode, size_t output_count,
73b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                    InstructionOperand** outputs, size_t input_count,
74b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                    InstructionOperand** inputs, size_t temp_count = 0,
75b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                    InstructionOperand* *temps = NULL);
76b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  Instruction* Emit(Instruction* instr);
77b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
78b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // ===========================================================================
79b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // ============== Architecture-independent CPU feature methods. ==============
80b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // ===========================================================================
81b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
82b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  class Features FINAL {
83b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch   public:
84b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch    Features() : bits_(0) {}
85b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch    explicit Features(unsigned bits) : bits_(bits) {}
86b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch    explicit Features(CpuFeature f) : bits_(1u << f) {}
87b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch    Features(CpuFeature f1, CpuFeature f2) : bits_((1u << f1) | (1u << f2)) {}
88b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
89b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch    bool Contains(CpuFeature f) const { return (bits_ & (1u << f)); }
90b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
91b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch   private:
92b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch    unsigned bits_;
93b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  };
94b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
95b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  bool IsSupported(CpuFeature feature) const {
96b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch    return features_.Contains(feature);
97b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  }
98b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
99b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // Returns the features supported on the target platform.
100b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  static Features SupportedFeatures() {
101b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch    return Features(CpuFeatures::SupportedFeatures());
102b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  }
103b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
104958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  // TODO(sigurds) This should take a CpuFeatures argument.
105958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  static MachineOperatorBuilder::Flags SupportedMachineOperatorFlags();
106b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
107b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // ===========================================================================
108b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // ============ Architecture-independent graph covering methods. =============
109b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // ===========================================================================
110b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
111b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // Used in pattern matching during code generation.
112b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // Check if {node} can be covered while generating code for the current
113b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // instruction. A node can be covered if the {user} of the node has the only
114b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // edge and the two are in the same basic block.
115b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  bool CanCover(Node* user, Node* node) const;
116b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
117b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // Checks if {node} was already defined, and therefore code was already
118b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // generated for it.
119b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  bool IsDefined(Node* node) const;
120b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
121b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // Checks if {node} has any uses, and therefore code has to be generated for
122b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // it.
123b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  bool IsUsed(Node* node) const;
124b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
125958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  // Checks if {node} is currently live.
126958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  bool IsLive(Node* node) const { return !IsDefined(node) && IsUsed(node); }
127958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier
128958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  int GetVirtualRegister(const Node* node);
129958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  // Gets the current mapping if it exists, kNodeUnmapped otherwise.
130958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  int GetMappedVirtualRegister(const Node* node) const;
131958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  const NodeToVregMap& GetNodeMapForTesting() const { return node_map_; }
132958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier
133958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier private:
134958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  friend class OperandGenerator;
135958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier
136958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  // Inform the instruction selection that {node} was just defined.
137958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  void MarkAsDefined(Node* node);
138958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier
139b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // Inform the instruction selection that {node} has at least one use and we
140b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // will need to generate code for it.
141b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void MarkAsUsed(Node* node);
142b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
143b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // Checks if {node} is marked as double.
144b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  bool IsDouble(const Node* node) const;
145b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
146b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // Inform the register allocator of a double result.
147b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void MarkAsDouble(Node* node);
148b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
149b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // Checks if {node} is marked as reference.
150b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  bool IsReference(const Node* node) const;
151b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
152b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // Inform the register allocator of a reference result.
153b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void MarkAsReference(Node* node);
154b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
155b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // Inform the register allocation of the representation of the value produced
156b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // by {node}.
157b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void MarkAsRepresentation(MachineType rep, Node* node);
158b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
159958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  // Inform the register allocation of the representation of the unallocated
160958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  // operand {op}.
161958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  void MarkAsRepresentation(MachineType rep, InstructionOperand* op);
162958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier
163b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // Initialize the call buffer with the InstructionOperands, nodes, etc,
164b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // corresponding
165b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // to the inputs and outputs of the call.
166b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // {call_code_immediate} to generate immediate operands to calls of code.
167b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // {call_address_immediate} to generate immediate operands to address calls.
168b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void InitializeCallBuffer(Node* call, CallBuffer* buffer,
169b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                            bool call_code_immediate,
170b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                            bool call_address_immediate);
171b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
172b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  FrameStateDescriptor* GetFrameStateDescriptor(Node* node);
173958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  void FillTypeVectorFromStateValues(ZoneVector<MachineType>* parameters,
174958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier                                     Node* state_values);
175b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void AddFrameStateInputs(Node* state, InstructionOperandVector* inputs,
176b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch                           FrameStateDescriptor* descriptor);
177958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  MachineType GetMachineType(Node* node);
178b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
179b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // ===========================================================================
180b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // ============= Architecture-specific graph covering methods. ===============
181b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // ===========================================================================
182b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
183b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // Visit nodes in the given block and generate code.
184b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void VisitBlock(BasicBlock* block);
185b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
186b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // Visit the node for the control flow at the end of the block, generating
187b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // code if necessary.
188b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void VisitControl(BasicBlock* block);
189b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
190b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // Visit the node and generate code, if any.
191b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void VisitNode(Node* node);
192b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
193b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch#define DECLARE_GENERATOR(x) void Visit##x(Node* node);
194b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  MACHINE_OP_LIST(DECLARE_GENERATOR)
195b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch#undef DECLARE_GENERATOR
196b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
197b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void VisitFinish(Node* node);
198b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void VisitParameter(Node* node);
199b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void VisitPhi(Node* node);
200b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void VisitProjection(Node* node);
201b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void VisitConstant(Node* node);
202958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  void VisitCall(Node* call);
203b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void VisitGoto(BasicBlock* target);
204b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void VisitBranch(Node* input, BasicBlock* tbranch, BasicBlock* fbranch);
205b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void VisitReturn(Node* value);
206b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void VisitThrow(Node* value);
207b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  void VisitDeoptimize(Node* deopt);
208b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
209b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // ===========================================================================
210b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
211958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  Schedule* schedule() const { return schedule_; }
212958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  Linkage* linkage() const { return linkage_; }
213b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  InstructionSequence* sequence() const { return sequence_; }
214b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  Zone* instruction_zone() const { return sequence()->zone(); }
215958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  Zone* zone() const { return zone_; }
216b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
217b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // ===========================================================================
218b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
219958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  Zone* const zone_;
220958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  Linkage* const linkage_;
221958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  InstructionSequence* const sequence_;
222958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  SourcePositionTable* const source_positions_;
223b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  Features features_;
224958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  Schedule* const schedule_;
225958fae7ec3f466955f8e5b50fa5b8d38b9e91675Emily Bernier  NodeToVregMap node_map_;
226b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  BasicBlock* current_block_;
227b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  ZoneDeque<Instruction*> instructions_;
228b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  BoolVector defined_;
229b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  BoolVector used_;
230b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch};
231b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
232b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch}  // namespace compiler
233b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch}  // namespace internal
234b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch}  // namespace v8
235b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
236b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch#endif  // V8_COMPILER_INSTRUCTION_SELECTOR_H_
237