1
0
mirror of https://github.com/golang/go synced 2024-11-26 19:51:17 -07:00

cmd/compile: teach Haspointer about TSSA and TTUPLE

These will appear when tracking live pointers in registers, so we need
to know whether they have pointers.

For #24543.

Change-Id: I2edccee39ca989473db4b3e7875ff166808ac141
Reviewed-on: https://go-review.googlesource.com/108497
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Austin Clements 2017-10-02 17:37:19 -04:00
parent 8871c930be
commit 568d6f9831

View File

@ -1403,7 +1403,7 @@ func Haspointers(t *Type) bool {
func Haspointers1(t *Type, ignoreNotInHeap bool) bool {
switch t.Etype {
case TINT, TUINT, TINT8, TUINT8, TINT16, TUINT16, TINT32, TUINT32, TINT64,
TUINT64, TUINTPTR, TFLOAT32, TFLOAT64, TCOMPLEX64, TCOMPLEX128, TBOOL:
TUINT64, TUINTPTR, TFLOAT32, TFLOAT64, TCOMPLEX64, TCOMPLEX128, TBOOL, TSSA:
return false
case TARRAY:
@ -1422,6 +1422,10 @@ func Haspointers1(t *Type, ignoreNotInHeap bool) bool {
case TPTR32, TPTR64, TSLICE:
return !(ignoreNotInHeap && t.Elem().NotInHeap())
case TTUPLE:
ttup := t.Extra.(*Tuple)
return Haspointers1(ttup.first, ignoreNotInHeap) || Haspointers1(ttup.second, ignoreNotInHeap)
}
return true
@ -1462,6 +1466,7 @@ func FakeRecvType() *Type {
}
var (
// TSSA types. Haspointers assumes these are pointer-free.
TypeInvalid = newSSA("invalid")
TypeMem = newSSA("mem")
TypeFlags = newSSA("flags")