github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/cmd/obj/loong64/list.go (about) 1 // Copyright 2022 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 loong64 6 7 import ( 8 "fmt" 9 10 "github.com/go-asm/go/cmd/obj" 11 ) 12 13 func init() { 14 obj.RegisterRegister(obj.RBaseLOONG64, REG_LAST+1, rconv) 15 obj.RegisterOpcode(obj.ABaseLoong64, Anames) 16 } 17 18 func rconv(r int) string { 19 if r == 0 { 20 return "NONE" 21 } 22 if r == REGG { 23 // Special case. 24 return "g" 25 } 26 if REG_R0 <= r && r <= REG_R31 { 27 return fmt.Sprintf("R%d", r-REG_R0) 28 } 29 if REG_F0 <= r && r <= REG_F31 { 30 return fmt.Sprintf("F%d", r-REG_F0) 31 } 32 if REG_FCSR0 <= r && r <= REG_FCSR31 { 33 return fmt.Sprintf("FCSR%d", r-REG_FCSR0) 34 } 35 if REG_FCC0 <= r && r <= REG_FCC31 { 36 return fmt.Sprintf("FCC%d", r-REG_FCC0) 37 } 38 return fmt.Sprintf("Rgok(%d)", r-obj.RBaseLOONG64) 39 } 40 41 func DRconv(a int) string { 42 s := "C_??" 43 if a >= C_NONE && a <= C_NCLASS { 44 s = cnames0[a] 45 } 46 return s 47 }