Commit 568d6f98 authored by Austin Clements's avatar Austin Clements

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: 's avatarDavid Chase <drchase@google.com>
parent 8871c930
...@@ -1403,7 +1403,7 @@ func Haspointers(t *Type) bool { ...@@ -1403,7 +1403,7 @@ func Haspointers(t *Type) bool {
func Haspointers1(t *Type, ignoreNotInHeap bool) bool { func Haspointers1(t *Type, ignoreNotInHeap bool) bool {
switch t.Etype { switch t.Etype {
case TINT, TUINT, TINT8, TUINT8, TINT16, TUINT16, TINT32, TUINT32, TINT64, 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 return false
case TARRAY: case TARRAY:
...@@ -1422,6 +1422,10 @@ func Haspointers1(t *Type, ignoreNotInHeap bool) bool { ...@@ -1422,6 +1422,10 @@ func Haspointers1(t *Type, ignoreNotInHeap bool) bool {
case TPTR32, TPTR64, TSLICE: case TPTR32, TPTR64, TSLICE:
return !(ignoreNotInHeap && t.Elem().NotInHeap()) return !(ignoreNotInHeap && t.Elem().NotInHeap())
case TTUPLE:
ttup := t.Extra.(*Tuple)
return Haspointers1(ttup.first, ignoreNotInHeap) || Haspointers1(ttup.second, ignoreNotInHeap)
} }
return true return true
...@@ -1462,6 +1466,7 @@ func FakeRecvType() *Type { ...@@ -1462,6 +1466,7 @@ func FakeRecvType() *Type {
} }
var ( var (
// TSSA types. Haspointers assumes these are pointer-free.
TypeInvalid = newSSA("invalid") TypeInvalid = newSSA("invalid")
TypeMem = newSSA("mem") TypeMem = newSSA("mem")
TypeFlags = newSSA("flags") TypeFlags = newSSA("flags")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment