js/src/jit/shared/MoveEmitter-x86-shared.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:bbd35279a4c7
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * vim: set ts=8 sts=4 et sw=4 tw=99:
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_MoveEmitter_x86_shared_h
8 #define jit_MoveEmitter_x86_shared_h
9
10 #if defined(JS_CODEGEN_X86)
11 # include "jit/x86/MacroAssembler-x86.h"
12 #elif defined(JS_CODEGEN_X64)
13 # include "jit/x64/MacroAssembler-x64.h"
14 #else
15 # error "Wrong architecture. Only x86 and x64 should build this file!"
16 #endif
17 #include "jit/MoveResolver.h"
18
19 namespace js {
20 namespace jit {
21
22 class CodeGenerator;
23
24 class MoveEmitterX86
25 {
26 bool inCycle_;
27 MacroAssemblerSpecific &masm;
28
29 // Original stack push value.
30 uint32_t pushedAtStart_;
31
32 // This is a store stack offset for the cycle-break spill slot, snapshotting
33 // codegen->framePushed_ at the time it is allocated. -1 if not allocated.
34 int32_t pushedAtCycle_;
35
36 void assertDone();
37 Address cycleSlot();
38 Address toAddress(const MoveOperand &operand) const;
39 Operand toOperand(const MoveOperand &operand) const;
40 Operand toPopOperand(const MoveOperand &operand) const;
41
42 size_t characterizeCycle(const MoveResolver &moves, size_t i,
43 bool *allGeneralRegs, bool *allFloatRegs);
44 bool maybeEmitOptimizedCycle(const MoveResolver &moves, size_t i,
45 bool allGeneralRegs, bool allFloatRegs, size_t swapCount);
46 void emitInt32Move(const MoveOperand &from, const MoveOperand &to);
47 void emitGeneralMove(const MoveOperand &from, const MoveOperand &to);
48 void emitFloat32Move(const MoveOperand &from, const MoveOperand &to);
49 void emitDoubleMove(const MoveOperand &from, const MoveOperand &to);
50 void breakCycle(const MoveOperand &to, MoveOp::Type type);
51 void completeCycle(const MoveOperand &to, MoveOp::Type type);
52
53 public:
54 MoveEmitterX86(MacroAssemblerSpecific &masm);
55 ~MoveEmitterX86();
56 void emit(const MoveResolver &moves);
57 void finish();
58 };
59
60 typedef MoveEmitterX86 MoveEmitter;
61
62 } // ion
63 } // js
64
65 #endif /* jit_MoveEmitter_x86_shared_h */

mercurial