aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/mips
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2017-03-17 13:35:31 -0700
committerMatthew Dempsky <mdempsky@google.com>2017-03-17 22:10:53 +0000
commit3e2f980e2721c05eb4a324b1e26080e082568f88 (patch)
tree8c7c239ed1251826459575fd13d5a0ef31cf7a2a /src/cmd/compile/internal/mips
parentaea44109cf23946332319ba51a4a373a9de432e6 (diff)
downloadgo-3e2f980e2721c05eb4a324b1e26080e082568f88.tar.gz
go-3e2f980e2721c05eb4a324b1e26080e082568f88.zip
cmd/compile: eliminate direct uses of gc.Thearch in backends
This CL changes the GOARCH.Init functions to take gc.Thearch as a parameter, which gc.Main supplies. Additionally, the x86 backend is refactored to decide within Init whether to use the 387 or SSE2 instruction generators, rather than for each individual SSA Value/Block. Passes toolstash-check -all. Change-Id: Ie6305a6cd6f6ab4e89ecbb3cbbaf5ffd57057a24 Reviewed-on: https://go-review.googlesource.com/38301 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Diffstat (limited to 'src/cmd/compile/internal/mips')
-rw-r--r--src/cmd/compile/internal/mips/galign.go22
-rw-r--r--src/cmd/compile/internal/mips/ssa.go2
2 files changed, 11 insertions, 13 deletions
diff --git a/src/cmd/compile/internal/mips/galign.go b/src/cmd/compile/internal/mips/galign.go
index 9c7791740a..406ae99a2b 100644
--- a/src/cmd/compile/internal/mips/galign.go
+++ b/src/cmd/compile/internal/mips/galign.go
@@ -11,17 +11,17 @@ import (
"cmd/internal/obj/mips"
)
-func Init() {
- gc.Thearch.LinkArch = &mips.Linkmips
+func Init(arch *gc.Arch) {
+ arch.LinkArch = &mips.Linkmips
if obj.GOARCH == "mipsle" {
- gc.Thearch.LinkArch = &mips.Linkmipsle
+ arch.LinkArch = &mips.Linkmipsle
}
- gc.Thearch.REGSP = mips.REGSP
- gc.Thearch.MAXWIDTH = (1 << 31) - 1
- gc.Thearch.Defframe = defframe
- gc.Thearch.Ginsnop = ginsnop
- gc.Thearch.Proginfo = proginfo
- gc.Thearch.SSAMarkMoves = func(s *gc.SSAGenState, b *ssa.Block) {}
- gc.Thearch.SSAGenValue = ssaGenValue
- gc.Thearch.SSAGenBlock = ssaGenBlock
+ arch.REGSP = mips.REGSP
+ arch.MAXWIDTH = (1 << 31) - 1
+ arch.Defframe = defframe
+ arch.Ginsnop = ginsnop
+ arch.Proginfo = proginfo
+ arch.SSAMarkMoves = func(s *gc.SSAGenState, b *ssa.Block) {}
+ arch.SSAGenValue = ssaGenValue
+ arch.SSAGenBlock = ssaGenBlock
}
diff --git a/src/cmd/compile/internal/mips/ssa.go b/src/cmd/compile/internal/mips/ssa.go
index 8ef39b5f60..3753edcdac 100644
--- a/src/cmd/compile/internal/mips/ssa.go
+++ b/src/cmd/compile/internal/mips/ssa.go
@@ -773,8 +773,6 @@ var blockJump = map[ssa.BlockKind]struct {
}
func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
- s.SetPos(b.Pos)
-
switch b.Kind {
case ssa.BlockPlain:
if b.Succs[0].Block() != next {