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
}
}
- 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))
s.SSEto387 = map[int16]int16{}
}
- s.ScratchFpMem = scratchFpMem
- scratchFpMem = nil
+ s.ScratchFpMem = e.scratchFpMem
// Emit basic blocks
for i, b := range f.Blocks {
// 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