LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include <u.h> | 5 #include <u.h> |
6 #include <libc.h> | 6 #include <libc.h> |
7 #include "gg.h" | 7 #include "gg.h" |
8 | 8 |
9 /* | 9 /* |
10 * generate: | 10 * generate: |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1330 | 1330 |
1331 /* | 1331 /* |
1332 * block copy: | 1332 * block copy: |
1333 * memmove(&ns, &n, w); | 1333 * memmove(&ns, &n, w); |
1334 */ | 1334 */ |
1335 void | 1335 void |
1336 sgen(Node *n, Node *ns, int64 w) | 1336 sgen(Node *n, Node *ns, int64 w) |
1337 { | 1337 { |
1338 Node nodl, nodr, nodsi, noddi, cx, oldcx, tmp; | 1338 Node nodl, nodr, nodsi, noddi, cx, oldcx, tmp; |
1339 vlong c, q, odst, osrc; | 1339 vlong c, q, odst, osrc; |
| 1340 NodeList *l; |
1340 | 1341 |
1341 if(debug['g']) { | 1342 if(debug['g']) { |
1342 print("\nsgen w=%lld\n", w); | 1343 print("\nsgen w=%lld\n", w); |
1343 dump("r", n); | 1344 dump("r", n); |
1344 dump("res", ns); | 1345 dump("res", ns); |
1345 } | 1346 } |
1346 | 1347 |
1347 if(n->ullman >= UINF && ns->ullman >= UINF) | 1348 if(n->ullman >= UINF && ns->ullman >= UINF) |
1348 fatal("sgen UINF"); | 1349 fatal("sgen UINF"); |
1349 | 1350 |
1350 if(w < 0) | 1351 if(w < 0) |
1351 fatal("sgen copy %lld", w); | 1352 fatal("sgen copy %lld", w); |
| 1353 ········ |
| 1354 // Record site of definition of ns for liveness analysis. |
| 1355 if(ns->op == ONAME && ns->class != PEXTERN) |
| 1356 gvardef(ns); |
| 1357 ········ |
| 1358 // If copying .args, that's all the results, so record definition sites |
| 1359 // for them for the liveness analysis. |
| 1360 if(ns->op == ONAME && strcmp(ns->sym->name, ".args") == 0) |
| 1361 for(l = curfn->dcl; l != nil; l = l->next) |
| 1362 if(l->n->class == PPARAMOUT) |
| 1363 gvardef(l->n); |
1352 | 1364 |
1353 // Avoid taking the address for simple enough types. | 1365 // Avoid taking the address for simple enough types. |
1354 if(componentgen(n, ns)) | 1366 if(componentgen(n, ns)) |
1355 return; | 1367 return; |
1356 ········ | 1368 ········ |
1357 if(w == 0) { | 1369 if(w == 0) { |
1358 // evaluate side effects only | 1370 // evaluate side effects only |
1359 regalloc(&nodr, types[tptr], N); | 1371 regalloc(&nodr, types[tptr], N); |
1360 agen(ns, &nodr); | 1372 agen(ns, &nodr); |
1361 agen(n, &nodr); | 1373 agen(n, &nodr); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1686 regfree(&nodl); | 1698 regfree(&nodl); |
1687 return 0; | 1699 return 0; |
1688 | 1700 |
1689 yes: | 1701 yes: |
1690 if(freer) | 1702 if(freer) |
1691 regfree(&nodr); | 1703 regfree(&nodr); |
1692 if(freel) | 1704 if(freel) |
1693 regfree(&nodl); | 1705 regfree(&nodl); |
1694 return 1; | 1706 return 1; |
1695 } | 1707 } |
LEFT | RIGHT |