Debian Codegraph @

js/src/jit/loong64/MoveEmitter-loong64.h

raw
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 #ifndef jit_loong64_MoveEmitter_loong64_h
8 #define jit_loong64_MoveEmitter_loong64_h
9
10 #include "jit/MacroAssembler.h"
11 #include "jit/MoveResolver.h"
12
13 namespace js {
14 namespace jit {
15
16 class MoveEmitterLOONG64 {
17 void emitDoubleMove(const MoveOperand& from, const MoveOperand& to);
18 void breakCycle(const MoveOperand& from, const MoveOperand& to,
19 MoveOp::Type type, uint32_t slot);
20 void completeCycle(const MoveOperand& from, const MoveOperand& to,
21 MoveOp::Type type, uint32_t slot);
22
23 protected:
24 uint32_t inCycle_;
25 MacroAssembler& masm;
26
27 // Original stack push value.
28 uint32_t pushedAtStart_;
29
30 // These store stack offsets to spill locations, snapshotting
31 // codegen->framePushed_ at the time they were allocated. They are -1 if no
32 // stack space has been allocated for that particular spill.
33 int32_t pushedAtCycle_;
34 int32_t pushedAtSpill_;
35
36 // These are registers that are available for temporary use. They may be
37 // assigned InvalidReg. If no corresponding spill space has been assigned,
38 // then these registers do not need to be spilled.
39 Register spilledReg_;
40 FloatRegister spilledFloatReg_;
41
42 void assertDone();
43 Register tempReg();
44 FloatRegister tempFloatReg();
45 Address cycleSlot(uint32_t slot, uint32_t subslot = 0) const;
46 int32_t getAdjustedOffset(const MoveOperand& operand);
47 Address getAdjustedAddress(const MoveOperand& operand);
48
49 void emitMove(const MoveOperand& from, const MoveOperand& to);
50 void emitInt32Move(const MoveOperand& from, const MoveOperand& to);
51 void emitFloat32Move(const MoveOperand& from, const MoveOperand& to);
52 void emit(const MoveOp& move);
53
54 public:
55 MoveEmitterLOONG64(MacroAssembler& masm)
56 : inCycle_(0),
57 masm(masm),
58 pushedAtStart_(masm.framePushed()),
59 pushedAtCycle_(-1),
60 pushedAtSpill_(-1),
61 spilledReg_(InvalidReg),
62 spilledFloatReg_(InvalidFloatReg) {}
63
64 ~MoveEmitterLOONG64() { assertDone(); }
65
66 void emit(const MoveResolver& moves);
67 void finish();
68 void setScratchRegister(Register reg) {}
69 };
70
71 typedef MoveEmitterLOONG64 MoveEmitter;
72
73 } // namespace jit
74 } // namespace js
75
76 #endif /* jit_loong64_MoveEmitter_loong64_h */