1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_CRANKSHAFT_X64_LITHIUM_GAP_RESOLVER_X64_H_
6 #define V8_CRANKSHAFT_X64_LITHIUM_GAP_RESOLVER_X64_H_
7 
8 #include "src/crankshaft/lithium.h"
9 
10 namespace v8 {
11 namespace internal {
12 
13 class LCodeGen;
14 class LGapResolver;
15 
16 class LGapResolver final BASE_EMBEDDED {
17  public:
18   explicit LGapResolver(LCodeGen* owner);
19 
20   // Resolve a set of parallel moves, emitting assembler instructions.
21   void Resolve(LParallelMove* parallel_move);
22 
23  private:
24   // Build the initial list of moves.
25   void BuildInitialMoveList(LParallelMove* parallel_move);
26 
27   // Perform the move at the moves_ index in question (possibly requiring
28   // other moves to satisfy dependencies).
29   void PerformMove(int index);
30 
31   // Emit a move and remove it from the move graph.
32   void EmitMove(int index);
33 
34   // Execute a move by emitting a swap of two operands.  The move from
35   // source to destination is removed from the move graph.
36   void EmitSwap(int index);
37 
38   // Verify the move list before performing moves.
39   void Verify();
40 
41   LCodeGen* cgen_;
42 
43   // List of moves not yet resolved.
44   ZoneList<LMoveOperands> moves_;
45 };
46 
47 }  // namespace internal
48 }  // namespace v8
49 
50 #endif  // V8_CRANKSHAFT_X64_LITHIUM_GAP_RESOLVER_X64_H_
51