diff options
| author | Keith Randall <khr@golang.org> | 2015-07-14 13:20:08 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2015-07-16 21:06:13 +0000 |
| commit | 3dcc424be70b9d1824f756ab81f97508ae1a7738 (patch) | |
| tree | cd638559b18418e9d17ab872cc9dbf3abf905b5f /src/cmd/compile/internal/ssa/stackalloc.go | |
| parent | 8adc905a10ffe26204547c95b6d3abe5bf6f9053 (diff) | |
| download | go-3dcc424be70b9d1824f756ab81f97508ae1a7738.tar.xz | |
[dev.ssa] cmd/compile/internal/ssa: compute outarg size correctly
Keep track of the outargs size needed at each call.
Compute the size of the outargs section of the stack frame. It's just
the max of the outargs size at all the callsites in the function.
Change-Id: I3d0640f654f01307633b1a5f75bab16e211ea6c0
Reviewed-on: https://go-review.googlesource.com/12178
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Diffstat (limited to 'src/cmd/compile/internal/ssa/stackalloc.go')
| -rw-r--r-- | src/cmd/compile/internal/ssa/stackalloc.go | 16 |
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 |
