gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

a.out.go (4361B)


      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/twitchyliquid64/golang-asm/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 	ALast // Sentinel: End of low-level WebAssembly instructions.
    235 
    236 	ARESUMEPOINT
    237 	// ACALLNORESUME is a call which is not followed by a resume point.
    238 	// It is allowed inside of WebAssembly blocks, whereas obj.ACALL is not.
    239 	// However, it is not allowed to switch goroutines while inside of an ACALLNORESUME call.
    240 	ACALLNORESUME
    241 
    242 	ARETUNWIND
    243 
    244 	AMOVB
    245 	AMOVH
    246 	AMOVW
    247 	AMOVD
    248 
    249 	AWORD
    250 	ALAST
    251 )
    252 
    253 const (
    254 	REG_NONE = 0
    255 )
    256 
    257 const (
    258 	// globals
    259 	REG_SP = obj.RBaseWasm + iota // SP is currently 32-bit, until 64-bit memory operations are available
    260 	REG_CTXT
    261 	REG_g
    262 	// RET* are used by runtime.return0 and runtime.reflectcall. These functions pass return values in registers.
    263 	REG_RET0
    264 	REG_RET1
    265 	REG_RET2
    266 	REG_RET3
    267 	REG_PAUSE
    268 
    269 	// i32 locals
    270 	REG_R0
    271 	REG_R1
    272 	REG_R2
    273 	REG_R3
    274 	REG_R4
    275 	REG_R5
    276 	REG_R6
    277 	REG_R7
    278 	REG_R8
    279 	REG_R9
    280 	REG_R10
    281 	REG_R11
    282 	REG_R12
    283 	REG_R13
    284 	REG_R14
    285 	REG_R15
    286 
    287 	// f32 locals
    288 	REG_F0
    289 	REG_F1
    290 	REG_F2
    291 	REG_F3
    292 	REG_F4
    293 	REG_F5
    294 	REG_F6
    295 	REG_F7
    296 	REG_F8
    297 	REG_F9
    298 	REG_F10
    299 	REG_F11
    300 	REG_F12
    301 	REG_F13
    302 	REG_F14
    303 	REG_F15
    304 
    305 	// f64 locals
    306 	REG_F16
    307 	REG_F17
    308 	REG_F18
    309 	REG_F19
    310 	REG_F20
    311 	REG_F21
    312 	REG_F22
    313 	REG_F23
    314 	REG_F24
    315 	REG_F25
    316 	REG_F26
    317 	REG_F27
    318 	REG_F28
    319 	REG_F29
    320 	REG_F30
    321 	REG_F31
    322 
    323 	REG_PC_B // also first parameter, i32
    324 
    325 	MAXREG
    326 
    327 	MINREG  = REG_SP
    328 	REGSP   = REG_SP
    329 	REGCTXT = REG_CTXT
    330 	REGG    = REG_g
    331 )