]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: teach Haspointer about TSSA and TTUPLE
authorAustin Clements <austin@google.com>
Mon, 2 Oct 2017 21:37:19 +0000 (17:37 -0400)
committerAustin Clements <austin@google.com>
Fri, 20 Apr 2018 19:10:00 +0000 (19:10 +0000)
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>
src/cmd/compile/internal/types/type.go

index 55d0930ceb5566e0acbcaab27dcb14fe8da18cdf..836ac4965f4d92ce64449066594447464b6d6fe1 100644 (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")