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/. */
7 #ifndef jit_none_Assembler_none_h
8 #define jit_none_Assembler_none_h
10 #include "mozilla/Assertions.h"
14 #include "jit/none/Architecture-none.h"
15 #include "jit/Registers.h"
16 #include "jit/RegisterSets.h"
17 #include "jit/shared/Assembler-shared.h"
24 static constexpr Register StackPointer
{Registers::invalid_reg
};
25 static constexpr Register FramePointer
{Registers::invalid_reg
};
26 static constexpr Register ReturnReg
{Registers::invalid_reg2
};
27 static constexpr FloatRegister ReturnFloat32Reg
= {FloatRegisters::invalid_reg
};
28 static constexpr FloatRegister ReturnDoubleReg
= {FloatRegisters::invalid_reg
};
29 static constexpr FloatRegister ReturnSimd128Reg
= {FloatRegisters::invalid_reg
};
30 static constexpr FloatRegister ScratchSimd128Reg
= {
31 FloatRegisters::invalid_reg
};
32 static constexpr FloatRegister InvalidFloatReg
= {FloatRegisters::invalid_reg
};
34 struct ScratchFloat32Scope
: FloatRegister
{
35 explicit ScratchFloat32Scope(MacroAssembler
& masm
) {}
38 struct ScratchDoubleScope
: FloatRegister
{
39 explicit ScratchDoubleScope(MacroAssembler
& masm
) {}
42 static constexpr Register OsrFrameReg
{Registers::invalid_reg
};
43 static constexpr Register PreBarrierReg
{Registers::invalid_reg
};
44 static constexpr Register InterpreterPCReg
{Registers::invalid_reg
};
45 static constexpr Register CallTempReg0
{Registers::invalid_reg
};
46 static constexpr Register CallTempReg1
{Registers::invalid_reg
};
47 static constexpr Register CallTempReg2
{Registers::invalid_reg
};
48 static constexpr Register CallTempReg3
{Registers::invalid_reg
};
49 static constexpr Register CallTempReg4
{Registers::invalid_reg
};
50 static constexpr Register CallTempReg5
{Registers::invalid_reg
};
51 static constexpr Register InvalidReg
{Registers::invalid_reg
};
52 static constexpr Register CallTempNonArgRegs
[] = {InvalidReg
, InvalidReg
};
53 static const uint32_t NumCallTempNonArgRegs
= std::size(CallTempNonArgRegs
);
55 static constexpr Register IntArgReg0
{Registers::invalid_reg
};
56 static constexpr Register IntArgReg1
{Registers::invalid_reg
};
57 static constexpr Register IntArgReg2
{Registers::invalid_reg
};
58 static constexpr Register IntArgReg3
{Registers::invalid_reg
};
59 static constexpr Register HeapReg
{Registers::invalid_reg
};
61 static constexpr Register RegExpMatcherRegExpReg
{Registers::invalid_reg
};
62 static constexpr Register RegExpMatcherStringReg
{Registers::invalid_reg
};
63 static constexpr Register RegExpMatcherLastIndexReg
{Registers::invalid_reg
};
65 static constexpr Register RegExpExecTestRegExpReg
{Registers::invalid_reg
};
66 static constexpr Register RegExpExecTestStringReg
{Registers::invalid_reg
};
68 static constexpr Register RegExpSearcherRegExpReg
{Registers::invalid_reg
};
69 static constexpr Register RegExpSearcherStringReg
{Registers::invalid_reg
};
70 static constexpr Register RegExpSearcherLastIndexReg
{Registers::invalid_reg
};
72 // Uses |invalid_reg2| to avoid static_assert failures.
73 static constexpr Register JSReturnReg_Type
{Registers::invalid_reg2
};
74 static constexpr Register JSReturnReg_Data
{Registers::invalid_reg2
};
75 static constexpr Register JSReturnReg
{Registers::invalid_reg2
};
77 #if defined(JS_NUNBOX32)
78 static constexpr ValueOperand
JSReturnOperand(InvalidReg
, InvalidReg
);
79 static constexpr Register64
ReturnReg64(InvalidReg
, InvalidReg
);
80 #elif defined(JS_PUNBOX64)
81 static constexpr ValueOperand
JSReturnOperand(InvalidReg
);
82 static constexpr Register64
ReturnReg64(InvalidReg
);
84 # error "Bad architecture"
87 static constexpr Register ABINonArgReg0
{Registers::invalid_reg
};
88 static constexpr Register ABINonArgReg1
{Registers::invalid_reg
};
89 static constexpr Register ABINonArgReg2
{Registers::invalid_reg
};
90 static constexpr Register ABINonArgReg3
{Registers::invalid_reg
};
91 static constexpr Register ABINonArgReturnReg0
{Registers::invalid_reg
};
92 static constexpr Register ABINonArgReturnReg1
{Registers::invalid_reg
};
93 static constexpr Register ABINonVolatileReg
{Registers::invalid_reg
};
94 static constexpr Register ABINonArgReturnVolatileReg
{Registers::invalid_reg
};
96 static constexpr FloatRegister ABINonArgDoubleReg
= {
97 FloatRegisters::invalid_reg
};
99 static constexpr Register WasmTableCallScratchReg0
{Registers::invalid_reg
};
100 static constexpr Register WasmTableCallScratchReg1
{Registers::invalid_reg
};
101 static constexpr Register WasmTableCallSigReg
{Registers::invalid_reg
};
102 static constexpr Register WasmTableCallIndexReg
{Registers::invalid_reg
};
103 static constexpr Register InstanceReg
{Registers::invalid_reg
};
104 static constexpr Register WasmJitEntryReturnScratch
{Registers::invalid_reg
};
105 static constexpr Register WasmCallRefCallScratchReg0
{Registers::invalid_reg
};
106 static constexpr Register WasmCallRefCallScratchReg1
{Registers::invalid_reg
};
107 static constexpr Register WasmCallRefReg
{Registers::invalid_reg
};
108 static constexpr Register WasmTailCallInstanceScratchReg
{
109 Registers::invalid_reg
};
110 static constexpr Register WasmTailCallRAScratchReg
{Registers::invalid_reg
};
111 static constexpr Register WasmTailCallFPScratchReg
{Registers::invalid_reg
};
113 static constexpr uint32_t ABIStackAlignment
= 4;
114 static constexpr uint32_t CodeAlignment
= 16;
115 #ifdef ENABLE_PORTABLE_BASELINE_INTERP
116 static constexpr uint32_t JitStackAlignment
= sizeof(void*);
117 static constexpr uint32_t JitStackValueAlignment
= 1;
119 static constexpr uint32_t JitStackAlignment
= 8;
120 static constexpr uint32_t JitStackValueAlignment
=
121 JitStackAlignment
/ sizeof(Value
);
124 static const Scale ScalePointer
= TimesOne
;
126 class Assembler
: public AssemblerShared
{
149 enum DoubleCondition
{
154 DoubleGreaterThanOrEqual
,
156 DoubleLessThanOrEqual
,
158 DoubleEqualOrUnordered
,
159 DoubleNotEqualOrUnordered
,
160 DoubleGreaterThanOrUnordered
,
161 DoubleGreaterThanOrEqualOrUnordered
,
162 DoubleLessThanOrUnordered
,
163 DoubleLessThanOrEqualOrUnordered
166 static Condition
InvertCondition(Condition
) { MOZ_CRASH(); }
168 static DoubleCondition
InvertCondition(DoubleCondition
) { MOZ_CRASH(); }
170 template <typename T
, typename S
>
171 static void PatchDataWithValueCheck(CodeLocationLabel
, T
, S
) {
174 static void PatchWrite_Imm32(CodeLocationLabel
, Imm32
) { MOZ_CRASH(); }
176 static void PatchWrite_NearCall(CodeLocationLabel
, CodeLocationLabel
) {
179 static uint32_t PatchWrite_NearCallSize() { MOZ_CRASH(); }
181 static void ToggleToJmp(CodeLocationLabel
) { MOZ_CRASH(); }
182 static void ToggleToCmp(CodeLocationLabel
) { MOZ_CRASH(); }
183 static void ToggleCall(CodeLocationLabel
, bool) { MOZ_CRASH(); }
185 static void Bind(uint8_t*, const CodeLabel
&) { MOZ_CRASH(); }
187 static uintptr_t GetPointer(uint8_t*) { MOZ_CRASH(); }
189 static bool HasRoundInstruction(RoundingMode
) { return false; }
191 void verifyHeapAccessDisassembly(uint32_t begin
, uint32_t end
,
192 const Disassembler::HeapAccess
& heapAccess
) {
196 void setUnlimitedBuffer() { MOZ_CRASH(); }
201 explicit Operand(const Address
&) { MOZ_CRASH(); }
202 explicit Operand(const Register
) { MOZ_CRASH(); }
203 explicit Operand(const FloatRegister
) { MOZ_CRASH(); }
204 explicit Operand(Register
, Imm32
) { MOZ_CRASH(); }
205 explicit Operand(Register
, int32_t) { MOZ_CRASH(); }
208 class ABIArgGenerator
{
210 ABIArgGenerator() { MOZ_CRASH(); }
211 ABIArg
next(MIRType
) { MOZ_CRASH(); }
212 ABIArg
& current() { MOZ_CRASH(); }
213 uint32_t stackBytesConsumedSoFar() const { MOZ_CRASH(); }
214 void increaseStackOffset(uint32_t) { MOZ_CRASH(); }
220 #endif /* jit_none_Assembler_none_h */