• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef V8_COMPILER_GAP_RESOLVER_H_
6 #define V8_COMPILER_GAP_RESOLVER_H_
7 
8 #include "src/compiler/instruction.h"
9 
10 namespace v8 {
11 namespace internal {
12 namespace compiler {
13 
14 class GapResolver final {
15  public:
16   // Interface used by the gap resolver to emit moves and swaps.
17   class Assembler {
18    public:
~Assembler()19     virtual ~Assembler() {}
20 
21     // Assemble move.
22     virtual void AssembleMove(InstructionOperand* source,
23                               InstructionOperand* destination) = 0;
24     // Assemble swap.
25     virtual void AssembleSwap(InstructionOperand* source,
26                               InstructionOperand* destination) = 0;
27   };
28 
GapResolver(Assembler * assembler)29   explicit GapResolver(Assembler* assembler)
30       : assembler_(assembler), split_rep_(MachineRepresentation::kSimd128) {}
31 
32   // Resolve a set of parallel moves, emitting assembler instructions.
33   void Resolve(ParallelMove* parallel_move);
34 
35  private:
36   // Performs the given move, possibly performing other moves to unblock the
37   // destination operand.
38   void PerformMove(ParallelMove* moves, MoveOperands* move);
39 
40   // Assembler used to emit moves and save registers.
41   Assembler* const assembler_;
42 
43   // While resolving moves, the largest FP representation that can be moved.
44   // Any larger moves must be split into an equivalent series of moves of this
45   // representation.
46   MachineRepresentation split_rep_;
47 };
48 
49 }  // namespace compiler
50 }  // namespace internal
51 }  // namespace v8
52 
53 #endif  // V8_COMPILER_GAP_RESOLVER_H_
54