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_X64_LITHIUM_GAP_RESOLVER_X64_H_
6#define V8_X64_LITHIUM_GAP_RESOLVER_X64_H_
7
8#include "src/v8.h"
9
10#include "src/lithium.h"
11
12namespace v8 {
13namespace internal {
14
15class LCodeGen;
16class LGapResolver;
17
18class LGapResolver FINAL BASE_EMBEDDED {
19 public:
20  explicit LGapResolver(LCodeGen* owner);
21
22  // Resolve a set of parallel moves, emitting assembler instructions.
23  void Resolve(LParallelMove* parallel_move);
24
25 private:
26  // Build the initial list of moves.
27  void BuildInitialMoveList(LParallelMove* parallel_move);
28
29  // Perform the move at the moves_ index in question (possibly requiring
30  // other moves to satisfy dependencies).
31  void PerformMove(int index);
32
33  // Emit a move and remove it from the move graph.
34  void EmitMove(int index);
35
36  // Execute a move by emitting a swap of two operands.  The move from
37  // source to destination is removed from the move graph.
38  void EmitSwap(int index);
39
40  // Verify the move list before performing moves.
41  void Verify();
42
43  LCodeGen* cgen_;
44
45  // List of moves not yet resolved.
46  ZoneList<LMoveOperands> moves_;
47};
48
49} }  // namespace v8::internal
50
51#endif  // V8_X64_LITHIUM_GAP_RESOLVER_X64_H_
52