1
0
mirror of https://github.com/golang/go synced 2024-11-19 07:04:43 -07:00

cmd/compile/internal: clean up galign.go constants

Move the C header style architecture constants to the per arch Main
methods.

Change-Id: Ie7ff39baa275ceaa6680e7d16441ca9f0aa12597
Reviewed-on: https://go-review.googlesource.com/20722
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Dave Cheney 2016-03-15 15:55:47 +11:00
parent 04f23b6428
commit ac47f66abc
6 changed files with 32 additions and 70 deletions

View File

@ -11,9 +11,12 @@ import (
)
var (
thechar int = '6'
thestring string = "amd64"
thelinkarch *obj.LinkArch = &x86.Linkamd64
thestring = "amd64"
thelinkarch = &x86.Linkamd64
addptr = x86.AADDQ
movptr = x86.AMOVQ
leaptr = x86.ALEAQ
cmpptr = x86.ACMPQ
)
func linkarchinit() {
@ -25,15 +28,6 @@ func linkarchinit() {
}
}
var MAXWIDTH int64 = 1 << 50
var (
addptr = x86.AADDQ
movptr = x86.AMOVQ
leaptr = x86.ALEAQ
cmpptr = x86.ACMPQ
)
func betypeinit() {
gc.Widthptr = 8
gc.Widthint = 8
@ -59,7 +53,7 @@ func Main() {
resvd = append(resvd, x86.REG_BP)
}
gc.Thearch.Thechar = thechar
gc.Thearch.Thechar = '6'
gc.Thearch.Thestring = thestring
gc.Thearch.Thelinkarch = thelinkarch
gc.Thearch.REGSP = x86.REGSP
@ -71,7 +65,7 @@ func Main() {
gc.Thearch.REGMAX = x86.REG_R15
gc.Thearch.FREGMIN = x86.REG_X0
gc.Thearch.FREGMAX = x86.REG_X15
gc.Thearch.MAXWIDTH = MAXWIDTH
gc.Thearch.MAXWIDTH = 1 << 50
gc.Thearch.ReservedRegs = resvd
gc.Thearch.AddIndex = addindex

View File

@ -6,21 +6,12 @@ package arm
import (
"cmd/compile/internal/gc"
"cmd/internal/obj"
"cmd/internal/obj/arm"
)
var thechar int = '5'
var thestring string = "arm"
var thelinkarch *obj.LinkArch = &arm.Linkarm
func linkarchinit() {
}
var MAXWIDTH int64 = (1 << 32) - 1
func betypeinit() {
gc.Widthptr = 4
gc.Widthint = 4
@ -28,9 +19,9 @@ func betypeinit() {
}
func Main() {
gc.Thearch.Thechar = thechar
gc.Thearch.Thestring = thestring
gc.Thearch.Thelinkarch = thelinkarch
gc.Thearch.Thechar = '5'
gc.Thearch.Thestring = "arm"
gc.Thearch.Thelinkarch = &arm.Linkarm
gc.Thearch.REGSP = arm.REGSP
gc.Thearch.REGCTXT = arm.REGCTXT
gc.Thearch.REGCALLX = arm.REG_R1
@ -40,7 +31,7 @@ func Main() {
gc.Thearch.REGMAX = arm.REGEXT
gc.Thearch.FREGMIN = arm.REG_F0
gc.Thearch.FREGMAX = arm.FREGEXT
gc.Thearch.MAXWIDTH = MAXWIDTH
gc.Thearch.MAXWIDTH = (1 << 32) - 1
gc.Thearch.ReservedRegs = resvd
gc.Thearch.Betypeinit = betypeinit

View File

@ -6,21 +6,12 @@ package arm64
import (
"cmd/compile/internal/gc"
"cmd/internal/obj"
"cmd/internal/obj/arm64"
)
var thechar int = '7'
var thestring string = "arm64"
var thelinkarch *obj.LinkArch = &arm64.Linkarm64
func linkarchinit() {
}
var MAXWIDTH int64 = 1 << 50
func betypeinit() {
gc.Widthptr = 8
gc.Widthint = 8
@ -28,9 +19,9 @@ func betypeinit() {
}
func Main() {
gc.Thearch.Thechar = thechar
gc.Thearch.Thestring = thestring
gc.Thearch.Thelinkarch = thelinkarch
gc.Thearch.Thechar = '7'
gc.Thearch.Thestring = "arm64"
gc.Thearch.Thelinkarch = &arm64.Linkarm64
gc.Thearch.REGSP = arm64.REGSP
gc.Thearch.REGCTXT = arm64.REGCTXT
gc.Thearch.REGCALLX = arm64.REGRT1
@ -41,7 +32,7 @@ func Main() {
gc.Thearch.REGZERO = arm64.REGZERO
gc.Thearch.FREGMIN = arm64.REG_F0
gc.Thearch.FREGMAX = arm64.REG_F31
gc.Thearch.MAXWIDTH = MAXWIDTH
gc.Thearch.MAXWIDTH = 1 << 50
gc.Thearch.ReservedRegs = resvd
gc.Thearch.Betypeinit = betypeinit

View File

@ -10,11 +10,10 @@ import (
"cmd/internal/obj/mips"
)
var thechar int = '0'
var thestring string = "mips64"
var thelinkarch *obj.LinkArch
var (
thestring = "mips64"
thelinkarch *obj.LinkArch
)
func linkarchinit() {
thestring = obj.Getgoarch()
@ -27,8 +26,6 @@ func linkarchinit() {
gc.Thearch.Thelinkarch = thelinkarch
}
var MAXWIDTH int64 = 1 << 50
func betypeinit() {
gc.Widthptr = 8
gc.Widthint = 8
@ -36,7 +33,7 @@ func betypeinit() {
}
func Main() {
gc.Thearch.Thechar = thechar
gc.Thearch.Thechar = '0'
gc.Thearch.Thestring = thestring
gc.Thearch.Thelinkarch = thelinkarch
gc.Thearch.REGSP = mips.REGSP
@ -48,7 +45,7 @@ func Main() {
gc.Thearch.REGMAX = mips.REG_R31
gc.Thearch.FREGMIN = mips.REG_F0
gc.Thearch.FREGMAX = mips.REG_F31
gc.Thearch.MAXWIDTH = MAXWIDTH
gc.Thearch.MAXWIDTH = 1 << 50
gc.Thearch.ReservedRegs = resvd
gc.Thearch.Betypeinit = betypeinit

View File

@ -10,11 +10,10 @@ import (
"cmd/internal/obj/ppc64"
)
var thechar int = '9'
var thestring string = "ppc64"
var thelinkarch *obj.LinkArch
var (
thestring = "ppc64"
thelinkarch *obj.LinkArch
)
func linkarchinit() {
thestring = obj.Getgoarch()
@ -27,8 +26,6 @@ func linkarchinit() {
gc.Thearch.Thelinkarch = thelinkarch
}
var MAXWIDTH int64 = 1 << 50
func betypeinit() {
gc.Widthptr = 8
gc.Widthint = 8
@ -41,7 +38,7 @@ func betypeinit() {
}
func Main() {
gc.Thearch.Thechar = thechar
gc.Thearch.Thechar = '9'
gc.Thearch.Thestring = thestring
gc.Thearch.Thelinkarch = thelinkarch
gc.Thearch.REGSP = ppc64.REGSP
@ -53,7 +50,7 @@ func Main() {
gc.Thearch.REGMAX = ppc64.REG_R31
gc.Thearch.FREGMIN = ppc64.REG_F0
gc.Thearch.FREGMAX = ppc64.REG_F31
gc.Thearch.MAXWIDTH = MAXWIDTH
gc.Thearch.MAXWIDTH = 1 << 50
gc.Thearch.ReservedRegs = resvd
gc.Thearch.Betypeinit = betypeinit

View File

@ -12,17 +12,9 @@ import (
"os"
)
var thechar int = '8'
var thestring string = "386"
var thelinkarch *obj.LinkArch = &x86.Link386
func linkarchinit() {
}
var MAXWIDTH int64 = (1 << 32) - 1
func betypeinit() {
gc.Widthptr = 4
gc.Widthint = 4
@ -30,9 +22,9 @@ func betypeinit() {
}
func Main() {
gc.Thearch.Thechar = thechar
gc.Thearch.Thestring = thestring
gc.Thearch.Thelinkarch = thelinkarch
gc.Thearch.Thechar = '8'
gc.Thearch.Thestring = "386"
gc.Thearch.Thelinkarch = &x86.Link386
gc.Thearch.REGSP = x86.REGSP
gc.Thearch.REGCTXT = x86.REGCTXT
gc.Thearch.REGCALLX = x86.REG_BX
@ -52,7 +44,7 @@ func Main() {
fmt.Fprintf(os.Stderr, "unsupported setting GO386=%s\n", v)
gc.Exit(1)
}
gc.Thearch.MAXWIDTH = MAXWIDTH
gc.Thearch.MAXWIDTH = (1 << 32) - 1
gc.Thearch.ReservedRegs = resvd
gc.Thearch.Betypeinit = betypeinit