Commit f239196b authored by Keith Randall's avatar Keith Randall

cmd/compile: remove duplicate statement list function

Probably a holdover from linked list vs. slice.

Change-Id: Ib2540b08ef0ae48707d44a5d57bc23f8d65c760d
Reviewed-on: https://go-review.googlesource.com/30256
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
parent f0636bf6
...@@ -131,8 +131,8 @@ func buildssa(fn *Node) *ssa.Func { ...@@ -131,8 +131,8 @@ func buildssa(fn *Node) *ssa.Func {
} }
// Convert the AST-based IR to the SSA-based IR // Convert the AST-based IR to the SSA-based IR
s.stmts(fn.Func.Enter) s.stmtList(fn.Func.Enter)
s.stmts(fn.Nbody) s.stmtList(fn.Nbody)
// fallthrough to exit // fallthrough to exit
if s.curBlock != nil { if s.curBlock != nil {
...@@ -481,20 +481,14 @@ func (s *state) constInt(t ssa.Type, c int64) *ssa.Value { ...@@ -481,20 +481,14 @@ func (s *state) constInt(t ssa.Type, c int64) *ssa.Value {
return s.constInt32(t, int32(c)) return s.constInt32(t, int32(c))
} }
func (s *state) stmts(a Nodes) { // stmtList converts the statement list n to SSA and adds it to s.
for _, x := range a.Slice() {
s.stmt(x)
}
}
// ssaStmtList converts the statement n to SSA and adds it to s.
func (s *state) stmtList(l Nodes) { func (s *state) stmtList(l Nodes) {
for _, n := range l.Slice() { for _, n := range l.Slice() {
s.stmt(n) s.stmt(n)
} }
} }
// ssaStmt converts the statement n to SSA and adds it to s. // stmt converts the statement n to SSA and adds it to s.
func (s *state) stmt(n *Node) { func (s *state) stmt(n *Node) {
s.pushLine(n.Lineno) s.pushLine(n.Lineno)
defer s.popLine() defer s.popLine()
...@@ -737,7 +731,7 @@ func (s *state) stmt(n *Node) { ...@@ -737,7 +731,7 @@ func (s *state) stmt(n *Node) {
} }
s.startBlock(bThen) s.startBlock(bThen)
s.stmts(n.Nbody) s.stmtList(n.Nbody)
if b := s.endBlock(); b != nil { if b := s.endBlock(); b != nil {
b.AddEdgeTo(bEnd) b.AddEdgeTo(bEnd)
} }
...@@ -847,7 +841,7 @@ func (s *state) stmt(n *Node) { ...@@ -847,7 +841,7 @@ func (s *state) stmt(n *Node) {
// generate body // generate body
s.startBlock(bBody) s.startBlock(bBody)
s.stmts(n.Nbody) s.stmtList(n.Nbody)
// tear down continue/break // tear down continue/break
s.continueTo = prevContinue s.continueTo = prevContinue
...@@ -886,7 +880,7 @@ func (s *state) stmt(n *Node) { ...@@ -886,7 +880,7 @@ func (s *state) stmt(n *Node) {
} }
// generate body code // generate body code
s.stmts(n.Nbody) s.stmtList(n.Nbody)
s.breakTo = prevBreak s.breakTo = prevBreak
if lab != nil { if lab != nil {
...@@ -940,7 +934,7 @@ func (s *state) exit() *ssa.Block { ...@@ -940,7 +934,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.stmts(s.exitCode) s.stmtList(s.exitCode)
// 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