| 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_mips_shared_MoveEmitter_mips_shared_h |
| 8 |
#define jit_mips_shared_MoveEmitter_mips_shared_h |
| 9 |
|
| 10 |
#include "jit/MacroAssembler.h" |
| 11 |
#include "jit/MoveResolver.h" |
| 12 |
|
| 13 |
namespace js { |
| 14 |
namespace jit { |
| 15 |
|
| 16 |
class MoveEmitterMIPSShared { |
| 17 |
protected: |
| 18 |
uint32_t inCycle_; |
| 19 |
MacroAssembler& masm; |
| 20 |
|
| 21 |
// Original stack push value. |
| 22 |
uint32_t pushedAtStart_; |
| 23 |
|
| 24 |
// These store stack offsets to spill locations, snapshotting |
| 25 |
// codegen->framePushed_ at the time they were allocated. They are -1 if no |
| 26 |
// stack space has been allocated for that particular spill. |
| 27 |
int32_t pushedAtCycle_; |
| 28 |
int32_t pushedAtSpill_; |
| 29 |
|
| 30 |
// These are registers that are available for temporary use. They may be |
| 31 |
// assigned InvalidReg. If no corresponding spill space has been assigned, |
| 32 |
// then these registers do not need to be spilled. |
| 33 |
Register spilledReg_; |
| 34 |
FloatRegister spilledFloatReg_; |
| 35 |
|
| 36 |
void assertDone(); |
| 37 |
Register tempReg(); |
| 38 |
FloatRegister tempFloatReg(); |
| 39 |
Address cycleSlot(uint32_t slot, uint32_t subslot = 0) const; |
| 40 |
int32_t getAdjustedOffset(const MoveOperand& operand); |
| 41 |
Address getAdjustedAddress(const MoveOperand& operand); |
| 42 |
|
| 43 |
void emitMove(const MoveOperand& from, const MoveOperand& to); |
| 44 |
void emitInt32Move(const MoveOperand& from, const MoveOperand& to); |
| 45 |
void emitFloat32Move(const MoveOperand& from, const MoveOperand& to); |
| 46 |
virtual void emitDoubleMove(const MoveOperand& from, |
| 47 |
const MoveOperand& to) = 0; |
| 48 |
virtual void breakCycle(const MoveOperand& from, const MoveOperand& to, |
| 49 |
MoveOp::Type type, uint32_t slot) = 0; |
| 50 |
virtual void completeCycle(const MoveOperand& from, const MoveOperand& to, |
| 51 |
MoveOp::Type type, uint32_t slot) = 0; |
| 52 |
void emit(const MoveOp& move); |
| 53 |
|
| 54 |
public: |
| 55 |
MoveEmitterMIPSShared(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 |
~MoveEmitterMIPSShared() { assertDone(); } |
| 64 |
void emit(const MoveResolver& moves); |
| 65 |
void finish(); |
| 66 |
|
| 67 |
void setScratchRegister(Register reg) {} |
| 68 |
}; |
| 69 |
|
| 70 |
} // namespace jit |
| 71 |
} // namespace js |
| 72 |
|
| 73 |
#endif /* jit_mips_shared_MoveEmitter_mips_shared_h */ |