Architecture-wasm32.h (5677B)
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_wasm32_Architecture_wasm32_h 8 #define jit_wasm32_Architecture_wasm32_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::jit { 17 18 static const uint32_t SimdMemoryAlignment = 19 4; // Make it 4 to avoid a bunch of div-by-zero warnings 20 static const uint32_t WasmStackAlignment = 8; 21 static const uint32_t WasmTrapInstructionLength = 0; 22 23 // See comments in wasm::GenerateFunctionPrologue. 24 static constexpr uint32_t WasmCheckedCallEntryOffset = 0u; 25 26 class Registers { 27 public: 28 enum RegisterID { 29 sp = 0, // corresponds to global __stack_pointer which is mapped into 30 // global[0] 31 fp = 1, 32 r2 = 2, 33 r3 = 3, 34 invalid_reg, 35 invalid_reg2, // To avoid silly static_assert failures. 36 }; 37 using Code = uint8_t; 38 using Encoding = RegisterID; 39 union RegisterContent { 40 uintptr_t r; 41 }; 42 43 using SetType = uint8_t; 44 45 static uint32_t SetSize(SetType) { MOZ_CRASH(); } 46 static uint32_t FirstBit(SetType) { MOZ_CRASH(); } 47 static uint32_t LastBit(SetType) { MOZ_CRASH(); } 48 static const char* GetName(Code) { MOZ_CRASH(); } 49 static Code FromName(const char*) { MOZ_CRASH(); } 50 51 static const Encoding StackPointer = RegisterID::sp; 52 static const Encoding FramePointer = RegisterID::fp; 53 static const Encoding Invalid = invalid_reg; 54 static const uint32_t Total = 5; 55 static const uint32_t TotalPhys = 0; 56 static const uint32_t Allocatable = 0; 57 static const SetType AllMask = 0; 58 static const SetType ArgRegMask = 0; 59 static const SetType VolatileMask = 0; 60 static const SetType NonVolatileMask = 0; 61 static const SetType NonAllocatableMask = 0; 62 static const SetType AllocatableMask = 0; 63 static const SetType JSCallMask = 0; 64 static const SetType CallMask = 0; 65 }; 66 67 using PackedRegisterMask = uint8_t; 68 69 class FloatRegisters { 70 public: 71 enum FPRegisterID { f0 = 0, invalid_reg }; 72 using Code = FPRegisterID; 73 using Encoding = FPRegisterID; 74 union RegisterContent { 75 float s; 76 double d; 77 }; 78 79 using SetType = uint32_t; 80 81 static const char* GetName(Code) { MOZ_CRASH(); } 82 static Code FromName(const char*) { MOZ_CRASH(); } 83 84 static const Code Invalid = invalid_reg; 85 static const uint32_t Total = 0; 86 static const uint32_t TotalPhys = 0; 87 static const uint32_t Allocatable = 0; 88 static const SetType AllMask = 0; 89 static const SetType AllDoubleMask = 0; 90 static const SetType AllSingleMask = 0; 91 static const SetType VolatileMask = 0; 92 static const SetType NonVolatileMask = 0; 93 static const SetType NonAllocatableMask = 0; 94 static const SetType AllocatableMask = 0; 95 }; 96 97 template <typename T> 98 class TypedRegisterSet; 99 100 struct FloatRegister { 101 using Codes = FloatRegisters; 102 using Code = Codes::Code; 103 using Encoding = Codes::Encoding; 104 using SetType = Codes::SetType; 105 106 Code _; 107 108 static uint32_t FirstBit(SetType) { MOZ_CRASH(); } 109 static uint32_t LastBit(SetType) { MOZ_CRASH(); } 110 static FloatRegister FromCode(uint32_t) { MOZ_CRASH(); } 111 bool isSingle() const { MOZ_CRASH(); } 112 bool isDouble() const { MOZ_CRASH(); } 113 bool isSimd128() const { MOZ_CRASH(); } 114 bool isInvalid() const { MOZ_CRASH(); } 115 FloatRegister asSingle() const { MOZ_CRASH(); } 116 FloatRegister asDouble() const { MOZ_CRASH(); } 117 FloatRegister asSimd128() const { MOZ_CRASH(); } 118 Code code() const { MOZ_CRASH(); } 119 Encoding encoding() const { MOZ_CRASH(); } 120 const char* name() const { MOZ_CRASH(); } 121 bool volatile_() const { MOZ_CRASH(); } 122 bool operator!=(FloatRegister) const { MOZ_CRASH(); } 123 bool operator==(FloatRegister) const { MOZ_CRASH(); } 124 bool aliases(FloatRegister) const { MOZ_CRASH(); } 125 uint32_t numAliased() const { MOZ_CRASH(); } 126 FloatRegister aliased(uint32_t) { MOZ_CRASH(); } 127 bool equiv(FloatRegister) const { MOZ_CRASH(); } 128 uint32_t size() const { MOZ_CRASH(); } 129 uint32_t numAlignedAliased() const { MOZ_CRASH(); } 130 FloatRegister alignedAliased(uint32_t) { MOZ_CRASH(); } 131 SetType alignedOrDominatedAliasedSet() const { MOZ_CRASH(); } 132 133 static constexpr RegTypeName DefaultType = RegTypeName::Float64; 134 135 template <RegTypeName = DefaultType> 136 static SetType LiveAsIndexableSet(SetType s) { 137 return SetType(0); 138 } 139 140 template <RegTypeName Name = DefaultType> 141 static SetType AllocatableAsIndexableSet(SetType s) { 142 static_assert(Name != RegTypeName::Any, "Allocatable set are not iterable"); 143 return SetType(0); 144 } 145 146 template <typename T> 147 static T ReduceSetForPush(T) { 148 MOZ_CRASH(); 149 } 150 uint32_t getRegisterDumpOffsetInBytes() { MOZ_CRASH(); } 151 static uint32_t SetSize(SetType x) { MOZ_CRASH(); } 152 static Code FromName(const char* name) { MOZ_CRASH(); } 153 154 // This is used in static initializers, so produce a bogus value instead of 155 // crashing. 156 static uint32_t GetPushSizeInBytes(const TypedRegisterSet<FloatRegister>&) { 157 return 0; 158 } 159 }; 160 161 inline bool hasUnaliasedDouble() { MOZ_CRASH(); } 162 inline bool hasMultiAlias() { MOZ_CRASH(); } 163 164 static constexpr uint32_t ShadowStackSpace = 0; 165 static const uint32_t JumpImmediateRange = INT32_MAX; 166 167 #ifdef JS_NUNBOX32 168 static const int32_t NUNBOX32_TYPE_OFFSET = 4; 169 static const int32_t NUNBOX32_PAYLOAD_OFFSET = 0; 170 #endif 171 172 } // namespace js::jit 173 174 #endif /* jit_wasm32_Architecture_wasm32_h */