github.com/bir3/gocompiler@v0.3.205/src/cmd/internal/obj/wasm/a.out.go (about) 1 // Copyright 2018 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package wasm 6 7 import "github.com/bir3/gocompiler/src/cmd/internal/obj" 8 9 //go:generate go run ../stringer.go -i $GOFILE -o anames.go -p wasm 10 11 const ( 12 /* mark flags */ 13 DONE = 1 << iota 14 PRESERVEFLAGS // not allowed to clobber flags 15 ) 16 17 /* 18 * wasm 19 */ 20 const ( 21 ACallImport = obj.ABaseWasm + obj.A_ARCHSPECIFIC + iota 22 AGet 23 ASet 24 ATee 25 ANot // alias for I32Eqz 26 27 // The following are low-level WebAssembly instructions. 28 // Their order matters, since it matches the opcode encoding. 29 // Gaps in the encoding are indicated by comments. 30 31 AUnreachable // opcode 0x00 32 ANop 33 ABlock 34 ALoop 35 AIf 36 AElse 37 38 AEnd // opcode 0x0B 39 ABr 40 ABrIf 41 ABrTable 42 // ACall and AReturn are WebAssembly instructions. obj.ACALL and obj.ARET are higher level instructions 43 // with Go semantics, e.g. they manipulate the Go stack on the linear memory. 44 AReturn 45 ACall 46 ACallIndirect 47 48 ADrop // opcode 0x1A 49 ASelect 50 51 ALocalGet // opcode 0x20 52 ALocalSet 53 ALocalTee 54 AGlobalGet 55 AGlobalSet 56 57 AI32Load // opcode 0x28 58 AI64Load 59 AF32Load 60 AF64Load 61 AI32Load8S 62 AI32Load8U 63 AI32Load16S 64 AI32Load16U 65 AI64Load8S 66 AI64Load8U 67 AI64Load16S 68 AI64Load16U 69 AI64Load32S 70 AI64Load32U 71 AI32Store 72 AI64Store 73 AF32Store 74 AF64Store 75 AI32Store8 76 AI32Store16 77 AI64Store8 78 AI64Store16 79 AI64Store32 80 ACurrentMemory 81 AGrowMemory 82 83 AI32Const 84 AI64Const 85 AF32Const 86 AF64Const 87 88 AI32Eqz 89 AI32Eq 90 AI32Ne 91 AI32LtS 92 AI32LtU 93 AI32GtS 94 AI32GtU 95 AI32LeS 96 AI32LeU 97 AI32GeS 98 AI32GeU 99 100 AI64Eqz 101 AI64Eq 102 AI64Ne 103 AI64LtS 104 AI64LtU 105 AI64GtS 106 AI64GtU 107 AI64LeS 108 AI64LeU 109 AI64GeS 110 AI64GeU 111 112 AF32Eq 113 AF32Ne 114 AF32Lt 115 AF32Gt 116 AF32Le 117 AF32Ge 118 119 AF64Eq 120 AF64Ne 121 AF64Lt 122 AF64Gt 123 AF64Le 124 AF64Ge 125 126 AI32Clz 127 AI32Ctz 128 AI32Popcnt 129 AI32Add 130 AI32Sub 131 AI32Mul 132 AI32DivS 133 AI32DivU 134 AI32RemS 135 AI32RemU 136 AI32And 137 AI32Or 138 AI32Xor 139 AI32Shl 140 AI32ShrS 141 AI32ShrU 142 AI32Rotl 143 AI32Rotr 144 145 AI64Clz 146 AI64Ctz 147 AI64Popcnt 148 AI64Add 149 AI64Sub 150 AI64Mul 151 AI64DivS 152 AI64DivU 153 AI64RemS 154 AI64RemU 155 AI64And 156 AI64Or 157 AI64Xor 158 AI64Shl 159 AI64ShrS 160 AI64ShrU 161 AI64Rotl 162 AI64Rotr 163 164 AF32Abs 165 AF32Neg 166 AF32Ceil 167 AF32Floor 168 AF32Trunc 169 AF32Nearest 170 AF32Sqrt 171 AF32Add 172 AF32Sub 173 AF32Mul 174 AF32Div 175 AF32Min 176 AF32Max 177 AF32Copysign 178 179 AF64Abs 180 AF64Neg 181 AF64Ceil 182 AF64Floor 183 AF64Trunc 184 AF64Nearest 185 AF64Sqrt 186 AF64Add 187 AF64Sub 188 AF64Mul 189 AF64Div 190 AF64Min 191 AF64Max 192 AF64Copysign 193 194 AI32WrapI64 195 AI32TruncF32S 196 AI32TruncF32U 197 AI32TruncF64S 198 AI32TruncF64U 199 AI64ExtendI32S 200 AI64ExtendI32U 201 AI64TruncF32S 202 AI64TruncF32U 203 AI64TruncF64S 204 AI64TruncF64U 205 AF32ConvertI32S 206 AF32ConvertI32U 207 AF32ConvertI64S 208 AF32ConvertI64U 209 AF32DemoteF64 210 AF64ConvertI32S 211 AF64ConvertI32U 212 AF64ConvertI64S 213 AF64ConvertI64U 214 AF64PromoteF32 215 AI32ReinterpretF32 216 AI64ReinterpretF64 217 AF32ReinterpretI32 218 AF64ReinterpretI64 219 AI32Extend8S 220 AI32Extend16S 221 AI64Extend8S 222 AI64Extend16S 223 AI64Extend32S 224 225 AI32TruncSatF32S // opcode 0xFC 0x00 226 AI32TruncSatF32U 227 AI32TruncSatF64S 228 AI32TruncSatF64U 229 AI64TruncSatF32S 230 AI64TruncSatF32U 231 AI64TruncSatF64S 232 AI64TruncSatF64U 233 234 AMemoryInit 235 ADataDrop 236 AMemoryCopy 237 AMemoryFill 238 ATableInit 239 AElemDrop 240 ATableCopy 241 ATableGrow 242 ATableSize 243 ATableFill 244 245 ALast // Sentinel: End of low-level WebAssembly instructions. 246 247 ARESUMEPOINT 248 // ACALLNORESUME is a call which is not followed by a resume point. 249 // It is allowed inside of WebAssembly blocks, whereas obj.ACALL is not. 250 // However, it is not allowed to switch goroutines while inside of an ACALLNORESUME call. 251 ACALLNORESUME 252 253 ARETUNWIND 254 255 AMOVB 256 AMOVH 257 AMOVW 258 AMOVD 259 260 AWORD 261 ALAST 262 ) 263 264 const ( 265 REG_NONE = 0 266 ) 267 268 const ( 269 // globals 270 REG_SP = obj.RBaseWasm + iota // SP is currently 32-bit, until 64-bit memory operations are available 271 REG_CTXT 272 REG_g 273 // RET* are used by runtime.return0 and runtime.reflectcall. These functions pass return values in registers. 274 REG_RET0 275 REG_RET1 276 REG_RET2 277 REG_RET3 278 REG_PAUSE 279 280 // i32 locals 281 REG_R0 282 REG_R1 283 REG_R2 284 REG_R3 285 REG_R4 286 REG_R5 287 REG_R6 288 REG_R7 289 REG_R8 290 REG_R9 291 REG_R10 292 REG_R11 293 REG_R12 294 REG_R13 295 REG_R14 296 REG_R15 297 298 // f32 locals 299 REG_F0 300 REG_F1 301 REG_F2 302 REG_F3 303 REG_F4 304 REG_F5 305 REG_F6 306 REG_F7 307 REG_F8 308 REG_F9 309 REG_F10 310 REG_F11 311 REG_F12 312 REG_F13 313 REG_F14 314 REG_F15 315 316 // f64 locals 317 REG_F16 318 REG_F17 319 REG_F18 320 REG_F19 321 REG_F20 322 REG_F21 323 REG_F22 324 REG_F23 325 REG_F24 326 REG_F25 327 REG_F26 328 REG_F27 329 REG_F28 330 REG_F29 331 REG_F30 332 REG_F31 333 334 REG_PC_B // also first parameter, i32 335 336 MAXREG 337 338 MINREG = REG_SP 339 REGSP = REG_SP 340 REGCTXT = REG_CTXT 341 REGG = REG_g 342 )