github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/internal/engine/compiler/arch_amd64.go (about) 1 package compiler 2 3 import ( 4 "github.com/bananabytelabs/wazero/internal/asm" 5 "github.com/bananabytelabs/wazero/internal/asm/amd64" 6 ) 7 8 // init initializes variables for the amd64 architecture 9 func init() { 10 newArchContext = newArchContextImpl 11 registerNameFn = amd64.RegisterName 12 unreservedGeneralPurposeRegisters = amd64UnreservedGeneralPurposeRegisters 13 unreservedVectorRegisters = amd64UnreservedVectorRegisters 14 } 15 16 // archContext is embedded in callEngine in order to store architecture-specific data. 17 // For amd64, this is empty. 18 type archContext struct{} 19 20 // newArchContextImpl implements newArchContext for amd64 architecture. 21 func newArchContextImpl() (ret archContext) { return } 22 23 // newCompiler returns a new compiler interface which can be used to compile the given function instance. 24 // Note: ir param can be nil for host functions. 25 func newCompiler() compiler { 26 return newAmd64Compiler() 27 } 28 29 func registerMaskShift(r asm.Register) int { 30 return int(r - amd64.RegAX) 31 } 32 33 func registerFromMaskShift(s int) asm.Register { 34 return amd64.RegAX + asm.Register(s) 35 }