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_none_Architecture_none_h
8 #define jit_none_Architecture_none_h
9 
10 // JitSpewer.h is included through MacroAssembler implementations for other
11 // platforms, so include it here to avoid inadvertent build bustage.
12 #include "jit/JitSpewer.h"
13 
14 #include "jit/shared/Architecture-shared.h"
15 
16 namespace js {
17 namespace jit {
18 
19 static const uint32_t SimdMemoryAlignment =
20     4;  // Make it 4 to avoid a bunch of div-by-zero warnings
21 static const uint32_t WasmStackAlignment = 8;
22 static const uint32_t WasmTrapInstructionLength = 0;
23 
24 // See comments in wasm::GenerateFunctionPrologue.
25 static constexpr uint32_t WasmCheckedCallEntryOffset = 0u;
26 static constexpr uint32_t WasmCheckedTailEntryOffset = 1u;
27 
28 class Registers {
29  public:
30   enum RegisterID {
31     r0 = 0,
32     invalid_reg,
33     invalid_reg2,  // To avoid silly static_assert failures.
34   };
35   typedef uint8_t Code;
36   typedef RegisterID Encoding;
37   union RegisterContent {
38     uintptr_t r;
39   };
40 
41   typedef uint8_t SetType;
42 
SetSize(SetType)43   static uint32_t SetSize(SetType) { MOZ_CRASH(); }
FirstBit(SetType)44   static uint32_t FirstBit(SetType) { MOZ_CRASH(); }
LastBit(SetType)45   static uint32_t LastBit(SetType) { MOZ_CRASH(); }
GetName(Code)46   static const char* GetName(Code) { MOZ_CRASH(); }
FromName(const char *)47   static Code FromName(const char*) { MOZ_CRASH(); }
48 
49   static const Encoding StackPointer = invalid_reg;
50   static const Encoding Invalid = invalid_reg;
51   static const uint32_t Total = 1;
52   static const uint32_t TotalPhys = 0;
53   static const uint32_t Allocatable = 0;
54   static const SetType AllMask = 0;
55   static const SetType ArgRegMask = 0;
56   static const SetType VolatileMask = 0;
57   static const SetType NonVolatileMask = 0;
58   static const SetType NonAllocatableMask = 0;
59   static const SetType AllocatableMask = 0;
60   static const SetType JSCallMask = 0;
61   static const SetType CallMask = 0;
62 };
63 
64 typedef uint8_t PackedRegisterMask;
65 
66 class FloatRegisters {
67  public:
68   enum FPRegisterID { f0 = 0, invalid_reg };
69   typedef FPRegisterID Code;
70   typedef FPRegisterID Encoding;
71   union RegisterContent {
72     double d;
73   };
74 
75   typedef uint32_t SetType;
76 
GetName(Code)77   static const char* GetName(Code) { MOZ_CRASH(); }
FromName(const char *)78   static Code FromName(const char*) { MOZ_CRASH(); }
79 
80   static const Code Invalid = invalid_reg;
81   static const uint32_t Total = 0;
82   static const uint32_t TotalPhys = 0;
83   static const uint32_t Allocatable = 0;
84   static const SetType AllMask = 0;
85   static const SetType AllDoubleMask = 0;
86   static const SetType AllSingleMask = 0;
87   static const SetType VolatileMask = 0;
88   static const SetType NonVolatileMask = 0;
89   static const SetType NonAllocatableMask = 0;
90   static const SetType AllocatableMask = 0;
91 };
92 
93 template <typename T>
94 class TypedRegisterSet;
95 
96 struct FloatRegister {
97   typedef FloatRegisters Codes;
98   typedef Codes::Code Code;
99   typedef Codes::Encoding Encoding;
100   typedef Codes::SetType SetType;
101 
102   Code _;
103 
FirstBitFloatRegister104   static uint32_t FirstBit(SetType) { MOZ_CRASH(); }
LastBitFloatRegister105   static uint32_t LastBit(SetType) { MOZ_CRASH(); }
FromCodeFloatRegister106   static FloatRegister FromCode(uint32_t) { MOZ_CRASH(); }
isSingleFloatRegister107   bool isSingle() const { MOZ_CRASH(); }
isDoubleFloatRegister108   bool isDouble() const { MOZ_CRASH(); }
isSimd128FloatRegister109   bool isSimd128() const { MOZ_CRASH(); }
isInvalidFloatRegister110   bool isInvalid() const { MOZ_CRASH(); }
asSingleFloatRegister111   FloatRegister asSingle() const { MOZ_CRASH(); }
asDoubleFloatRegister112   FloatRegister asDouble() const { MOZ_CRASH(); }
asSimd128FloatRegister113   FloatRegister asSimd128() const { MOZ_CRASH(); }
codeFloatRegister114   Code code() const { MOZ_CRASH(); }
encodingFloatRegister115   Encoding encoding() const { MOZ_CRASH(); }
nameFloatRegister116   const char* name() const { MOZ_CRASH(); }
volatile_FloatRegister117   bool volatile_() const { MOZ_CRASH(); }
118   bool operator!=(FloatRegister) const { MOZ_CRASH(); }
119   bool operator==(FloatRegister) const { MOZ_CRASH(); }
aliasesFloatRegister120   bool aliases(FloatRegister) const { MOZ_CRASH(); }
numAliasedFloatRegister121   uint32_t numAliased() const { MOZ_CRASH(); }
aliasedFloatRegister122   FloatRegister aliased(uint32_t) { MOZ_CRASH(); }
equivFloatRegister123   bool equiv(FloatRegister) const { MOZ_CRASH(); }
sizeFloatRegister124   uint32_t size() const { MOZ_CRASH(); }
numAlignedAliasedFloatRegister125   uint32_t numAlignedAliased() const { MOZ_CRASH(); }
alignedAliasedFloatRegister126   FloatRegister alignedAliased(uint32_t) { MOZ_CRASH(); }
alignedOrDominatedAliasedSetFloatRegister127   SetType alignedOrDominatedAliasedSet() const { MOZ_CRASH(); }
128 
129   static constexpr RegTypeName DefaultType = RegTypeName::Float64;
130 
131   template <RegTypeName = DefaultType>
LiveAsIndexableSetFloatRegister132   static SetType LiveAsIndexableSet(SetType s) {
133     return SetType(0);
134   }
135 
136   template <RegTypeName Name = DefaultType>
AllocatableAsIndexableSetFloatRegister137   static SetType AllocatableAsIndexableSet(SetType s) {
138     static_assert(Name != RegTypeName::Any, "Allocatable set are not iterable");
139     return SetType(0);
140   }
141 
142   template <typename T>
ReduceSetForPushFloatRegister143   static T ReduceSetForPush(T) {
144     MOZ_CRASH();
145   }
getRegisterDumpOffsetInBytesFloatRegister146   uint32_t getRegisterDumpOffsetInBytes() { MOZ_CRASH(); }
SetSizeFloatRegister147   static uint32_t SetSize(SetType x) { MOZ_CRASH(); }
FromNameFloatRegister148   static Code FromName(const char* name) { MOZ_CRASH(); }
149 
150   // This is used in static initializers, so produce a bogus value instead of
151   // crashing.
GetPushSizeInBytesFloatRegister152   static uint32_t GetPushSizeInBytes(const TypedRegisterSet<FloatRegister>&) {
153     return 0;
154   }
155 };
156 
hasUnaliasedDouble()157 inline bool hasUnaliasedDouble() { MOZ_CRASH(); }
hasMultiAlias()158 inline bool hasMultiAlias() { MOZ_CRASH(); }
159 
160 static const uint32_t ShadowStackSpace = 0;
161 static const uint32_t JumpImmediateRange = INT32_MAX;
162 
163 #ifdef JS_NUNBOX32
164 static const int32_t NUNBOX32_TYPE_OFFSET = 4;
165 static const int32_t NUNBOX32_PAYLOAD_OFFSET = 0;
166 #endif
167 
168 }  // namespace jit
169 }  // namespace js
170 
171 #endif /* jit_none_Architecture_none_h */
172