mirror of
https://github.com/golang/go
synced 2024-11-24 05:50:13 -07:00
[dev.ssa] cmd/compile/internal/gc: support CALLFUNC as statement
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>
This commit is contained in:
parent
73054f5729
commit
2aabacdb5a
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user