compilers: silence two incorrect warnings, refactor some portable code [rsc] --rw-rw-r-- M 1115807 glenda sys 6261 Mar 24 00:34 sys/src/cmd/2c/gc.h /n/sourcesdump/2006/0324/plan9/sys/src/cmd/2c/gc.h:188,193 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/2c/gc.h:188,194 EXTERN long argoff; EXTERN long breakpc; + EXTERN long nbreak; EXTERN Case* cases; EXTERN long continpc; EXTERN Prog* firstp; [rsc] --rw-rw-r-- M 1115807 glenda sys 13122 Mar 24 00:34 sys/src/cmd/2c/sgen.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/2c/sgen.c /n/sourcesdump/2006/0325/plan9/sys/src/cmd/2c/sgen.c] [rsc] --rw-rw-r-- M 1115807 glenda sys 19666 Mar 24 18:10 sys/src/cmd/5c/cgen.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/5c/cgen.c /n/sourcesdump/2006/0325/plan9/sys/src/cmd/5c/cgen.c] [rsc] --rw-rw-r-- M 1115807 glenda sys 6164 Mar 24 18:11 sys/src/cmd/5c/gc.h /n/sourcesdump/2006/0324/plan9/sys/src/cmd/5c/gc.h:62,67 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/5c/gc.h:62,68 long val; long label; char def; + char isv; }; #define C ((Case*)0) /n/sourcesdump/2006/0324/plan9/sys/src/cmd/5c/gc.h:134,139 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/5c/gc.h:135,141 }; EXTERN long breakpc; + EXTERN long nbreak; EXTERN Case* cases; EXTERN Node constnode; EXTERN Node fconstnode; /n/sourcesdump/2006/0324/plan9/sys/src/cmd/5c/gc.h:216,222 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/5c/gc.h:218,225 /* * cgen.c */ - void cgen(Node*, Node*, int); + void cgen(Node*, Node*); + void cgenrel(Node*, Node*, int); void reglcgen(Node*, Node*, Node*); void lcgen(Node*, Node*); void bcgen(Node*, int); /n/sourcesdump/2006/0324/plan9/sys/src/cmd/5c/gc.h:265,271 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/5c/gc.h:268,275 */ int swcmp(const void*, const void*); void doswit(Node*); - void swit1(C1*, int, long, Node*, Node*); + void swit1(C1*, int, long, Node*); + void swit2(C1*, int, long, Node*, Node*); void cas(void); void bitload(Node*, Node*, Node*, Node*, Node*); void bitstore(Node*, Node*, Node*, Node*, Node*); [rsc] --rw-rw-r-- M 1115807 glenda sys 3066 Mar 24 18:10 sys/src/cmd/5c/sgen.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/5c/sgen.c /n/sourcesdump/2006/0325/plan9/sys/src/cmd/5c/sgen.c] [rsc] --rw-rw-r-- M 1115807 glenda sys 6449 Mar 24 18:11 sys/src/cmd/8c/gc.h /n/sourcesdump/2006/0324/plan9/sys/src/cmd/8c/gc.h:64,69 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/8c/gc.h:64,70 long val; long label; char def; + char isv; }; #define C ((Case*)0) /n/sourcesdump/2006/0324/plan9/sys/src/cmd/8c/gc.h:131,136 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/8c/gc.h:132,138 }; EXTERN long breakpc; + EXTERN long nbreak; EXTERN Case* cases; EXTERN Node constnode; EXTERN Node fconstnode; [rsc] --rw-rw-r-- M 1115807 glenda sys 6517 Mar 24 18:10 sys/src/cmd/8c/sgen.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/8c/sgen.c /n/sourcesdump/2006/0325/plan9/sys/src/cmd/8c/sgen.c] [rsc] --rw-rw-r-- M 1115807 glenda sys 18279 Mar 24 18:10 sys/src/cmd/kc/cgen.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/kc/cgen.c:493,498 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/kc/cgen.c:493,500 } else gopcode(OADD, nodconst(v), Z, &nod); gopcode(OAS, &nod, Z, &nod2); + if(nn && l->op == ONAME) /* in x=++i, emit USED(i) */ + gins(ANOP, l, Z); regfree(&nod); if(l->addable < INDEXED) [rsc] --rw-rw-r-- M 1115807 glenda sys 5924 Mar 24 18:11 sys/src/cmd/kc/gc.h /n/sourcesdump/2006/0324/plan9/sys/src/cmd/kc/gc.h:57,62 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/kc/gc.h:57,63 long val; long label; char def; + char isv; }; #define C ((Case*)0) /n/sourcesdump/2006/0324/plan9/sys/src/cmd/kc/gc.h:128,133 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/kc/gc.h:129,135 }; EXTERN long breakpc; + EXTERN long nbreak; EXTERN Case* cases; EXTERN Node constnode; EXTERN Node fconstnode; /n/sourcesdump/2006/0324/plan9/sys/src/cmd/kc/gc.h:183,188 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/kc/gc.h:185,191 EXTERN long exregbits; EXTERN int change; + EXTERN int suppress; EXTERN Reg* firstr; EXTERN Reg* lastr; /n/sourcesdump/2006/0324/plan9/sys/src/cmd/kc/gc.h:204,210 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/kc/gc.h:207,213 void usedset(Node*, int); void noretval(int); void xcom(Node*); - void bcomplex(Node*); + int bcomplex(Node*, Node*); /* * cgen.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/kc/gc.h:255,261 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/kc/gc.h:258,265 */ int swcmp(const void*, const void*); void doswit(Node*); - void swit1(C1*, int, long, Node*, Node*); + void swit1(C1*, int, long, Node*); + void swit2(C1*, int, long, Node*, Node*); void cas(void); void bitload(Node*, Node*, Node*, Node*, Node*); void bitstore(Node*, Node*, Node*, Node*, Node*); [rsc] --rw-rw-r-- M 1115807 glenda sys 3319 Mar 24 18:11 sys/src/cmd/kc/sgen.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/kc/sgen.c /n/sourcesdump/2006/0325/plan9/sys/src/cmd/kc/sgen.c] [rsc] --rw-rw-r-- M 1115807 glenda sys 6064 Mar 24 00:34 sys/src/cmd/1c/gc.h /n/sourcesdump/2006/0324/plan9/sys/src/cmd/1c/gc.h:172,177 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/1c/gc.h:172,178 EXTERN long argoff; EXTERN long breakpc; + EXTERN long nbreak; EXTERN Case* cases; EXTERN long continpc; EXTERN Prog* firstp; [rsc] --rw-rw-r-- M 1115807 glenda sys 11237 Mar 24 00:34 sys/src/cmd/1c/sgen.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/1c/sgen.c /n/sourcesdump/2006/0325/plan9/sys/src/cmd/1c/sgen.c] [rsc] --rw-rw-r-- M 1115807 glenda sys 18359 Mar 24 18:11 sys/src/cmd/qc/cgen.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/qc/cgen.c:496,501 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/qc/cgen.c:496,503 } else gopcode(OADD, nodconst(v), Z, &nod); gopcode(OAS, &nod, Z, &nod2); + if(nn && l->op == ONAME) /* in x=++i, emit USED(i) */ + gins(ANOP, l, Z); regfree(&nod); if(l->addable < INDEXED) [rsc] --rw-rw-r-- M 1115807 glenda sys 6037 Mar 24 18:11 sys/src/cmd/qc/gc.h /n/sourcesdump/2006/0324/plan9/sys/src/cmd/qc/gc.h:60,65 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/qc/gc.h:60,66 long val; long label; char def; + char isv; }; #define C ((Case*)0) /n/sourcesdump/2006/0324/plan9/sys/src/cmd/qc/gc.h:133,138 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/qc/gc.h:134,140 }; EXTERN long breakpc; + EXTERN long nbreak; EXTERN Case* cases; EXTERN Node constnode; EXTERN Node fconstnode; /n/sourcesdump/2006/0324/plan9/sys/src/cmd/qc/gc.h:264,270 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/qc/gc.h:266,273 */ int swcmp(void*, void*); void doswit(Node*); - void swit1(C1*, int, long, Node*, Node*); + void swit1(C1*, int, long, Node*); + void swit2(C1*, int, long, Node*, Node*); void cas(void); void bitload(Node*, Node*, Node*, Node*, Node*); void bitstore(Node*, Node*, Node*, Node*, Node*); [rsc] --rw-rw-r-- M 1115807 glenda sys 3452 Mar 24 18:11 sys/src/cmd/qc/sgen.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/qc/sgen.c /n/sourcesdump/2006/0325/plan9/sys/src/cmd/qc/sgen.c] [rsc] --rw-rw-r-- M 1115807 glenda sys 20147 Mar 24 18:11 sys/src/cmd/vc/cgen.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/vc/cgen.c:497,502 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/vc/cgen.c:497,504 } else gopcode(OADD, nodconst(v), Z, &nod); gopcode(OAS, &nod, Z, &nod2); + if(nn && l->op == ONAME) /* in x=++i, emit USED(i) */ + gins(ANOP, l, Z); regfree(&nod); if(l->addable < INDEXED) [rsc] --rw-rw-r-- M 1115807 glenda sys 5814 Mar 24 18:11 sys/src/cmd/vc/gc.h /n/sourcesdump/2006/0324/plan9/sys/src/cmd/vc/gc.h:58,63 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/vc/gc.h:58,64 long val; long label; char def; + char isv; }; #define C ((Case*)0) /n/sourcesdump/2006/0324/plan9/sys/src/cmd/vc/gc.h:129,134 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/vc/gc.h:130,136 }; EXTERN long breakpc; + EXTERN long nbreak; EXTERN Case* cases; EXTERN Node constnode; EXTERN Node fconstnode; /n/sourcesdump/2006/0324/plan9/sys/src/cmd/vc/gc.h:184,189 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/vc/gc.h:186,192 EXTERN long exregbits; EXTERN int change; + EXTERN int suppress; EXTERN Reg* firstr; EXTERN Reg* lastr; /n/sourcesdump/2006/0324/plan9/sys/src/cmd/vc/gc.h:204,210 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/vc/gc.h:207,213 void gen(Node*); void noretval(int); void xcom(Node*); - void bcomplex(Node*); + int bcomplex(Node*, Node*); void usedset(Node*, int); /* /n/sourcesdump/2006/0324/plan9/sys/src/cmd/vc/gc.h:256,262 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/vc/gc.h:259,266 */ int swcmp(const void*, const void*); void doswit(Node*); - void swit1(C1*, int, long, Node*, Node*); + void swit1(C1*, int, long, Node*); + void swit2(C1*, int, long, Node*, Node*); void cas(void); void bitload(Node*, Node*, Node*, Node*, Node*); void bitstore(Node*, Node*, Node*, Node*, Node*); [rsc] --rw-rw-r-- M 1115807 glenda sys 3139 Mar 24 18:11 sys/src/cmd/vc/sgen.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/vc/sgen.c /n/sourcesdump/2006/0325/plan9/sys/src/cmd/vc/sgen.c] [rsc] --rw-rw-r-- M 1115807 glenda sys 17825 Mar 24 18:10 sys/src/cmd/7c/cgen.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/7c/cgen.c:497,502 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/7c/cgen.c:497,504 } else gopcode(OADD, nodconst(v), Z, &nod); gopcode(OAS, &nod, Z, &nod2); + if(nn && l->op == ONAME) /* in x=++i, emit USED(i) */ + gins(ANOP, l, Z); regfree(&nod); if(l->addable < INDEXED) [rsc] --rw-rw-r-- M 1115807 glenda sys 5925 Mar 24 18:11 sys/src/cmd/7c/gc.h /n/sourcesdump/2006/0324/plan9/sys/src/cmd/7c/gc.h:61,66 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/7c/gc.h:61,67 long val; long label; char def; + char isv; }; #define C ((Case*)0) /n/sourcesdump/2006/0324/plan9/sys/src/cmd/7c/gc.h:134,139 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/7c/gc.h:135,141 }; EXTERN long breakpc; + EXTERN long nbreak; EXTERN Case* cases; EXTERN Node constnode; EXTERN Node fconstnode; /n/sourcesdump/2006/0324/plan9/sys/src/cmd/7c/gc.h:175,201 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/7c/gc.h:177,204 #define CINF 1000 #define LOOP 3 - EXTERN Rgn region[NRGN]; - EXTERN Rgn* rgp; - EXTERN int nregion; - EXTERN int nvar; + EXTERN Rgn region[NRGN]; + EXTERN Rgn* rgp; + EXTERN int nregion; + EXTERN int nvar; - EXTERN Bits externs; - EXTERN Bits params; - EXTERN Bits consts; - EXTERN Bits addrs; - EXTERN Bits zbits; + EXTERN Bits externs; + EXTERN Bits params; + EXTERN Bits consts; + EXTERN Bits addrs; + EXTERN Bits zbits; - EXTERN long regbits; - EXTERN long exregbits; + EXTERN long regbits; + EXTERN long exregbits; - EXTERN int change; + EXTERN int change; + EXTERN int suppress; - EXTERN Reg* firstr; - EXTERN Reg* lastr; - EXTERN Reg zreg; - EXTERN Reg* freer; - EXTERN Var var[NVAR]; + EXTERN Reg* firstr; + EXTERN Reg* lastr; + EXTERN Reg zreg; + EXTERN Reg* freer; + EXTERN Var var[NVAR]; EXTERN long* idom; EXTERN Reg** rpo2r; EXTERN long maxnr; /n/sourcesdump/2006/0324/plan9/sys/src/cmd/7c/gc.h:211,217 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/7c/gc.h:214,220 void usedset(Node*, int); void noretval(int); void xcom(Node*); - void bcomplex(Node*); + int bcomplex(Node*, Node*); /* * cgen.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/7c/gc.h:264,270 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/7c/gc.h:267,274 */ int swcmp(void*, void*); void doswit(Node*); - void swit1(C1*, int, long, Node*, Node*); + void swit1(C1*, int, long, Node*); + void swit2(C1*, int, long, Node*, Node*); void cas(void); void bitload(Node*, Node*, Node*, Node*, Node*); void bitstore(Node*, Node*, Node*, Node*, Node*); [rsc] --rw-rw-r-- M 1115807 glenda sys 3294 Mar 24 18:10 sys/src/cmd/7c/sgen.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/7c/sgen.c /n/sourcesdump/2006/0325/plan9/sys/src/cmd/7c/sgen.c] [rsc] --rw-rw-r-- M 1115807 glenda sys 303 Mar 24 17:45 sys/src/cmd/2c/mkfile /n/sourcesdump/2006/0324/plan9/sys/src/cmd/2c/mkfile:26,28 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/2c/mkfile:26,32 cd ../cc mk install mk clean + + %.$O: ../cc/%.c + $CC $CFLAGS ../cc/$stem.c + [rsc] --rw-rw-r-- M 1115807 glenda sys 374 Mar 24 17:45 sys/src/cmd/5c/mkfile /n/sourcesdump/2006/0324/plan9/sys/src/cmd/5c/mkfile:7,12 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/5c/mkfile:7,14 list.$O\ mul.$O\ peep.$O\ + pgen.$O\ + pswt.$O\ reg.$O\ sgen.$O\ swt.$O\ /n/sourcesdump/2006/0324/plan9/sys/src/cmd/5c/mkfile:26,31 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/5c/mkfile:28,36 cd ../cc mk install mk clean + + %.$O: ../cc/%.c + $CC $CFLAGS ../cc/$stem.c t:V: $O.out $O.out -S t [rsc] --rw-rw-r-- M 1115807 glenda sys 388 Mar 24 17:45 sys/src/cmd/8c/mkfile /n/sourcesdump/2006/0324/plan9/sys/src/cmd/8c/mkfile:2,20 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/8c/mkfile:2,22 TARG=8c OFILES=\ + bound.$O\ cgen.$O\ + cgen64.$O\ + div.$O\ enam.$O\ list.$O\ + machcap.$O\ + mul.$O\ + peep.$O\ + pgen.$O\ + pswt.$O\ + reg.$O\ sgen.$O\ swt.$O\ txt.$O\ - reg.$O\ - peep.$O\ - machcap.$O\ - cgen64.$O\ - bound.$O\ - div.$O\ - mul.$O\ HFILES=\ gc.h\ /n/sourcesdump/2006/0324/plan9/sys/src/cmd/8c/mkfile:32,34 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/8c/mkfile:34,41 mk clean bound.$O: bound.h + + %.$O: ../cc/%.c + $CC $CFLAGS ../cc/$stem.c + + [rsc] --rw-rw-r-- M 1115807 glenda sys 374 Mar 24 17:45 sys/src/cmd/kc/mkfile /n/sourcesdump/2006/0324/plan9/sys/src/cmd/kc/mkfile:2,16 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/kc/mkfile:2,18 TARG=kc OFILES=\ - peep.$O\ - reg.$O\ cgen.$O\ enam.$O\ list.$O\ + mul.$O\ + peep.$O\ + pgen.$O\ + pswt.$O\ + reg.$O\ sgen.$O\ swt.$O\ txt.$O\ - mul.$O\ HFILES=\ gc.h\ /n/sourcesdump/2006/0324/plan9/sys/src/cmd/kc/mkfile:26,31 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/kc/mkfile:28,36 cd ../cc mk install mk clean + + %.$O: ../cc/%.c + $CC $CFLAGS ../cc/$stem.c t:V: $O.out $O.out -S t [rsc] --rw-rw-r-- M 1115807 glenda sys 309 Mar 24 17:45 sys/src/cmd/1c/mkfile /n/sourcesdump/2006/0324/plan9/sys/src/cmd/1c/mkfile:26,28 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/1c/mkfile:26,32 cd ../cc mk install mk clean + + %.$O: ../cc/%.c + $CC $CFLAGS ../cc/$stem.c + [rsc] --rw-rw-r-- M 1115807 glenda sys 402 Mar 24 17:45 sys/src/cmd/qc/mkfile /n/sourcesdump/2006/0324/plan9/sys/src/cmd/qc/mkfile:7,12 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/qc/mkfile:7,14 list.$O\ mul.$O\ peep.$O\ + pgen.$O\ + pswt.$O\ reg.$O\ sgen.$O\ swt.$O\ /n/sourcesdump/2006/0324/plan9/sys/src/cmd/qc/mkfile:26,31 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/qc/mkfile:28,36 cd ../cc mk install mk clean + + %.$O: ../cc/%.c + $CC $CFLAGS ../cc/$stem.c t:V: $O.out $O.out -S t [rsc] --rw-rw-r-- M 1115807 glenda sys 374 Mar 24 17:45 sys/src/cmd/vc/mkfile /n/sourcesdump/2006/0324/plan9/sys/src/cmd/vc/mkfile:5,16 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/vc/mkfile:5,18 cgen.$O\ enam.$O\ list.$O\ + mul.$O\ peep.$O\ + pgen.$O\ + pswt.$O\ reg.$O\ sgen.$O\ swt.$O\ txt.$O\ - mul.$O\ HFILES=\ gc.h\ /n/sourcesdump/2006/0324/plan9/sys/src/cmd/vc/mkfile:26,31 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/vc/mkfile:28,36 cd ../cc mk install mk clean + + %.$O: ../cc/%.c + $CC $CFLAGS ../cc/$stem.c t:V: $O.out $O.out -S t [rsc] --rw-rw-r-- M 1115807 glenda sys 387 Mar 24 17:45 sys/src/cmd/7c/mkfile /n/sourcesdump/2006/0324/plan9/sys/src/cmd/7c/mkfile:5,11 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/7c/mkfile:5,14 cgen.$O\ enam.$O\ list.$O\ + machcap.$O\ peep.$O\ + pgen.$O\ + pswt.$O\ reg.$O\ sgen.$O\ swt.$O\ /n/sourcesdump/2006/0324/plan9/sys/src/cmd/7c/mkfile:26,31 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/7c/mkfile:29,37 cd ../cc mk install mk clean + + %.$O: ../cc/%.c + $CC $CFLAGS ../cc/$stem.c t:V: $O.out $O.out -S t [rsc] --rw-rw-r-- M 1115807 glenda sys 19666 Mar 24 18:10 sys/src/cmd/5c/cgen.c [rsc] --rw-rw-r-- M 1115807 glenda sys 6164 Mar 24 18:11 sys/src/cmd/5c/gc.h [rsc] --rw-rw-r-- M 1115807 glenda sys 3066 Mar 24 18:10 sys/src/cmd/5c/sgen.c [rsc] --rw-rw-r-- M 1115807 glenda sys 12009 Mar 24 18:10 sys/src/cmd/5c/swt.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/5c/swt.c /n/sourcesdump/2006/0325/plan9/sys/src/cmd/5c/swt.c] [rsc] --rw-rw-r-- M 1115807 glenda sys 19013 Mar 24 18:10 sys/src/cmd/5c/txt.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/5c/txt.c:170,176 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/5c/txt.c:170,176 nod.left = *fnxp; nod.right = n; nod.type = n->type; - cgen(&nod, Z, 0); + cgen(&nod, Z); (*fnxp)++; } return; /n/sourcesdump/2006/0324/plan9/sys/src/cmd/5c/txt.c:187,204 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/5c/txt.c:187,204 if(REGARG >= 0 && curarg == 0 && typechlp[n->type->etype]) { regaalloc1(tn1, n); if(n->complex >= FNX) { - cgen(*fnxp, tn1, 0); + cgen(*fnxp, tn1); (*fnxp)++; } else - cgen(n, tn1, 0); + cgen(n, tn1); return; } regalloc(tn1, n, Z); if(n->complex >= FNX) { - cgen(*fnxp, tn1, 0); + cgen(*fnxp, tn1); (*fnxp)++; } else - cgen(n, tn1, 0); + cgen(n, tn1); regaalloc(tn2, n); gopcode(OAS, tn1, Z, tn2); regfree(tn1); [rsc] --rw-rw-r-- M 1115807 glenda sys 32123 Mar 24 18:10 sys/src/cmd/8c/cgen.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/8c/cgen.c:914,920 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/8c/cgen.c:914,920 regfree(&nod); } else gopcode(OFUNC, n->type, Z, l); - if(REGARG && reg[REGARG]) + if(REGARG>=0 && reg[REGARG]) reg[REGARG]--; if(nn != Z) { regret(&nod, n); [rsc] --rw-rw-r-- M 1115807 jmk sys 46068 Mar 24 18:10 sys/src/cmd/8c/cgen64.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/8c/cgen64.c:2681,2687 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/8c/cgen64.c:2681,2699 testv(Node *n, int true) { Type *t; - Node *nn, nod; + Node *nn, nod, *b; + + if(machcap(Z)) { + b = &nod; + b->op = true ? ONE : OEQ; + b->left = n; + b->right = new(0, Z, Z); + *b->right = *nodconst(0); + b->right->type = n->type; + b->type = types[TLONG]; + cgen64(b, Z); + return; + } switch(n->op) { case OINDREG: [rsc] --rw-rw-r-- M 1115807 glenda sys 6449 Mar 24 18:11 sys/src/cmd/8c/gc.h [rsc] --rw-rw-r-- M 1115807 glenda sys 11185 Mar 24 18:10 sys/src/cmd/8c/peep.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/8c/peep.c:671,677 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/8c/peep.c:671,677 return 3; case ACALL: /* funny */ - if(REGARG && v->type == REGARG) + if(REGARG>=0 && v->type == REGARG) return 2; if(s != A) { [rsc] --rw-rw-r-- M 1115807 glenda sys 6517 Mar 24 18:10 sys/src/cmd/8c/sgen.c [rsc] --rw-rw-r-- M 1115807 glenda sys 10003 Mar 24 18:10 sys/src/cmd/8c/swt.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/8c/swt.c:1,58 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/8c/swt.c:1,6 #include "gc.h" - int - swcmp(const void *a1, const void *a2) - { - C1 *p1, *p2; - - p1 = (C1*)a1; - p2 = (C1*)a2; - if(p1->val < p2->val) - return -1; - return p1->val > p2->val; - } - void - doswit(Node *n) - { - Case *c; - C1 *q, *iq; - long def, nc, i; - - def = 0; - nc = 0; - for(c = cases; c->link != C; c = c->link) { - if(c->def) { - if(def) - diag(n, "more than one default in switch"); - def = c->label; - continue; - } - nc++; - } - - iq = alloc(nc*sizeof(C1)); - q = iq; - for(c = cases; c->link != C; c = c->link) { - if(c->def) - continue; - q->label = c->label; - q->val = c->val; - q++; - } - qsort(iq, nc, sizeof(C1), swcmp); - if(debug['W']) - for(i=0; ival); patch(sp, pc); swit1(r+1, nc-i-1, def, n); - } - - void - cas(void) - { - Case *c; - - c = alloc(sizeof(*c)); - c->link = cases; - cases = c; } void [rsc] --rw-rw-r-- M 1115807 glenda sys 23848 Mar 24 18:10 sys/src/cmd/8c/txt.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/8c/txt.c:203,209 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/8c/txt.c:203,209 sugen(n, tn2, n->type->width); return; } - if(REGARG && curarg == 0 && typeilp[n->type->etype]) { + if(REGARG>=0 && curarg == 0 && typeilp[n->type->etype]) { regaalloc1(tn1, n); if(n->complex >= FNX) { cgen(*fnxp, tn1); /n/sourcesdump/2006/0324/plan9/sys/src/cmd/8c/txt.c:370,375 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/8c/txt.c:370,379 void regaalloc1(Node *n, Node *nn) { + if(REGARG < 0) { + diag(n, "regaalloc1"); + return; + } nodreg(n, nn, REGARG); reg[REGARG]++; curarg = align(curarg, nn->type, Aarg1); [rsc] --rw-rw-r-- M 1115807 glenda sys 18279 Mar 24 18:10 sys/src/cmd/kc/cgen.c [rsc] --rw-rw-r-- M 1115807 glenda sys 5924 Mar 24 18:11 sys/src/cmd/kc/gc.h [rsc] --rw-rw-r-- M 1115807 glenda sys 3319 Mar 24 18:11 sys/src/cmd/kc/sgen.c [rsc] --rw-rw-r-- M 1115807 glenda sys 11175 Mar 24 18:11 sys/src/cmd/kc/swt.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/kc/swt.c:1,59 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/kc/swt.c:1,17 #include "gc.h" - int - swcmp(const void *a1, const void *a2) - { - C1 *p1, *p2; - - p1 = (C1*)a1; - p2 = (C1*)a2; - if(p1->val < p2->val) - return -1; - return p1->val > p2->val; - } - void - doswit(Node *n) + swit1(C1 *q, int nc, long def, Node *n) { - Case *c; - C1 *q, *iq; - long def, nc, i; Node tn; - - def = 0; - nc = 0; - for(c = cases; c->link != C; c = c->link) { - if(c->def) { - if(def) - diag(n, "more than one default in switch"); - def = c->label; - continue; - } - nc++; - } - - iq = alloc(nc*sizeof(C1)); - q = iq; - for(c = cases; c->link != C; c = c->link) { - if(c->def) - continue; - q->label = c->label; - q->val = c->val; - q++; - } - qsort(iq, nc, sizeof(C1), swcmp); - if(def == 0) - def = breakpc; - for(i=0; ias = ABE; patch(p, r->label); - swit1(q, i, def, n, tn); + swit2(q, i, def, n, tn); patch(sp, pc); - swit1(r+1, nc-i-1, def, n, tn); - } - - void - cas(void) - { - Case *c; - - c = alloc(sizeof(*c)); - c->link = cases; - cases = c; + swit2(r+1, nc-i-1, def, n, tn); } void [rsc] --rw-rw-r-- M 1115807 glenda sys 18359 Mar 24 18:11 sys/src/cmd/qc/cgen.c [rsc] --rw-rw-r-- M 1115807 glenda sys 6037 Mar 24 18:11 sys/src/cmd/qc/gc.h [rsc] --rw-rw-r-- M 1115807 glenda sys 3452 Mar 24 18:11 sys/src/cmd/qc/sgen.c [rsc] --rw-rw-r-- M 1115807 glenda sys 11287 Mar 24 18:11 sys/src/cmd/qc/swt.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/qc/swt.c:1,59 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/qc/swt.c:1,17 #include "gc.h" - int - swcmp(void *a1, void *a2) - { - C1 *p1, *p2; - - p1 = a1; - p2 = a2; - if(p1->val < p2->val) - return -1; - return p1->val > p2->val; - } - void - doswit(Node *n) + swit1(C1 *q, int nc, long def, Node *n) { - Case *c; - C1 *q, *iq; - long def, nc, i; Node tn; - - def = 0; - nc = 0; - for(c = cases; c->link != C; c = c->link) { - if(c->def) { - if(def) - diag(n, "more than one default in switch"); - def = c->label; - continue; - } - nc++; - } - - iq = alloc(nc*sizeof(C1)); - q = iq; - for(c = cases; c->link != C; c = c->link) { - if(c->def) - continue; - q->label = c->label; - q->val = c->val; - q++; - } - qsort(iq, nc, sizeof(C1), swcmp); - if(def == 0) - def = breakpc; - for(i=0; ias = ABEQ; patch(p, r->label); - swit1(q, i, def, n, tn); + swit2(q, i, def, n, tn); patch(sp, pc); - swit1(r+1, nc-i-1, def, n, tn); - } - - void - cas(void) - { - Case *c; - - c = alloc(sizeof(*c)); - c->link = cases; - cases = c; + swit2(r+1, nc-i-1, def, n, tn); } void [rsc] --rw-rw-r-- M 1115807 glenda sys 20147 Mar 24 18:11 sys/src/cmd/vc/cgen.c [rsc] --rw-rw-r-- M 1115807 glenda sys 5814 Mar 24 18:11 sys/src/cmd/vc/gc.h [rsc] --rw-rw-r-- M 1115807 glenda sys 3139 Mar 24 18:11 sys/src/cmd/vc/sgen.c [rsc] --rw-rw-r-- M 1115807 glenda sys 11294 Mar 24 18:11 sys/src/cmd/vc/swt.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/vc/swt.c:1,62 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/vc/swt.c:1,17 #include "gc.h" - int - swcmp(const void *a1, const void *a2) - { - C1 *p1, *p2; - - p1 = (C1*)a1; - p2 = (C1*)a2; - if(p1->val < p2->val) - return -1; - return p1->val > p2->val; - } - void - doswit(Node *n) + swit1(C1 *q, int nc, long def, Node *n) { - Case *c; - C1 *q, *iq; - long def, nc, i; Node tn; - - def = 0; - nc = 0; - for(c = cases; c->link != C; c = c->link) { - if(c->def) { - if(def) - diag(n, "more than one default in switch"); - def = c->label; - continue; - } - nc++; - } - - iq = alloc(nc*sizeof(C1)); - q = iq; - for(c = cases; c->link != C; c = c->link) { - if(c->def) - continue; - q->label = c->label; - q->val = c->val; - q++; - } - qsort(iq, nc, sizeof(C1), swcmp); - if(debug['W']) - for(i=0; ilabel); - swit1(q, i, def, n, tn); + swit2(q, i, def, n, tn); if(debug['W']) print("case < %.8lux\n", r->val); patch(sp, pc); - swit1(r+1, nc-i-1, def, n, tn); - } - - void - cas(void) - { - Case *c; - - c = alloc(sizeof(*c)); - c->link = cases; - cases = c; + swit2(r+1, nc-i-1, def, n, tn); } void [rsc] --rw-rw-r-- M 1115807 glenda sys 17825 Mar 24 18:10 sys/src/cmd/7c/cgen.c [rsc] --rw-rw-r-- M 1115807 glenda sys 5925 Mar 24 18:11 sys/src/cmd/7c/gc.h [rsc] --rw-rw-r-- M 1115807 rsc sys 88 Mar 24 18:10 sys/src/cmd/7c/machcap.c [rsc] --rw-rw-r-- M 1115807 glenda sys 3294 Mar 24 18:10 sys/src/cmd/7c/sgen.c [rsc] --rw-rw-r-- M 1115807 glenda sys 10652 Mar 24 18:10 sys/src/cmd/7c/swt.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/7c/swt.c /n/sourcesdump/2006/0325/plan9/sys/src/cmd/7c/swt.c] [rsc] --rw-rw-r-- M 1115807 glenda sys 20240 Mar 24 18:10 sys/src/cmd/7c/txt.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/7c/txt.c:21,26 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/7c/txt.c:21,29 lastp = P; tfield = types[TLONG]; + typeword = typechlvp; + typecmplx = typesu; + zprog.link = P; zprog.as = AGOK; zprog.reg = NREG; compilers: emit code for C99 loop initializers [rsc] --rw-rw-r-- M 1115807 glenda sys 16160 Mar 24 12:19 sys/src/cmd/cc/cc.y /n/sourcesdump/2006/0324/plan9/sys/src/cmd/cc/cc.y:417,423 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/cc/cc.y:417,423 zcexpr | ctlist adlist { - $$ = Z; + $$ = $2; } ulstmnt: [rsc] --rw-rw-r-- M 1115807 glenda sys 12170 Mar 24 17:45 sys/src/cmd/cc/cc.h /n/sourcesdump/2006/0324/plan9/sys/src/cmd/cc/cc.h:503,508 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/cc/cc.h:503,511 extern char typechlp[]; extern char typechlpfd[]; + EXTERN char* typeword; + EXTERN char* typecmplx; + extern ulong thash1; extern ulong thash2; extern ulong thash3; [rsc] --rw-rw-r-- M 1115807 glenda sys 10001 Mar 24 17:45 sys/src/cmd/cc/com64.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/cc/com64.c:551,556 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/cc/com64.c:551,558 { Node *n1; + if(machcap(Z)) + return; if(typev[n->type->etype]) { n1 = new(OXXX, 0, 0); *n1 = *n; [rsc] --rw-rw-r-- M 1115807 glenda sys 564 Mar 24 17:45 sys/src/cmd/cc/mkfile /n/sourcesdump/2006/0324/plan9/sys/src/cmd/cc/mkfile:16,22 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/cc/mkfile:16,22 com64.$O\ compat.$O\ dpchk.$O\ - machcap.$O\ + omachcap.$O\ HFILES=cc.h\ y.tab.h\ [rsc] --rw-rw-r-- M 1115807 rsc sys 6826 Mar 24 17:45 sys/src/cmd/cc/pgen.c [rsc] --rw-rw-r-- M 1115807 rsc sys 989 Mar 24 17:45 sys/src/cmd/cc/pswt.c [rsc] --rw-rw-r-- M 1115807 glenda sys 34164 Mar 24 17:45 sys/src/cmd/cc/sub.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/cc/sub.c /n/sourcesdump/2006/0325/plan9/sys/src/cmd/cc/sub.c] [rsc] --rw-rw-r-- M 1115807 rsc sys 78 Mar 24 18:10 sys/src/cmd/cc/omachcap.c gif: avoid stack underflow [rsc] --rw-rw-r-- M 1115807 glenda sys 10472 Mar 24 12:22 sys/src/cmd/jpg/readgif.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/jpg/readgif.c:451,457 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/jpg/readgif.c:451,457 fprint(2, "ReadGIF: GIF invalid, code out of range, %x > %x\n", code, nentry); code = nentry; } - for(c=code; c>=0; c=tbl[c].prefix) + for(c=code; stacki>0 && c>=0; c=tbl[c].prefix) stack[stacki--] = tbl[c].exten; nb = (sizeof stack)-(stacki+1); tcs: new html character codes, print verbose listing with usage [rsc] --rw-rw-r-- M 1115807 rsc sys 7318 Mar 24 12:23 sys/src/cmd/tcs/html.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/tcs/html.c /n/sourcesdump/2006/0325/plan9/sys/src/cmd/tcs/html.c] [rsc] --rw-rw-r-- M 1115807 glenda sys 15545 Mar 24 12:19 sys/src/cmd/tcs/tcs.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/tcs/tcs.c:119,124 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/tcs/tcs.c:119,125 usage(void) { EPR "Usage: %s [-slv] [-f cs] [-t cs] [file ...]\n", argv0); + verbose = 1; list(); EXIT(1, "usage"); } /n/sourcesdump/2006/0324/plan9/sys/src/cmd/tcs/tcs.c:426,438 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/tcs/tcs.c:427,439 { "ebcdic", "EBCDIC", Table, (void *)tabebcdic }, /* 6f is recommended bad map */ { "euc-k", "Korean EUC: ASCII+KS C 5601 1987", From|Func, 0, (Fnptr)uksc_in }, { "euc-k", "Korean EUC: ASCII+KS C 5601 1987", Func, 0, (Fnptr)uksc_out }, - { "gb", "GB2312-80", From|Func, 0, (Fnptr)gb_in }, - { "gb", "GB2312-80", Func, 0, (Fnptr)gb_out }, + { "gb", "GB2312-80 (Chinese)", From|Func, 0, (Fnptr)gb_in }, + { "gb", "GB2312-80 (Chinese)", Func, 0, (Fnptr)gb_out }, { "html", "HTML", From|Func, 0, (Fnptr)html_in }, { "html", "HTML", Func, 0, (Fnptr)html_out }, { "jis", "guesses at the JIS encoding", From|Func, 0, (Fnptr)jis_in }, - { "jis-kanji", "ISO 2022-JP", From|Func, 0, (Fnptr)jisjis_in }, - { "jis-kanji", "ISO 2022-JP", Func, 0, (Fnptr)jisjis_out }, + { "jis-kanji", "ISO 2022-JP (Japanese)", From|Func, 0, (Fnptr)jisjis_in }, + { "jis-kanji", "ISO 2022-JP (Japanese)", Func, 0, (Fnptr)jisjis_out }, { "koi8", "KOI-8 (GOST 19769-74)", Table, (void *)tabkoi8 }, { "latin1", "ISO 8859-1", Table, (void *)tab8859_1 }, { "macrom", "Macintosh Standard Roman character set", Table, (void *)tabmacroman }, libhtml: new HTML character codes [rsc] --rw-rw-r-- M 1115807 glenda sys 28128 Mar 24 12:19 sys/src/libhtml/lex.c [diffs elided - too long] [diff -c /n/sourcesdump/2006/0324/plan9/sys/src/libhtml/lex.c /n/sourcesdump/2006/0325/plan9/sys/src/libhtml/lex.c] remove unnecessary return statements [rsc] --rw-rw-r-- M 1115807 glenda sys 4333 Mar 24 13:01 sys/src/cmd/acid/proc.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/acid/proc.c:276,280 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/acid/proc.c:276,279 return w; free(w); } - return nil; /* ken */ } [rsc] --rw-rw-r-- M 1115807 glenda sys 14428 Mar 24 13:06 sys/src/cmd/vt/main.c /n/sourcesdump/2006/0324/plan9/sys/src/cmd/vt/main.c:519,525 - /n/sourcesdump/2006/0325/plan9/sys/src/cmd/vt/main.c:519,524 } while(newmouse == 1); cursoff(); /* turn cursor back off */ } - return 1; /* to shut up compiler */ } void