LEFT | RIGHT |
(no file at all) | |
1 // Inferno utils/5c/txt.c | 1 // 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 void | 267 void |
268 nodreg(Node *n, Node *nn, int reg) | 268 nodreg(Node *n, Node *nn, int reg) |
269 { | 269 { |
270 *n = regnode; | 270 *n = regnode; |
271 n->reg = reg; | 271 n->reg = reg; |
272 n->type = nn->type; | 272 n->type = nn->type; |
273 n->lineno = nn->lineno; | 273 n->lineno = nn->lineno; |
274 } | 274 } |
275 | 275 |
276 void | 276 void |
277 regret(Node *n, Node *nn) | 277 regret(Node *n, Node *nn, Type *t, int mode) |
278 { | 278 { |
279 int r; | 279 int r; |
280 | 280 |
281 » r = REGRET; | 281 » if(mode == 0 || hasdotdotdot(t) || nn->type->width == 0) { |
282 » if(typefd[nn->type->etype]) | 282 » » r = REGRET; |
283 » » r = FREGRET+NREG; | 283 » » if(typefd[nn->type->etype]) |
284 » nodreg(n, nn, r); | 284 » » » r = FREGRET+NREG; |
285 » reg[r]++; | 285 » » nodreg(n, nn, r); |
| 286 » » reg[r]++; |
| 287 » » return; |
| 288 » } |
| 289 »······· |
| 290 » if(mode == 1) { |
| 291 » » // fetch returned value after call. |
| 292 » » // already called gargs, so curarg is set. |
| 293 » » curarg = (curarg+3) & ~3; |
| 294 » » regaalloc(n, nn); |
| 295 » » return; |
| 296 » } |
| 297 »······· |
| 298 » if(mode == 2) { |
| 299 » » // store value to be returned. |
| 300 » » // must compute arg offset. |
| 301 » » if(t->etype != TFUNC) |
| 302 » » » fatal(Z, "bad regret func %T", t); |
| 303 » » *n = *nn; |
| 304 » » n->op = ONAME; |
| 305 » » n->class = CPARAM; |
| 306 » » n->sym = slookup(".ret"); |
| 307 » » n->complex = nodret->complex; |
| 308 » » n->xoffset = argsize(0); |
| 309 » » n->addable = 20; |
| 310 » » return; |
| 311 » } |
| 312 »······· |
| 313 » fatal(Z, "bad regret"); |
286 } | 314 } |
287 | 315 |
288 int | 316 int |
289 tmpreg(void) | 317 tmpreg(void) |
290 { | 318 { |
291 int i; | 319 int i; |
292 | 320 |
293 for(i=REGRET+1; i<NREG; i++) | 321 for(i=REGRET+1; i<NREG; i++) |
294 if(reg[i] == 0) | 322 if(reg[i] == 0) |
295 return i; | 323 return i; |
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1324 BFLOAT, /* [TFLOAT] */ | 1352 BFLOAT, /* [TFLOAT] */ |
1325 BDOUBLE, /* [TDOUBLE] */ | 1353 BDOUBLE, /* [TDOUBLE] */ |
1326 BLONG|BULONG|BIND, /* [TIND] */ | 1354 BLONG|BULONG|BIND, /* [TIND] */ |
1327 0, /* [TFUNC] */ | 1355 0, /* [TFUNC] */ |
1328 0, /* [TARRAY] */ | 1356 0, /* [TARRAY] */ |
1329 0, /* [TVOID] */ | 1357 0, /* [TVOID] */ |
1330 BSTRUCT, /* [TSTRUCT] */ | 1358 BSTRUCT, /* [TSTRUCT] */ |
1331 BUNION, /* [TUNION] */ | 1359 BUNION, /* [TUNION] */ |
1332 0, /* [TENUM] */ | 1360 0, /* [TENUM] */ |
1333 }; | 1361 }; |
LEFT | RIGHT |