...

Source file src/pkg/cmd/internal/obj/wasm/a.out.go

     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 "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		AI32Load // opcode 0x28
    52		AI64Load
    53		AF32Load
    54		AF64Load
    55		AI32Load8S
    56		AI32Load8U
    57		AI32Load16S
    58		AI32Load16U
    59		AI64Load8S
    60		AI64Load8U
    61		AI64Load16S
    62		AI64Load16U
    63		AI64Load32S
    64		AI64Load32U
    65		AI32Store
    66		AI64Store
    67		AF32Store
    68		AF64Store
    69		AI32Store8
    70		AI32Store16
    71		AI64Store8
    72		AI64Store16
    73		AI64Store32
    74		ACurrentMemory
    75		AGrowMemory
    76	
    77		AI32Const
    78		AI64Const
    79		AF32Const
    80		AF64Const
    81	
    82		AI32Eqz
    83		AI32Eq
    84		AI32Ne
    85		AI32LtS
    86		AI32LtU
    87		AI32GtS
    88		AI32GtU
    89		AI32LeS
    90		AI32LeU
    91		AI32GeS
    92		AI32GeU
    93	
    94		AI64Eqz
    95		AI64Eq
    96		AI64Ne
    97		AI64LtS
    98		AI64LtU
    99		AI64GtS
   100		AI64GtU
   101		AI64LeS
   102		AI64LeU
   103		AI64GeS
   104		AI64GeU
   105	
   106		AF32Eq
   107		AF32Ne
   108		AF32Lt
   109		AF32Gt
   110		AF32Le
   111		AF32Ge
   112	
   113		AF64Eq
   114		AF64Ne
   115		AF64Lt
   116		AF64Gt
   117		AF64Le
   118		AF64Ge
   119	
   120		AI32Clz
   121		AI32Ctz
   122		AI32Popcnt
   123		AI32Add
   124		AI32Sub
   125		AI32Mul
   126		AI32DivS
   127		AI32DivU
   128		AI32RemS
   129		AI32RemU
   130		AI32And
   131		AI32Or
   132		AI32Xor
   133		AI32Shl
   134		AI32ShrS
   135		AI32ShrU
   136		AI32Rotl
   137		AI32Rotr
   138	
   139		AI64Clz
   140		AI64Ctz
   141		AI64Popcnt
   142		AI64Add
   143		AI64Sub
   144		AI64Mul
   145		AI64DivS
   146		AI64DivU
   147		AI64RemS
   148		AI64RemU
   149		AI64And
   150		AI64Or
   151		AI64Xor
   152		AI64Shl
   153		AI64ShrS
   154		AI64ShrU
   155		AI64Rotl
   156		AI64Rotr
   157	
   158		AF32Abs
   159		AF32Neg
   160		AF32Ceil
   161		AF32Floor
   162		AF32Trunc
   163		AF32Nearest
   164		AF32Sqrt
   165		AF32Add
   166		AF32Sub
   167		AF32Mul
   168		AF32Div
   169		AF32Min
   170		AF32Max
   171		AF32Copysign
   172	
   173		AF64Abs
   174		AF64Neg
   175		AF64Ceil
   176		AF64Floor
   177		AF64Trunc
   178		AF64Nearest
   179		AF64Sqrt
   180		AF64Add
   181		AF64Sub
   182		AF64Mul
   183		AF64Div
   184		AF64Min
   185		AF64Max
   186		AF64Copysign
   187	
   188		AI32WrapI64
   189		AI32TruncF32S
   190		AI32TruncF32U
   191		AI32TruncF64S
   192		AI32TruncF64U
   193		AI64ExtendI32S
   194		AI64ExtendI32U
   195		AI64TruncF32S
   196		AI64TruncF32U
   197		AI64TruncF64S
   198		AI64TruncF64U
   199		AF32ConvertI32S
   200		AF32ConvertI32U
   201		AF32ConvertI64S
   202		AF32ConvertI64U
   203		AF32DemoteF64
   204		AF64ConvertI32S
   205		AF64ConvertI32U
   206		AF64ConvertI64S
   207		AF64ConvertI64U
   208		AF64PromoteF32
   209		AI32ReinterpretF32
   210		AI64ReinterpretF64
   211		AF32ReinterpretI32
   212		AF64ReinterpretI64
   213		AI32Extend8S
   214		AI32Extend16S
   215		AI64Extend8S
   216		AI64Extend16S
   217		AI64Extend32S
   218	
   219		AI32TruncSatF32S // opcode 0xFC 0x00
   220		AI32TruncSatF32U
   221		AI32TruncSatF64S
   222		AI32TruncSatF64U
   223		AI64TruncSatF32S
   224		AI64TruncSatF32U
   225		AI64TruncSatF64S
   226		AI64TruncSatF64U
   227	
   228		ALast // Sentinel: End of low-level WebAssembly instructions.
   229	
   230		ARESUMEPOINT
   231		// ACALLNORESUME is a call which is not followed by a resume point.
   232		// It is allowed inside of WebAssembly blocks, whereas obj.ACALL is not.
   233		// However, it is not allowed to switch goroutines while inside of an ACALLNORESUME call.
   234		ACALLNORESUME
   235	
   236		ARETUNWIND
   237	
   238		AMOVB
   239		AMOVH
   240		AMOVW
   241		AMOVD
   242	
   243		AWORD
   244		ALAST
   245	)
   246	
   247	const (
   248		REG_NONE = 0
   249	)
   250	
   251	const (
   252		// globals
   253		REG_SP = obj.RBaseWasm + iota // SP is currently 32-bit, until 64-bit memory operations are available
   254		REG_CTXT
   255		REG_g
   256		// RET* are used by runtime.return0 and runtime.reflectcall. These functions pass return values in registers.
   257		REG_RET0
   258		REG_RET1
   259		REG_RET2
   260		REG_RET3
   261		REG_PAUSE
   262	
   263		// locals
   264		REG_R0
   265		REG_R1
   266		REG_R2
   267		REG_R3
   268		REG_R4
   269		REG_R5
   270		REG_R6
   271		REG_R7
   272		REG_R8
   273		REG_R9
   274		REG_R10
   275		REG_R11
   276		REG_R12
   277		REG_R13
   278		REG_R14
   279		REG_R15
   280		REG_F0
   281		REG_F1
   282		REG_F2
   283		REG_F3
   284		REG_F4
   285		REG_F5
   286		REG_F6
   287		REG_F7
   288		REG_F8
   289		REG_F9
   290		REG_F10
   291		REG_F11
   292		REG_F12
   293		REG_F13
   294		REG_F14
   295		REG_F15
   296	
   297		REG_PC_B // also first parameter, i32
   298	
   299		MAXREG
   300	
   301		MINREG  = REG_SP
   302		REGSP   = REG_SP
   303		REGCTXT = REG_CTXT
   304		REGG    = REG_g
   305	)
   306	

View as plain text