[dev.ssa] cmd/compile: change ssa compilation trigger

We used to compile everything with SSA and then decide whether
to use the result or not.  It was useful when we were working
on coverage without much regard for correctness, but not so much now.

Instead, let's decide what we're going to compile and go through
the SSA compiler for only those functions.

TODO: next CL: get rid of all the UnimplementedF stuff.

Change-Id: If629addd8b62cd38ef553fd5d835114137885ce0
Reviewed-on: https://go-review.googlesource.com/17763
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Keith Randall 2015-12-11 20:41:52 -08:00
parent 4989337192
commit 5b355a7907
2 changed files with 68 additions and 57 deletions

View file

@ -364,7 +364,6 @@ func compile(fn *Node) {
var gcargs *Sym
var gclocals *Sym
var ssafn *ssa.Func
var usessa bool
if fn.Nbody == nil {
if pure_go != 0 || strings.HasPrefix(fn.Func.Nname.Sym.Name, "init.") {
Yyerror("missing function body for %q", fn.Func.Nname.Sym.Name)
@ -417,9 +416,8 @@ func compile(fn *Node) {
}
// Build an SSA backend function.
// TODO: get rid of usessa.
if Thearch.Thestring == "amd64" {
ssafn, usessa = buildssa(Curfn)
if shouldssa(Curfn) {
ssafn = buildssa(Curfn)
}
continpc = nil
@ -485,7 +483,7 @@ func compile(fn *Node) {
}
}
if ssafn != nil && usessa {
if ssafn != nil {
genssa(ssafn, ptxt, gcargs, gclocals)
if Curfn.Func.Endlineno != 0 {
lineno = Curfn.Func.Endlineno