aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/stackalloc.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal/ssa/stackalloc.go')
-rw-r--r--src/cmd/compile/internal/ssa/stackalloc.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/cmd/compile/internal/ssa/stackalloc.go b/src/cmd/compile/internal/ssa/stackalloc.go
index 85a55ece7c..0bd64a1a14 100644
--- a/src/cmd/compile/internal/ssa/stackalloc.go
+++ b/src/cmd/compile/internal/ssa/stackalloc.go
@@ -9,12 +9,16 @@ package ssa
func stackalloc(f *Func) {
home := f.RegAlloc
- // First compute the size of the outargs section.
- n := int64(16) //TODO: compute max of all callsites
-
- // Include one slot for deferreturn.
- if false && n < f.Config.ptrSize { //TODO: check for deferreturn
- n = f.Config.ptrSize
+ // Start with space for callee arguments/returns.
+ var n int64
+ for _, b := range f.Blocks {
+ if b.Kind != BlockCall {
+ continue
+ }
+ v := b.Control
+ if n < v.AuxInt {
+ n = v.AuxInt
+ }
}
// TODO: group variables by ptr/nonptr, size, etc. Emit ptr vars last