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;