github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/internal/obj/wasm/wasmobj.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 (
     8  	"github.com/shogo82148/std/cmd/internal/obj"
     9  	"github.com/shogo82148/std/cmd/internal/sys"
    10  )
    11  
    12  var Register = map[string]int16{
    13  	"SP":    REG_SP,
    14  	"CTXT":  REG_CTXT,
    15  	"g":     REG_g,
    16  	"RET0":  REG_RET0,
    17  	"RET1":  REG_RET1,
    18  	"RET2":  REG_RET2,
    19  	"RET3":  REG_RET3,
    20  	"PAUSE": REG_PAUSE,
    21  
    22  	"R0":  REG_R0,
    23  	"R1":  REG_R1,
    24  	"R2":  REG_R2,
    25  	"R3":  REG_R3,
    26  	"R4":  REG_R4,
    27  	"R5":  REG_R5,
    28  	"R6":  REG_R6,
    29  	"R7":  REG_R7,
    30  	"R8":  REG_R8,
    31  	"R9":  REG_R9,
    32  	"R10": REG_R10,
    33  	"R11": REG_R11,
    34  	"R12": REG_R12,
    35  	"R13": REG_R13,
    36  	"R14": REG_R14,
    37  	"R15": REG_R15,
    38  
    39  	"F0":  REG_F0,
    40  	"F1":  REG_F1,
    41  	"F2":  REG_F2,
    42  	"F3":  REG_F3,
    43  	"F4":  REG_F4,
    44  	"F5":  REG_F5,
    45  	"F6":  REG_F6,
    46  	"F7":  REG_F7,
    47  	"F8":  REG_F8,
    48  	"F9":  REG_F9,
    49  	"F10": REG_F10,
    50  	"F11": REG_F11,
    51  	"F12": REG_F12,
    52  	"F13": REG_F13,
    53  	"F14": REG_F14,
    54  	"F15": REG_F15,
    55  
    56  	"F16": REG_F16,
    57  	"F17": REG_F17,
    58  	"F18": REG_F18,
    59  	"F19": REG_F19,
    60  	"F20": REG_F20,
    61  	"F21": REG_F21,
    62  	"F22": REG_F22,
    63  	"F23": REG_F23,
    64  	"F24": REG_F24,
    65  	"F25": REG_F25,
    66  	"F26": REG_F26,
    67  	"F27": REG_F27,
    68  	"F28": REG_F28,
    69  	"F29": REG_F29,
    70  	"F30": REG_F30,
    71  	"F31": REG_F31,
    72  
    73  	"PC_B": REG_PC_B,
    74  }
    75  
    76  var Linkwasm = obj.LinkArch{
    77  	Arch:       sys.ArchWasm,
    78  	Init:       instinit,
    79  	Preprocess: preprocess,
    80  	Assemble:   assemble,
    81  	UnaryDst:   unaryDst,
    82  }
    83  
    84  const (
    85  	/* mark flags */
    86  	WasmImport = 1 << 0
    87  )
    88  
    89  const (
    90  	// This is a special wasm module name that when used as the module name
    91  	// in //go:wasmimport will cause the generated code to pass the stack pointer
    92  	// directly to the imported function. In other words, any function that
    93  	// uses the gojs module understands the internal Go WASM ABI directly.
    94  	GojsModule = "gojs"
    95  )