1
0
mirror of https://github.com/golang/go synced 2024-11-18 15:54:42 -07:00

cmd/compile: change goarch.Main into goarch.Init

Similar idea to golang.org/cl/28970.

Change-Id: I9d2feb1a669d71ffda1d612cf39ee0d3c08d22d2
Reviewed-on: https://go-review.googlesource.com/29357
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Matthew Dempsky 2016-09-16 13:56:39 -07:00
parent 32db3f2756
commit d6194c1fd1
8 changed files with 18 additions and 35 deletions

View File

@ -12,7 +12,7 @@ import (
var leaptr = x86.ALEAQ var leaptr = x86.ALEAQ
func Main() { func Init() {
gc.Thearch.LinkArch = &x86.Linkamd64 gc.Thearch.LinkArch = &x86.Linkamd64
if obj.GOARCH == "amd64p32" { if obj.GOARCH == "amd64p32" {
gc.Thearch.LinkArch = &x86.Linkamd64p32 gc.Thearch.LinkArch = &x86.Linkamd64p32
@ -28,7 +28,4 @@ func Main() {
gc.Thearch.SSAMarkMoves = ssaMarkMoves gc.Thearch.SSAMarkMoves = ssaMarkMoves
gc.Thearch.SSAGenValue = ssaGenValue gc.Thearch.SSAGenValue = ssaGenValue
gc.Thearch.SSAGenBlock = ssaGenBlock gc.Thearch.SSAGenBlock = ssaGenBlock
gc.Main()
gc.Exit(0)
} }

View File

@ -10,7 +10,7 @@ import (
"cmd/internal/obj/arm" "cmd/internal/obj/arm"
) )
func Main() { func Init() {
gc.Thearch.LinkArch = &arm.Linkarm gc.Thearch.LinkArch = &arm.Linkarm
gc.Thearch.REGSP = arm.REGSP gc.Thearch.REGSP = arm.REGSP
gc.Thearch.REGCTXT = arm.REGCTXT gc.Thearch.REGCTXT = arm.REGCTXT
@ -22,7 +22,4 @@ func Main() {
gc.Thearch.SSAMarkMoves = func(s *gc.SSAGenState, b *ssa.Block) {} gc.Thearch.SSAMarkMoves = func(s *gc.SSAGenState, b *ssa.Block) {}
gc.Thearch.SSAGenValue = ssaGenValue gc.Thearch.SSAGenValue = ssaGenValue
gc.Thearch.SSAGenBlock = ssaGenBlock gc.Thearch.SSAGenBlock = ssaGenBlock
gc.Main()
gc.Exit(0)
} }

View File

@ -10,7 +10,7 @@ import (
"cmd/internal/obj/arm64" "cmd/internal/obj/arm64"
) )
func Main() { func Init() {
gc.Thearch.LinkArch = &arm64.Linkarm64 gc.Thearch.LinkArch = &arm64.Linkarm64
gc.Thearch.REGSP = arm64.REGSP gc.Thearch.REGSP = arm64.REGSP
gc.Thearch.REGCTXT = arm64.REGCTXT gc.Thearch.REGCTXT = arm64.REGCTXT
@ -22,7 +22,4 @@ func Main() {
gc.Thearch.SSAMarkMoves = func(s *gc.SSAGenState, b *ssa.Block) {} gc.Thearch.SSAMarkMoves = func(s *gc.SSAGenState, b *ssa.Block) {}
gc.Thearch.SSAGenValue = ssaGenValue gc.Thearch.SSAGenValue = ssaGenValue
gc.Thearch.SSAGenBlock = ssaGenBlock gc.Thearch.SSAGenBlock = ssaGenBlock
gc.Main()
gc.Exit(0)
} }

View File

@ -11,7 +11,7 @@ import (
"cmd/internal/obj/mips" "cmd/internal/obj/mips"
) )
func Main() { func Init() {
gc.Thearch.LinkArch = &mips.Linkmips64 gc.Thearch.LinkArch = &mips.Linkmips64
if obj.GOARCH == "mips64le" { if obj.GOARCH == "mips64le" {
gc.Thearch.LinkArch = &mips.Linkmips64le gc.Thearch.LinkArch = &mips.Linkmips64le
@ -26,7 +26,4 @@ func Main() {
gc.Thearch.SSAMarkMoves = func(s *gc.SSAGenState, b *ssa.Block) {} gc.Thearch.SSAMarkMoves = func(s *gc.SSAGenState, b *ssa.Block) {}
gc.Thearch.SSAGenValue = ssaGenValue gc.Thearch.SSAGenValue = ssaGenValue
gc.Thearch.SSAGenBlock = ssaGenBlock gc.Thearch.SSAGenBlock = ssaGenBlock
gc.Main()
gc.Exit(0)
} }

View File

@ -10,7 +10,7 @@ import (
"cmd/internal/obj/ppc64" "cmd/internal/obj/ppc64"
) )
func Main() { func Init() {
gc.Thearch.LinkArch = &ppc64.Linkppc64 gc.Thearch.LinkArch = &ppc64.Linkppc64
if obj.GOARCH == "ppc64le" { if obj.GOARCH == "ppc64le" {
gc.Thearch.LinkArch = &ppc64.Linkppc64le gc.Thearch.LinkArch = &ppc64.Linkppc64le
@ -28,7 +28,4 @@ func Main() {
initvariants() initvariants()
initproginfo() initproginfo()
gc.Main()
gc.Exit(0)
} }

View File

@ -9,7 +9,7 @@ import (
"cmd/internal/obj/s390x" "cmd/internal/obj/s390x"
) )
func Main() { func Init() {
gc.Thearch.LinkArch = &s390x.Links390x gc.Thearch.LinkArch = &s390x.Links390x
gc.Thearch.REGSP = s390x.REGSP gc.Thearch.REGSP = s390x.REGSP
gc.Thearch.REGCTXT = s390x.REGCTXT gc.Thearch.REGCTXT = s390x.REGCTXT
@ -21,7 +21,4 @@ func Main() {
gc.Thearch.SSAMarkMoves = ssaMarkMoves gc.Thearch.SSAMarkMoves = ssaMarkMoves
gc.Thearch.SSAGenValue = ssaGenValue gc.Thearch.SSAGenValue = ssaGenValue
gc.Thearch.SSAGenBlock = ssaGenBlock gc.Thearch.SSAGenBlock = ssaGenBlock
gc.Main()
gc.Exit(0)
} }

View File

@ -12,7 +12,7 @@ import (
"os" "os"
) )
func Main() { func Init() {
gc.Thearch.LinkArch = &x86.Link386 gc.Thearch.LinkArch = &x86.Link386
gc.Thearch.REGSP = x86.REGSP gc.Thearch.REGSP = x86.REGSP
gc.Thearch.REGCTXT = x86.REGCTXT gc.Thearch.REGCTXT = x86.REGCTXT
@ -32,7 +32,4 @@ func Main() {
gc.Thearch.SSAMarkMoves = ssaMarkMoves gc.Thearch.SSAMarkMoves = ssaMarkMoves
gc.Thearch.SSAGenValue = ssaGenValue gc.Thearch.SSAGenValue = ssaGenValue
gc.Thearch.SSAGenBlock = ssaGenBlock gc.Thearch.SSAGenBlock = ssaGenBlock
gc.Main()
gc.Exit(0)
} }

View File

@ -8,6 +8,7 @@ import (
"cmd/compile/internal/amd64" "cmd/compile/internal/amd64"
"cmd/compile/internal/arm" "cmd/compile/internal/arm"
"cmd/compile/internal/arm64" "cmd/compile/internal/arm64"
"cmd/compile/internal/gc"
"cmd/compile/internal/mips64" "cmd/compile/internal/mips64"
"cmd/compile/internal/ppc64" "cmd/compile/internal/ppc64"
"cmd/compile/internal/s390x" "cmd/compile/internal/s390x"
@ -28,18 +29,21 @@ func main() {
fmt.Fprintf(os.Stderr, "compile: unknown architecture %q\n", obj.GOARCH) fmt.Fprintf(os.Stderr, "compile: unknown architecture %q\n", obj.GOARCH)
os.Exit(2) os.Exit(2)
case "386": case "386":
x86.Main() x86.Init()
case "amd64", "amd64p32": case "amd64", "amd64p32":
amd64.Main() amd64.Init()
case "arm": case "arm":
arm.Main() arm.Init()
case "arm64": case "arm64":
arm64.Main() arm64.Init()
case "mips64", "mips64le": case "mips64", "mips64le":
mips64.Main() mips64.Init()
case "ppc64", "ppc64le": case "ppc64", "ppc64le":
ppc64.Main() ppc64.Init()
case "s390x": case "s390x":
s390x.Main() s390x.Init()
} }
gc.Main()
gc.Exit(0)
} }