Source file src/cmd/internal/obj/loong64/list.go

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

View as plain text