github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/cmd/asm/internal/arch/arch.go (about) 1 // Copyright 2015 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 arch defines architecture-specific information and support functions. 6 package arch 7 8 import ( 9 "github.com/shogo82148/std/cmd/internal/obj" 10 ) 11 12 // Pseudo-registers whose names are the constant name without the leading R. 13 const ( 14 RFP = -(iota + 1) 15 RSB 16 RSP 17 RPC 18 ) 19 20 // Arch wraps the link architecture object with more architecture-specific information. 21 type Arch struct { 22 *obj.LinkArch 23 // Map of instruction names to enumeration. 24 Instructions map[string]obj.As 25 // Map of register names to enumeration. 26 Register map[string]int16 27 // Table of register prefix names. These are things like R for R(0) and SPR for SPR(268). 28 RegisterPrefix map[string]bool 29 // RegisterNumber converts R(10) into arm.REG_R10. 30 RegisterNumber func(string, int16) (int16, bool) 31 // Instruction is a jump. 32 IsJump func(word string) bool 33 } 34 35 // Set configures the architecture specified by GOARCH and returns its representation. 36 // It returns nil if GOARCH is not recognized. 37 func Set(GOARCH string, shared bool) *Arch