OLD | NEW |
1 // Derived from Inferno utils/5c/txt.c | 1 // Derived from Inferno utils/5c/txt.c |
2 // http://code.google.com/p/inferno-os/source/browse/utils/5c/txt.c | 2 // http://code.google.com/p/inferno-os/source/browse/utils/5c/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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 p->to.sym = nil; | 199 p->to.sym = nil; |
200 p->to.type = D_CONST; | 200 p->to.type = D_CONST; |
201 p->to.offset = nam->type->width; | 201 p->to.offset = nam->type->width; |
202 if(nam->readonly) | 202 if(nam->readonly) |
203 p->reg = RODATA; | 203 p->reg = RODATA; |
204 if(nam->type != T && !haspointers(nam->type)) | 204 if(nam->type != T && !haspointers(nam->type)) |
205 p->reg |= NOPTR; | 205 p->reg |= NOPTR; |
206 } | 206 } |
207 | 207 |
208 void | 208 void |
209 gargsize(int32 size) | |
210 { | |
211 Node n1, n2; | |
212 ········ | |
213 nodconst(&n1, types[TINT32], PCDATA_ArgSize); | |
214 nodconst(&n2, types[TINT32], size); | |
215 gins(APCDATA, &n1, &n2); | |
216 } | |
217 | |
218 void | |
219 ggloblsym(Sym *s, int32 width, int8 flags) | 209 ggloblsym(Sym *s, int32 width, int8 flags) |
220 { | 210 { |
221 Prog *p; | 211 Prog *p; |
222 | 212 |
223 p = gins(AGLOBL, N, N); | 213 p = gins(AGLOBL, N, N); |
224 p->from.type = D_OREG; | 214 p->from.type = D_OREG; |
225 p->from.name = D_EXTERN; | 215 p->from.name = D_EXTERN; |
226 p->from.sym = linksym(s); | 216 p->from.sym = linksym(s); |
227 p->to.type = D_CONST; | 217 p->to.type = D_CONST; |
228 p->to.name = D_NONE; | 218 p->to.name = D_NONE; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 goto out; | 354 goto out; |
365 } | 355 } |
366 for(i=REGALLOC_R0; i<=REGALLOC_RMAX; i++) | 356 for(i=REGALLOC_R0; i<=REGALLOC_RMAX; i++) |
367 if(reg[i] == 0) { | 357 if(reg[i] == 0) { |
368 regpc[i] = (uintptr)getcallerpc(&n); | 358 regpc[i] = (uintptr)getcallerpc(&n); |
369 goto out; | 359 goto out; |
370 } | 360 } |
371 print("registers allocated at\n"); | 361 print("registers allocated at\n"); |
372 for(i=REGALLOC_R0; i<=REGALLOC_RMAX; i++) | 362 for(i=REGALLOC_R0; i<=REGALLOC_RMAX; i++) |
373 print("%d %p\n", i, regpc[i]); | 363 print("%d %p\n", i, regpc[i]); |
374 » » yyerror("out of fixed registers"); | 364 » » fatal("out of fixed registers"); |
375 goto err; | 365 goto err; |
376 | 366 |
377 case TFLOAT32: | 367 case TFLOAT32: |
378 case TFLOAT64: | 368 case TFLOAT64: |
379 if(o != N && o->op == OREGISTER) { | 369 if(o != N && o->op == OREGISTER) { |
380 i = o->val.u.reg; | 370 i = o->val.u.reg; |
381 if(i >= REGALLOC_F0 && i <= REGALLOC_FMAX) | 371 if(i >= REGALLOC_F0 && i <= REGALLOC_FMAX) |
382 goto out; | 372 goto out; |
383 } | 373 } |
384 for(i=REGALLOC_F0; i<=REGALLOC_FMAX; i++) | 374 for(i=REGALLOC_F0; i<=REGALLOC_FMAX; i++) |
385 if(reg[i] == 0) | 375 if(reg[i] == 0) |
386 goto out; | 376 goto out; |
387 » » yyerror("out of floating point registers"); | 377 » » fatal("out of floating point registers"); |
388 goto err; | 378 goto err; |
389 | 379 |
390 case TCOMPLEX64: | 380 case TCOMPLEX64: |
391 case TCOMPLEX128: | 381 case TCOMPLEX128: |
392 tempname(n, t); | 382 tempname(n, t); |
393 return; | 383 return; |
394 } | 384 } |
395 yyerror("regalloc: unknown type %T", t); | 385 yyerror("regalloc: unknown type %T", t); |
396 | 386 |
397 err: | 387 err: |
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2083 naddr(&n2, a, 1); | 2073 naddr(&n2, a, 1); |
2084 goto yes; | 2074 goto yes; |
2085 | 2075 |
2086 yes: | 2076 yes: |
2087 return 1; | 2077 return 1; |
2088 | 2078 |
2089 no: | 2079 no: |
2090 sudoclean(); | 2080 sudoclean(); |
2091 return 0; | 2081 return 0; |
2092 } | 2082 } |
OLD | NEW |