aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types/type.go
diff options
context:
space:
mode:
authorDavid Chase <drchase@google.com>2021-02-04 16:42:35 -0500
committerDavid Chase <drchase@google.com>2021-02-26 02:52:33 +0000
commite25040d16288563c89cead5e8da8d3b9c74ab655 (patch)
tree4e57425c9764cf01ac69447f06d1bb52f07d9e46 /src/cmd/compile/internal/types/type.go
parent9a555fc24c318bf1b07bdc07d5c02e372681e401 (diff)
downloadgo-e25040d16288563c89cead5e8da8d3b9c74ab655.tar.gz
go-e25040d16288563c89cead5e8da8d3b9c74ab655.zip
cmd/compile: change StaticCall to return a "Results"
StaticLECall (multiple value in +mem, multiple value result +mem) -> StaticCall (multiple ergister value in +mem, multiple register-sized-value result +mem) -> ARCH CallStatic (multiple ergister value in +mem, multiple register-sized-value result +mem) But the architecture-dependent stuff is indifferent to whether it is mem->mem or (mem)->(mem) until Prog generation. Deal with OpSelectN -> Prog in ssagen/ssa.go, others, as they appear. For #40724. Change-Id: I1d0436f6371054f1881862641d8e7e418e4a6a16 Reviewed-on: https://go-review.googlesource.com/c/go/+/293391 Trust: David Chase <drchase@google.com> Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types/type.go')
-rw-r--r--src/cmd/compile/internal/types/type.go23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/cmd/compile/internal/types/type.go b/src/cmd/compile/internal/types/type.go
index b6374e49a5..9fb6d68994 100644
--- a/src/cmd/compile/internal/types/type.go
+++ b/src/cmd/compile/internal/types/type.go
@@ -581,12 +581,19 @@ func NewTuple(t1, t2 *Type) *Type {
return t
}
-func NewResults(types []*Type) *Type {
+func newResults(types []*Type) *Type {
t := New(TRESULTS)
t.Extra.(*Results).Types = types
return t
}
+func NewResults(types []*Type) *Type {
+ if len(types) == 1 && types[0] == TypeMem {
+ return TypeResultMem
+ }
+ return newResults(types)
+}
+
func newSSA(name string) *Type {
t := New(TSSA)
t.Extra = name
@@ -1407,6 +1414,9 @@ func (t *Type) PtrTo() *Type {
}
func (t *Type) NumFields() int {
+ if t.kind == TRESULTS {
+ return len(t.Extra.(*Results).Types)
+ }
return t.Fields().Len()
}
func (t *Type) FieldType(i int) *Type {
@@ -1597,11 +1607,12 @@ func FakeRecvType() *Type {
var (
// TSSA types. HasPointers assumes these are pointer-free.
- TypeInvalid = newSSA("invalid")
- TypeMem = newSSA("mem")
- TypeFlags = newSSA("flags")
- TypeVoid = newSSA("void")
- TypeInt128 = newSSA("int128")
+ TypeInvalid = newSSA("invalid")
+ TypeMem = newSSA("mem")
+ TypeFlags = newSSA("flags")
+ TypeVoid = newSSA("void")
+ TypeInt128 = newSSA("int128")
+ TypeResultMem = newResults([]*Type{TypeMem})
)
// NewNamed returns a new named type for the given type name.