Commit 8b766e5d authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/compile: remove state.exitCode

We're holding onto the function's complete AST anyway, so might as
well grab the exit code from there.

Passes toolstash-check.

Change-Id: I851b5dfdb53f991e9cd9488d25d0d2abc2a8379f
Reviewed-on: https://go-review.googlesource.com/99417
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent e3127f02
...@@ -118,7 +118,6 @@ func buildssa(fn *Node, worker int) *ssa.Func { ...@@ -118,7 +118,6 @@ func buildssa(fn *Node, worker int) *ssa.Func {
if fn.Func.Pragma&Nosplit != 0 { if fn.Func.Pragma&Nosplit != 0 {
s.f.NoSplit = true s.f.NoSplit = true
} }
s.exitCode = fn.Func.Exit
s.panics = map[funcLine]*ssa.Block{} s.panics = map[funcLine]*ssa.Block{}
s.softFloat = s.config.SoftFloat s.softFloat = s.config.SoftFloat
...@@ -191,9 +190,6 @@ func buildssa(fn *Node, worker int) *ssa.Func { ...@@ -191,9 +190,6 @@ func buildssa(fn *Node, worker int) *ssa.Func {
s.insertPhis() s.insertPhis()
// Don't carry reference this around longer than necessary
s.exitCode = Nodes{}
// Main call to ssa package to compile function // Main call to ssa package to compile function
ssa.Compile(s.f) ssa.Compile(s.f)
return s.f return s.f
...@@ -246,10 +242,6 @@ type state struct { ...@@ -246,10 +242,6 @@ type state struct {
labels map[string]*ssaLabel labels map[string]*ssaLabel
labeledNodes map[*Node]*ssaLabel labeledNodes map[*Node]*ssaLabel
// Code that must precede any return
// (e.g., copying value of heap-escaped paramout back to true paramout)
exitCode Nodes
// unlabeled break and continue statement tracking // unlabeled break and continue statement tracking
breakTo *ssa.Block // current target for plain break statement breakTo *ssa.Block // current target for plain break statement
continueTo *ssa.Block // current target for plain continue statement continueTo *ssa.Block // current target for plain continue statement
...@@ -1018,7 +1010,7 @@ func (s *state) exit() *ssa.Block { ...@@ -1018,7 +1010,7 @@ func (s *state) exit() *ssa.Block {
// Run exit code. Typically, this code copies heap-allocated PPARAMOUT // Run exit code. Typically, this code copies heap-allocated PPARAMOUT
// variables back to the stack. // variables back to the stack.
s.stmtList(s.exitCode) s.stmtList(s.curfn.Func.Exit)
// Store SSAable PPARAMOUT variables back to stack locations. // Store SSAable PPARAMOUT variables back to stack locations.
for _, n := range s.returns { for _, n := range s.returns {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment