]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove scratchFpMem global
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 30 Mar 2017 21:34:16 +0000 (14:34 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 30 Mar 2017 22:09:48 +0000 (22:09 +0000)
Instead, add a scratchFpMem field to ssafn,
so that it may be passed on to genssa.

Updates #15756

Change-Id: Icdeae290d3098d14d31659fa07a9863964bb76ed
Reviewed-on: https://go-review.googlesource.com/38728
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/pgen.go
src/cmd/compile/internal/gc/ssa.go

index aa09fb71e7956b6499a89e3ad1a3fbd2bde12962..283a8e616072b82e273b68e3455995d0e8de3fed 100644 (file)
@@ -171,8 +171,6 @@ func (s byStackVar) Len() int           { return len(s) }
 func (s byStackVar) Less(i, j int) bool { return cmpstackvarlt(s[i], s[j]) }
 func (s byStackVar) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
 
-var scratchFpMem *Node
-
 func (s *ssafn) AllocFrame(f *ssa.Func) {
        s.stksize = 0
        s.stkptrsize = 0
@@ -208,9 +206,8 @@ func (s *ssafn) AllocFrame(f *ssa.Func) {
                }
        }
 
-       if f.Config.NeedsFpScratch {
-               scratchFpMem = tempAt(src.NoXPos, s.curfn, Types[TUINT64])
-               scratchFpMem.SetUsed(scratchUsed)
+       if f.Config.NeedsFpScratch && scratchUsed {
+               s.scratchFpMem = tempAt(src.NoXPos, s.curfn, Types[TUINT64])
        }
 
        sort.Sort(byStackVar(fn.Dcl))
index da4c0bb34a6eb8df9bf724ee33c64a74e6b24803..cbd340974b5aef6612544d0f2ffab8891fe32963 100644 (file)
@@ -4306,8 +4306,7 @@ func genssa(f *ssa.Func, pp *Progs) {
                s.SSEto387 = map[int16]int16{}
        }
 
-       s.ScratchFpMem = scratchFpMem
-       scratchFpMem = nil
+       s.ScratchFpMem = e.scratchFpMem
 
        // Emit basic blocks
        for i, b := range f.Blocks {
@@ -4686,11 +4685,12 @@ func fieldIdx(n *Node) int {
 // ssafn holds frontend information about a function that the backend is processing.
 // It also exports a bunch of compiler services for the ssa backend.
 type ssafn struct {
-       curfn      *Node
-       strings    map[string]interface{} // map from constant string to data symbols
-       stksize    int64                  // stack size for current frame
-       stkptrsize int64                  // prefix of stack containing pointers
-       log        bool
+       curfn        *Node
+       strings      map[string]interface{} // map from constant string to data symbols
+       scratchFpMem *Node                  // temp for floating point register / memory moves on some architectures
+       stksize      int64                  // stack size for current frame
+       stkptrsize   int64                  // prefix of stack containing pointers
+       log          bool
 }
 
 // StringData returns a symbol (a *Sym wrapped in an interface) which