github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/compile/internal/ssagen/abi.go (about) 1 // Copyright 2009 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 ssagen 6 7 import ( 8 "github.com/shogo82148/std/cmd/compile/internal/ir" 9 "github.com/shogo82148/std/cmd/internal/obj" 10 ) 11 12 // SymABIs records information provided by the assembler about symbol 13 // definition ABIs and reference ABIs. 14 type SymABIs struct { 15 defs map[string]obj.ABI 16 refs map[string]obj.ABISet 17 } 18 19 func NewSymABIs() *SymABIs 20 21 // ReadSymABIs reads a symabis file that specifies definitions and 22 // references of text symbols by ABI. 23 // 24 // The symabis format is a set of lines, where each line is a sequence 25 // of whitespace-separated fields. The first field is a verb and is 26 // either "def" for defining a symbol ABI or "ref" for referencing a 27 // symbol using an ABI. For both "def" and "ref", the second field is 28 // the symbol name and the third field is the ABI name, as one of the 29 // named cmd/internal/obj.ABI constants. 30 func (s *SymABIs) ReadSymABIs(file string) 31 32 // GenABIWrappers applies ABI information to Funcs and generates ABI 33 // wrapper functions where necessary. 34 func (s *SymABIs) GenABIWrappers() 35 36 // CreateWasmImportWrapper creates a wrapper for imported WASM functions to 37 // adapt them to the Go calling convention. The body for this function is 38 // generated in cmd/internal/obj/wasm/wasmobj.go 39 func CreateWasmImportWrapper(fn *ir.Func) bool