diff options
author | Russ Cox <rsc@golang.org> | 2009-01-09 15:21:41 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-01-09 15:21:41 -0800 |
commit | 70f6ac6afc99213436eb96ff17858d3b6ff7e30b (patch) | |
tree | 0bb25d93f5296427df934e40a633a02468d7d7c4 /src/cmd/gc/subr.c | |
parent | bc23ce679061b8f41f551578181b9feeb24f5c0a (diff) | |
download | golang-70f6ac6afc99213436eb96ff17858d3b6ff7e30b.tar.gz |
clean up automatic indirect, delete some dead code.
R=ken
OCL=22454
CL=22457
Diffstat (limited to 'src/cmd/gc/subr.c')
-rw-r--r-- | src/cmd/gc/subr.c | 51 |
1 files changed, 5 insertions, 46 deletions
diff --git a/src/cmd/gc/subr.c b/src/cmd/gc/subr.c index 9152bfb1a..428e70551 100644 --- a/src/cmd/gc/subr.c +++ b/src/cmd/gc/subr.c @@ -301,7 +301,7 @@ algtype(Type *t) if(isptr[simtype[t->etype]]) a = APTR; // pointer else - if(t->etype == TARRAY && t->bound < 0) + if(isslice(t)) a = ASLICE; else if(t->etype == TSTRUCT) @@ -667,7 +667,6 @@ opnames[] = [OGT] = "GT", [OIF] = "IF", [OINDEX] = "INDEX", - [OINDEXPTR] = "INDEXPTR", [OIND] = "IND", [OKEY] = "KEY", [OLABEL] = "LABEL", @@ -831,7 +830,6 @@ etnames[] = [TDDD] = "DDD", [TFUNC] = "FUNC", [TARRAY] = "ARRAY", -// [TDARRAY] = "DARRAY", [TSTRUCT] = "STRUCT", [TCHAN] = "CHAN", [TMAP] = "MAP", @@ -1436,37 +1434,15 @@ istype(Type *t, int et) } int -isptrsarray(Type *t) +isfixedarray(Type *t) { - if(isptrto(t, TARRAY)) - if(t->type->bound >= 0) - return 1; - return 0; + return t != T && t->etype == TARRAY && t->bound >= 0; } int -isptrdarray(Type *t) +isslice(Type *t) { - if(isptrto(t, TARRAY)) - if(t->type->bound < 0) - return 1; - return 0; -} - -int -issarray(Type *t) -{ - if(t != T && t->etype == TARRAY && t->bound >= 0) - return 1; - return 0; -} - -int -isdarray(Type *t) -{ - if(t != T && t->etype == TARRAY && t->bound < 0) - return 1; - return 0; + return t != T && t->etype == TARRAY && t->bound < 0; } int @@ -1684,23 +1660,6 @@ bad: } int -bytearraysz(Type *t) -{ - if(t == T) - return -2; - if(isptr[t->etype]) { - t = t->type; - if(t == T) - return -2; - } - if(t->etype != TARRAY) - return -2; - if(!eqtype(t->type, types[TUINT8], 0)) - return -2; - return t->bound; // -1 is dyn, >=0 is fixed -} - -int eqtype(Type *t1, Type *t2, int d) { if(d >= 10) |