cmd/compile: rewrite code to omit many nodeSeq calls

This CL was automatically generated using a special-purpose AST
rewriting tool, followed by manual editing to put some comments back in
the right places and fix some bad line breaks.

The result is not perfect but it's a big step toward getting back to
sanity, and because it was automatically generated there is a decent
chance that it is correct.

Passes toolstash -cmp.

Update #14473.

Change-Id: I01c09078a6d78e2b008bc304d744b79469a38d3d
Reviewed-on: https://go-review.googlesource.com/20440
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/src/cmd/compile/internal/gc/ssa.go b/src/cmd/compile/internal/gc/ssa.go
index 8027a90..e124d02b 100644
--- a/src/cmd/compile/internal/gc/ssa.go
+++ b/src/cmd/compile/internal/gc/ssa.go
@@ -510,8 +510,8 @@
 
 // ssaStmtList converts the statement n to SSA and adds it to s.
 func (s *state) stmtList(l Nodes) {
-	for it := nodeSeqIterate(l); !it.Done(); it.Next() {
-		s.stmt(it.N())
+	for _, n := range l.Slice() {
+		s.stmt(n)
 	}
 }
 
@@ -559,9 +559,9 @@
 		s.call(n.Left, callGo)
 
 	case OAS2DOTTYPE:
-		res, resok := s.dottype(nodeSeqFirst(n.Rlist), true)
-		s.assign(nodeSeqFirst(n.List), res, needwritebarrier(nodeSeqFirst(n.List), nodeSeqFirst(n.Rlist)), false, n.Lineno)
-		s.assign(nodeSeqSecond(n.List), resok, false, false, n.Lineno)
+		res, resok := s.dottype(n.Rlist.First(), true)
+		s.assign(n.List.First(), res, needwritebarrier(n.List.First(), n.Rlist.First()), false, n.Lineno)
+		s.assign(n.List.Second(), resok, false, false, n.Lineno)
 		return
 
 	case ODCL:
@@ -702,7 +702,7 @@
 		bThen := s.f.NewBlock(ssa.BlockPlain)
 		bEnd := s.f.NewBlock(ssa.BlockPlain)
 		var bElse *ssa.Block
-		if nodeSeqLen(n.Rlist) != 0 {
+		if n.Rlist.Len() != 0 {
 			bElse = s.f.NewBlock(ssa.BlockPlain)
 			s.condBranch(n.Left, bThen, bElse, n.Likely)
 		} else {
@@ -715,7 +715,7 @@
 			b.AddEdgeTo(bEnd)
 		}
 
-		if nodeSeqLen(n.Rlist) != 0 {
+		if n.Rlist.Len() != 0 {
 			s.startBlock(bElse)
 			s.stmtList(n.Rlist)
 			if b := s.endBlock(); b != nil {
@@ -2025,14 +2025,14 @@
 		pt := Ptrto(et)
 
 		// Evaluate slice
-		slice := s.expr(nodeSeqFirst(n.List))
+		slice := s.expr(n.List.First())
 
 		// Allocate new blocks
 		grow := s.f.NewBlock(ssa.BlockPlain)
 		assign := s.f.NewBlock(ssa.BlockPlain)
 
 		// Decide if we need to grow
-		nargs := int64(nodeSeqLen(n.List) - 1)
+		nargs := int64(n.List.Len() - 1)
 		p := s.newValue1(ssa.OpSlicePtr, pt, slice)
 		l := s.newValue1(ssa.OpSliceLen, Types[TINT], slice)
 		c := s.newValue1(ssa.OpSliceCap, Types[TINT], slice)