Permalink
Browse files

cmd/compile: make ssa compilation unconditional

Rip out the code that allows SSA to be used conditionally.

No longer exists:
 ssa=0 flag
 GOSSAHASH
 GOSSAPKG
 SSATEST

GOSSAFUNC now only controls the printing of the IR/html.

Still need to rip out all of the old backend.  It should no longer be
callable after this CL.

Update #16357

Change-Id: Ib30cc18fba6ca52232c41689ba610b0a94aa74f5
Reviewed-on: https://go-review.googlesource.com/29155
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
  • Loading branch information...
randall77 committed Sep 14, 2016
1 parent eed061f commit 167e381f405d36f71ef152e45bb845b866592c80
@@ -684,7 +684,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p.To.Offset = off
case ssa.OpAMD64MOVOconst:
if v.AuxInt != 0 {
- v.Unimplementedf("MOVOconst can only do constant=0")
+ v.Fatalf("MOVOconst can only do constant=0")
}
r := gc.SSARegNum(v)
opregreg(x86.AXORPS, r, r)
@@ -705,7 +705,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
}
case ssa.OpLoadReg:
if v.Type.IsFlags() {
- v.Unimplementedf("load flags not implemented: %v", v.LongString())
+ v.Fatalf("load flags not implemented: %v", v.LongString())
return
}
p := gc.Prog(loadByType(v.Type))
@@ -725,7 +725,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
case ssa.OpStoreReg:
if v.Type.IsFlags() {
- v.Unimplementedf("store flags not implemented: %v", v.LongString())
+ v.Fatalf("store flags not implemented: %v", v.LongString())
return
}
p := gc.Prog(storeByType(v.Type))
@@ -1031,7 +1031,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
p.To.Reg = gc.SSARegNum(v.Args[0])
gc.AddAux(&p.To, v)
default:
- v.Unimplementedf("genValue not implemented: %s", v.LongString())
+ v.Fatalf("genValue not implemented: %s", v.LongString())
}
}
@@ -1145,6 +1145,6 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
}
default:
- b.Unimplementedf("branch not implemented: %s. Control: %s", b.LongString(), b.Control.LongString())
+ b.Fatalf("branch not implemented: %s. Control: %s", b.LongString(), b.Control.LongString())
}
}
@@ -201,7 +201,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
// nothing to do
case ssa.OpLoadReg:
if v.Type.IsFlags() {
- v.Unimplementedf("load flags not implemented: %v", v.LongString())
+ v.Fatalf("load flags not implemented: %v", v.LongString())
return
}
p := gc.Prog(loadByType(v.Type))
@@ -222,7 +222,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
gc.CheckLoweredPhi(v)
case ssa.OpStoreReg:
if v.Type.IsFlags() {
- v.Unimplementedf("store flags not implemented: %v", v.LongString())
+ v.Fatalf("store flags not implemented: %v", v.LongString())
return
}
p := gc.Prog(storeByType(v.Type))
@@ -958,7 +958,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
case ssa.OpARMInvertFlags:
v.Fatalf("InvertFlags should never make it to codegen %v", v.LongString())
default:
- v.Unimplementedf("genValue not implemented: %s", v.LongString())
+ v.Fatalf("genValue not implemented: %s", v.LongString())
}
}
@@ -1056,6 +1056,6 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
}
default:
- b.Unimplementedf("branch not implemented: %s. Control: %s", b.LongString(), b.Control.LongString())
+ b.Fatalf("branch not implemented: %s. Control: %s", b.LongString(), b.Control.LongString())
}
}
@@ -206,7 +206,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
// nothing to do
case ssa.OpLoadReg:
if v.Type.IsFlags() {
- v.Unimplementedf("load flags not implemented: %v", v.LongString())
+ v.Fatalf("load flags not implemented: %v", v.LongString())
return
}
p := gc.Prog(loadByType(v.Type))
@@ -227,7 +227,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
gc.CheckLoweredPhi(v)
case ssa.OpStoreReg:
if v.Type.IsFlags() {
- v.Unimplementedf("store flags not implemented: %v", v.LongString())
+ v.Fatalf("store flags not implemented: %v", v.LongString())
return
}
p := gc.Prog(storeByType(v.Type))
@@ -884,7 +884,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) {
case ssa.OpARM64InvertFlags:
v.Fatalf("InvertFlags should never make it to codegen %v", v.LongString())
default:
- v.Unimplementedf("genValue not implemented: %s", v.LongString())
+ v.Fatalf("genValue not implemented: %s", v.LongString())
}
}
@@ -982,6 +982,6 @@ func ssaGenBlock(s *gc.SSAGenState, b, next *ssa.Block) {
}
default:
- b.Unimplementedf("branch not implemented: %s. Control: %s", b.LongString(), b.Control.LongString())
+ b.Fatalf("branch not implemented: %s. Control: %s", b.LongString(), b.Control.LongString())
}
}
@@ -208,7 +208,6 @@ func Main() {
flag.StringVar(&cpuprofile, "cpuprofile", "", "write cpu profile to `file`")
flag.StringVar(&memprofile, "memprofile", "", "write memory profile to `file`")
flag.Int64Var(&memprofilerate, "memprofilerate", 0, "set runtime.MemProfileRate to `rate`")
- flag.BoolVar(&ssaEnabled, "ssa", true, "use SSA backend to generate code")
flag.StringVar(&benchfile, "bench", "", "append benchmark times to `file`")
obj.Flagparse(usage)
@@ -5,7 +5,6 @@
package gc
import (
- "cmd/compile/internal/ssa"
"cmd/internal/obj"
"cmd/internal/sys"
"fmt"
@@ -400,9 +399,9 @@ func compile(fn *Node) {
}
// Build an SSA backend function.
- var ssafn *ssa.Func
- if shouldssa(Curfn) {
- ssafn = buildssa(Curfn)
+ ssafn := buildssa(Curfn)
+ if nerrors != 0 {
+ return
}
continpc = nil
@@ -478,83 +477,12 @@ func compile(fn *Node) {
}
}
- if ssafn != nil {
- genssa(ssafn, ptxt, gcargs, gclocals)
- ssafn.Free()
- } else {
- genlegacy(ptxt, gcargs, gclocals)
- }
+ genssa(ssafn, ptxt, gcargs, gclocals)
+ ssafn.Free()
}
type symByName []*Sym
func (a symByName) Len() int { return len(a) }
func (a symByName) Less(i, j int) bool { return a[i].Name < a[j].Name }
func (a symByName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
-
-// genlegacy compiles Curfn using the legacy non-SSA code generator.
-func genlegacy(ptxt *obj.Prog, gcargs, gclocals *Sym) {
- Genlist(Curfn.Func.Enter)
- Genlist(Curfn.Nbody)
- gclean()
- checklabels()
- if nerrors != 0 {
- return
- }
- if Curfn.Func.Endlineno != 0 {
- lineno = Curfn.Func.Endlineno
- }
-
- if Curfn.Type.Results().NumFields() != 0 {
- Ginscall(throwreturn, 0)
- }
-
- ginit()
-
- // TODO: Determine when the final cgen_ret can be omitted. Perhaps always?
- cgen_ret(nil)
-
- if hasdefer {
- // deferreturn pretends to have one uintptr argument.
- // Reserve space for it so stack scanner is happy.
- if Maxarg < int64(Widthptr) {
- Maxarg = int64(Widthptr)
- }
- }
-
- gclean()
- if nerrors != 0 {
- return
- }
-
- Pc.As = obj.ARET // overwrite AEND
- Pc.Lineno = lineno
-
- fixjmp(ptxt)
- if Debug['N'] == 0 || Debug['R'] != 0 || Debug['P'] != 0 {
- regopt(ptxt)
- nilopt(ptxt)
- }
-
- Thearch.Expandchecks(ptxt)
-
- allocauto(ptxt)
-
- setlineno(Curfn)
- if Stksize+Maxarg > 1<<31 {
- Yyerror("stack frame too large (>2GB)")
- return
- }
-
- // Emit garbage collection symbols.
- liveness(Curfn, ptxt, gcargs, gclocals)
-
- Thearch.Defframe(ptxt)
-
- if Debug['f'] != 0 {
- frame(0)
- }
-
- // Remove leftover instrumentation from the instruction stream.
- removevardef(ptxt)
-}
Oops, something went wrong.

0 comments on commit 167e381

Please sign in to comment.