cmd/compile: add convnop helper function

Like the conv helper function but for creating OCONVNOP nodes
instead of OCONV nodes.

passes toolstash -cmp

Change-Id: Ib93ffe66590ebaa2b4fa552c81f1a2902e789d8e
Reviewed-on: https://go-review.googlesource.com/112597
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Martin Möhrmann 2018-05-10 13:25:39 +02:00
parent 9e2a04d5eb
commit c5d38b896d
5 changed files with 21 additions and 27 deletions

View file

@ -580,8 +580,7 @@ func arrayClear(n, v1, v2, a *Node) bool {
tmp := nod(OINDEX, a, nodintconst(0))
tmp.SetBounded(true)
tmp = nod(OADDR, tmp, nil)
tmp = nod(OCONVNOP, tmp, nil)
tmp.Type = types.Types[TUNSAFEPTR]
tmp = convnop(tmp, types.Types[TUNSAFEPTR])
n.Nbody.Append(nod(OAS, hp, tmp))
// hn = len(a) * sizeof(elem(a))