]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.ssa] cmd/compile/internal/gc: support CALLFUNC as statement
authorMichael Matloob <matloob@google.com>
Wed, 17 Jun 2015 00:58:03 +0000 (17:58 -0700)
committerMichael Matloob <michaelmatloob@gmail.com>
Wed, 17 Jun 2015 03:34:34 +0000 (03:34 +0000)
I don't have strong understanding of the AST structure, so I'm
not sure if this is the right way to handle function call statements.

Change-Id: Ib526f667ab483b32d9fd17da800b5d6f4b26c4c9
Reviewed-on: https://go-review.googlesource.com/11139
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/gc/ssa.go

index 81a55e4065c94fd70e49aa4b8b9b305c29c30697..f2dbabe6ad0d37c788854370859911e907b4f294 100644 (file)
@@ -335,6 +335,9 @@ func (s *state) stmt(n *Node) {
 
                s.startBlock(bEnd)
 
+       case OCALLFUNC:
+               s.expr(n)
+
        case OVARKILL:
                // TODO(khr): ??? anything to do here?  Only for addrtaken variables?
                // Maybe just link it in the store chain?
@@ -464,6 +467,10 @@ func (s *state) expr(n *Node) *ssa.Value {
                s.startBlock(bNext)
                var titer Iter
                fp := Structfirst(&titer, Getoutarg(n.Left.Type))
+               if fp == nil {
+                       // CALLFUNC has no return value. Continue with the next statement.
+                       return nil
+               }
                a := s.entryNewValue1I(ssa.OpOffPtr, Ptrto(fp.Type), fp.Width, s.sp)
                return s.newValue2(ssa.OpLoad, fp.Type, a, call)
        default: