mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.regabi] cmd/compile: first pass at abstracting Type
Passes toolstash/buildall.
[git-generate]
cd src/cmd/compile/internal/ssa
rf '
ex . ../ir ../gc {
import "cmd/compile/internal/types"
var t *types.Type
t.Etype -> t.Kind()
t.Sym -> t.GetSym()
t.Orig -> t.Underlying()
}
'
cd ../types
rf '
mv EType Kind
mv IRNode Object
mv Type.Etype Type.kind
mv Type.Sym Type.sym
mv Type.Orig Type.underlying
mv Type.Cache Type.cache
mv Type.GetSym Type.Sym
mv Bytetype ByteType
mv Runetype RuneType
mv Errortype ErrorType
'
cd ../gc
sed -i 's/Bytetype/ByteType/; s/Runetype/RuneType/' mkbuiltin.go
git codereview gofmt
go install cmd/compile/internal/...
go test cmd/compile -u || go test cmd/compile
Change-Id: Ibecb2d7100d3318a49238eb4a78d70acb49eedca
Reviewed-on: https://go-review.googlesource.com/c/go/+/274437
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
Trust: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
6ca23a45fe
commit
5ffa275f3c
36 changed files with 398 additions and 398 deletions
|
|
@ -68,7 +68,7 @@ func IncomparableField(t *types.Type) *types.Field {
|
|||
// EqCanPanic reports whether == on type t could panic (has an interface somewhere).
|
||||
// t must be comparable.
|
||||
func EqCanPanic(t *types.Type) bool {
|
||||
switch t.Etype {
|
||||
switch t.Kind() {
|
||||
default:
|
||||
return false
|
||||
case types.TINTER:
|
||||
|
|
@ -120,7 +120,7 @@ func algtype1(t *types.Type) (AlgKind, *types.Type) {
|
|||
return ANOEQ, t
|
||||
}
|
||||
|
||||
switch t.Etype {
|
||||
switch t.Kind() {
|
||||
case types.TANY, types.TFORW:
|
||||
// will be defined later.
|
||||
return ANOEQ, t
|
||||
|
|
@ -274,7 +274,7 @@ func genhash(t *types.Type) *obj.LSym {
|
|||
// (And the closure generated by genhash will also get
|
||||
// dead-code eliminated, as we call the subtype hashers
|
||||
// directly.)
|
||||
switch t.Etype {
|
||||
switch t.Kind() {
|
||||
case types.TARRAY:
|
||||
genhash(t.Elem())
|
||||
case types.TSTRUCT:
|
||||
|
|
@ -303,7 +303,7 @@ func genhash(t *types.Type) *obj.LSym {
|
|||
np := ir.AsNode(tfn.Type().Params().Field(0).Nname)
|
||||
nh := ir.AsNode(tfn.Type().Params().Field(1).Nname)
|
||||
|
||||
switch t.Etype {
|
||||
switch t.Kind() {
|
||||
case types.TARRAY:
|
||||
// An array of pure memory would be handled by the
|
||||
// standard algorithm, so the element type must not be
|
||||
|
|
@ -536,7 +536,7 @@ func geneq(t *types.Type) *obj.LSym {
|
|||
// We reach here only for types that have equality but
|
||||
// cannot be handled by the standard algorithms,
|
||||
// so t must be either an array or a struct.
|
||||
switch t.Etype {
|
||||
switch t.Kind() {
|
||||
default:
|
||||
base.Fatalf("geneq %v", t)
|
||||
|
||||
|
|
@ -613,7 +613,7 @@ func geneq(t *types.Type) *obj.LSym {
|
|||
}
|
||||
}
|
||||
|
||||
switch t.Elem().Etype {
|
||||
switch t.Elem().Kind() {
|
||||
case types.TSTRING:
|
||||
// Do two loops. First, check that all the lengths match (cheap).
|
||||
// Second, check that all the contents match (expensive).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue