cmd/compile: eliminate arch-specific typedefs

Arch backends already provide us Widthint and Widthptr, which is ample
information to figure out how to define the universal "int", "uint",
and "uintptr" types.  No need for providing a generic typedef
mechanism beyond that.

Change-Id: I35c0c17a67c80605a9208b93d77d6960b2cbb17d
Reviewed-on: https://go-review.googlesource.com/20153
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Matthew Dempsky 2016-03-02 18:03:50 -08:00
parent 0024101b2d
commit a40b27e304
9 changed files with 35 additions and 115 deletions

View file

@ -618,39 +618,6 @@ func typeinit() {
Simtype[TFUNC] = Tptr
Simtype[TUNSAFEPTR] = Tptr
// pick up the backend thearch.typedefs
for i = range Thearch.Typedefs {
s := Lookup(Thearch.Typedefs[i].Name)
s1 := Pkglookup(Thearch.Typedefs[i].Name, builtinpkg)
etype := Thearch.Typedefs[i].Etype
if int(etype) >= len(Types) {
Fatalf("typeinit: %s bad etype", s.Name)
}
sameas := Thearch.Typedefs[i].Sameas
if int(sameas) >= len(Types) {
Fatalf("typeinit: %s bad sameas", s.Name)
}
Simtype[etype] = sameas
minfltval[etype] = minfltval[sameas]
maxfltval[etype] = maxfltval[sameas]
Minintval[etype] = Minintval[sameas]
Maxintval[etype] = Maxintval[sameas]
t = Types[etype]
if t != nil {
Fatalf("typeinit: %s already defined", s.Name)
}
t = typ(etype)
t.Sym = s1
dowidth(t)
Types[etype] = t
s1.Def = typenod(t)
s1.Def.Name = new(Name)
}
Array_array = int(Rnd(0, int64(Widthptr)))
Array_nel = int(Rnd(int64(Array_array)+int64(Widthptr), int64(Widthint)))
Array_cap = int(Rnd(int64(Array_nel)+int64(Widthint), int64(Widthint)))