podman
73 строки · 2.4 Кб
1// Based on cmd/internal/obj/ppc64/list9.go.
2//
3// Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
4// Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
5// Portions Copyright © 1997-1999 Vita Nuova Limited
6// Portions Copyright © 2000-2008 Vita Nuova Holdings Limited (www.vitanuova.com)
7// Portions Copyright © 2004,2006 Bruce Ellis
8// Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net)
9// Revisions Copyright © 2000-2008 Lucent Technologies Inc. and others
10// Portions Copyright © 2009 The Go Authors. All rights reserved.
11//
12// Permission is hereby granted, free of charge, to any person obtaining a copy
13// of this software and associated documentation files (the "Software"), to deal
14// in the Software without restriction, including without limitation the rights
15// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16// copies of the Software, and to permit persons to whom the Software is
17// furnished to do so, subject to the following conditions:
18//
19// The above copyright notice and this permission notice shall be included in
20// all copies or substantial portions of the Software.
21//
22// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28// THE SOFTWARE.
29
30package s390x
31
32import (
33"github.com/twitchyliquid64/golang-asm/obj"
34"fmt"
35)
36
37func init() {
38obj.RegisterRegister(obj.RBaseS390X, REG_R0+1024, rconv)
39obj.RegisterOpcode(obj.ABaseS390X, Anames)
40}
41
42func rconv(r int) string {
43if r == 0 {
44return "NONE"
45}
46if r == REGG {
47// Special case.
48return "g"
49}
50if REG_R0 <= r && r <= REG_R15 {
51return fmt.Sprintf("R%d", r-REG_R0)
52}
53if REG_F0 <= r && r <= REG_F15 {
54return fmt.Sprintf("F%d", r-REG_F0)
55}
56if REG_AR0 <= r && r <= REG_AR15 {
57return fmt.Sprintf("AR%d", r-REG_AR0)
58}
59if REG_V0 <= r && r <= REG_V31 {
60return fmt.Sprintf("V%d", r-REG_V0)
61}
62return fmt.Sprintf("Rgok(%d)", r-obj.RBaseS390X)
63}
64
65func DRconv(a int) string {
66s := "C_??"
67if a >= C_NONE && a <= C_NCLASS {
68s = cnamesz[a]
69}
70var fp string
71fp += s
72return fp
73}
74