LEFT | RIGHT |
1 // Derived from Inferno utils/6c/txt.c | 1 // Derived from Inferno utils/6c/txt.c |
2 // http://code.google.com/p/inferno-os/source/browse/utils/6c/txt.c | 2 // http://code.google.com/p/inferno-os/source/browse/utils/6c/txt.c |
3 // | 3 // |
4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. | 4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. |
5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) | 5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) |
6 // Portions Copyright © 1997-1999 Vita Nuova Limited | 6 // Portions Copyright © 1997-1999 Vita Nuova Limited |
7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com) | 7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com) |
8 // Portions Copyright © 2004,2006 Bruce Ellis | 8 // Portions Copyright © 2004,2006 Bruce Ellis |
9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) | 9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) |
10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others | 10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 196 |
197 p = gins(AGLOBL, nam, N); | 197 p = gins(AGLOBL, nam, N); |
198 p->lineno = nam->lineno; | 198 p->lineno = nam->lineno; |
199 p->to.sym = S; | 199 p->to.sym = S; |
200 p->to.type = D_CONST; | 200 p->to.type = D_CONST; |
201 p->to.offset = width; | 201 p->to.offset = width; |
202 if(nam->readonly) | 202 if(nam->readonly) |
203 p->from.scale = RODATA; | 203 p->from.scale = RODATA; |
204 if(nam->type != T && !haspointers(nam->type)) | 204 if(nam->type != T && !haspointers(nam->type)) |
205 p->from.scale |= NOPTR; | 205 p->from.scale |= NOPTR; |
| 206 } |
| 207 |
| 208 void |
| 209 gtrack(Sym *s) |
| 210 { |
| 211 Prog *p; |
| 212 ········ |
| 213 p = gins(AUSEFIELD, N, N); |
| 214 p->from.type = D_EXTERN; |
| 215 p->from.index = D_NONE; |
| 216 p->from.sym = s; |
206 } | 217 } |
207 | 218 |
208 void | 219 void |
209 ggloblsym(Sym *s, int32 width, int dupok, int rodata) | 220 ggloblsym(Sym *s, int32 width, int dupok, int rodata) |
210 { | 221 { |
211 Prog *p; | 222 Prog *p; |
212 | 223 |
213 p = gins(AGLOBL, N, N); | 224 p = gins(AGLOBL, N, N); |
214 p->from.type = D_EXTERN; | 225 p->from.type = D_EXTERN; |
215 p->from.index = D_NONE; | 226 p->from.index = D_NONE; |
(...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1943 case ODOTPTR: | 1954 case ODOTPTR: |
1944 cleani += 2; | 1955 cleani += 2; |
1945 reg = &clean[cleani-1]; | 1956 reg = &clean[cleani-1]; |
1946 reg1 = &clean[cleani-2]; | 1957 reg1 = &clean[cleani-2]; |
1947 reg->op = OEMPTY; | 1958 reg->op = OEMPTY; |
1948 reg1->op = OEMPTY; | 1959 reg1->op = OEMPTY; |
1949 goto odot; | 1960 goto odot; |
1950 | 1961 |
1951 case OINDEX: | 1962 case OINDEX: |
1952 return 0; | 1963 return 0; |
| 1964 // disabled: OINDEX case is now covered by agenr |
| 1965 // for a more suitable register allocation pattern. |
1953 if(n->left->type->etype == TSTRING) | 1966 if(n->left->type->etype == TSTRING) |
1954 return 0; | 1967 return 0; |
1955 goto oindex; | 1968 goto oindex; |
1956 } | 1969 } |
1957 return 0; | 1970 return 0; |
1958 | 1971 |
1959 lit: | 1972 lit: |
1960 switch(as) { | 1973 switch(as) { |
1961 default: | 1974 default: |
1962 return 0; | 1975 return 0; |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2236 naddr(&n2, a, 1); | 2249 naddr(&n2, a, 1); |
2237 goto yes; | 2250 goto yes; |
2238 | 2251 |
2239 yes: | 2252 yes: |
2240 return 1; | 2253 return 1; |
2241 | 2254 |
2242 no: | 2255 no: |
2243 sudoclean(); | 2256 sudoclean(); |
2244 return 0; | 2257 return 0; |
2245 } | 2258 } |
LEFT | RIGHT |