blob: 9e6f14e5aa6c53b174b6c7318637fdafdcddcefe [file] [log] [blame]
Ben Murdoch3ef787d2012-04-12 10:51:47 +01001// Copyright 2011 the V8 project authors. All rights reserved.
Ben Murdochb8a8cc12014-11-26 15:28:44 +00002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
Ben Murdoch3ef787d2012-04-12 10:51:47 +01004
5#ifndef V8_MIPS_LITHIUM_GAP_RESOLVER_MIPS_H_
6#define V8_MIPS_LITHIUM_GAP_RESOLVER_MIPS_H_
7
Ben Murdochb8a8cc12014-11-26 15:28:44 +00008#include "src/v8.h"
Ben Murdoch3ef787d2012-04-12 10:51:47 +01009
Ben Murdochb8a8cc12014-11-26 15:28:44 +000010#include "src/lithium.h"
Ben Murdoch3ef787d2012-04-12 10:51:47 +010011
12namespace v8 {
13namespace internal {
14
15class LCodeGen;
16class LGapResolver;
17
Ben Murdochb8a8cc12014-11-26 15:28:44 +000018class LGapResolver FINAL BASE_EMBEDDED {
Ben Murdoch3ef787d2012-04-12 10:51:47 +010019 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 // If a cycle is found in the series of moves, save the blocking value to
34 // a scratch register. The cycle must be found by hitting the root of the
35 // depth-first search.
36 void BreakCycle(int index);
37
38 // After a cycle has been resolved, restore the value from the scratch
39 // register to its proper destination.
40 void RestoreValue();
41
42 // Emit a move and remove it from the move graph.
43 void EmitMove(int index);
44
45 // Verify the move list before performing moves.
46 void Verify();
47
48 LCodeGen* cgen_;
49
50 // List of moves not yet resolved.
51 ZoneList<LMoveOperands> moves_;
52
53 int root_index_;
54 bool in_cycle_;
55 LOperand* saved_destination_;
56};
57
58} } // namespace v8::internal
59
60#endif // V8_MIPS_LITHIUM_GAP_RESOLVER_MIPS_H_