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 // TODO(rsc): | 5 // TODO(rsc): |
6 // assume CLD? | 6 // assume CLD? |
7 | 7 |
8 #include <u.h> | 8 #include <u.h> |
9 #include <libc.h> | 9 #include <libc.h> |
10 #include "gg.h" | 10 #include "gg.h" |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 | 1196 |
1197 /* | 1197 /* |
1198 * struct gen | 1198 * struct gen |
1199 * memmove(&res, &n, w); | 1199 * memmove(&res, &n, w); |
1200 */ | 1200 */ |
1201 void | 1201 void |
1202 sgen(Node *n, Node *res, int64 w) | 1202 sgen(Node *n, Node *res, int64 w) |
1203 { | 1203 { |
1204 Node dst, src, tdst, tsrc; | 1204 Node dst, src, tdst, tsrc; |
1205 int32 c, q, odst, osrc; | 1205 int32 c, q, odst, osrc; |
| 1206 NodeList *l; |
1206 | 1207 |
1207 if(debug['g']) { | 1208 if(debug['g']) { |
1208 print("\nsgen w=%lld\n", w); | 1209 print("\nsgen w=%lld\n", w); |
1209 dump("r", n); | 1210 dump("r", n); |
1210 dump("res", res); | 1211 dump("res", res); |
1211 } | 1212 } |
1212 if(n->ullman >= UINF && res->ullman >= UINF) | 1213 if(n->ullman >= UINF && res->ullman >= UINF) |
1213 fatal("sgen UINF"); | 1214 fatal("sgen UINF"); |
1214 | 1215 |
1215 if(w < 0 || (int32)w != w) | 1216 if(w < 0 || (int32)w != w) |
1216 fatal("sgen copy %lld", w); | 1217 fatal("sgen copy %lld", w); |
1217 | 1218 |
1218 if(w == 0) { | 1219 if(w == 0) { |
1219 // evaluate side effects only. | 1220 // evaluate side effects only. |
1220 tempname(&tdst, types[tptr]); | 1221 tempname(&tdst, types[tptr]); |
1221 agen(res, &tdst); | 1222 agen(res, &tdst); |
1222 agen(n, &tdst); | 1223 agen(n, &tdst); |
1223 return; | 1224 return; |
1224 } | 1225 } |
| 1226 |
| 1227 // Record site of definition of ns for liveness analysis. |
| 1228 if(res->op == ONAME && res->class != PEXTERN) |
| 1229 gvardef(res); |
| 1230 ········ |
| 1231 // If copying .args, that's all the results, so record definition sites |
| 1232 // for them for the liveness analysis. |
| 1233 if(res->op == ONAME && strcmp(res->sym->name, ".args") == 0) |
| 1234 for(l = curfn->dcl; l != nil; l = l->next) |
| 1235 if(l->n->class == PPARAMOUT) |
| 1236 gvardef(l->n); |
1225 | 1237 |
1226 // Avoid taking the address for simple enough types. | 1238 // Avoid taking the address for simple enough types. |
1227 if(componentgen(n, res)) | 1239 if(componentgen(n, res)) |
1228 return; | 1240 return; |
1229 | 1241 |
1230 // offset on the stack | 1242 // offset on the stack |
1231 osrc = stkof(n); | 1243 osrc = stkof(n); |
1232 odst = stkof(res); | 1244 odst = stkof(res); |
1233 ········ | 1245 ········ |
1234 if(osrc != -1000 && odst != -1000 && (osrc == 1000 || odst == 1000)) { | 1246 if(osrc != -1000 && odst != -1000 && (osrc == 1000 || odst == 1000)) { |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 regfree(&nodl); | 1469 regfree(&nodl); |
1458 return 0; | 1470 return 0; |
1459 | 1471 |
1460 yes: | 1472 yes: |
1461 if(freer) | 1473 if(freer) |
1462 regfree(&nodr); | 1474 regfree(&nodr); |
1463 if(freel) | 1475 if(freel) |
1464 regfree(&nodl); | 1476 regfree(&nodl); |
1465 return 1; | 1477 return 1; |
1466 } | 1478 } |
LEFT | RIGHT |