Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(51)

Delta Between Two Patch Sets: src/cmd/6g/cgen.c

Issue 63650044: code review 63650044: cmd/gc: handle variable initialization by block move in... (Closed)
Left Patch Set: Created 11 years, 1 month ago
Right Patch Set: diff -r b2c3a8de38cc https://code.google.com/p/go/ Created 11 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/cmd/5g/cgen.c ('k') | src/cmd/8g/cgen.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(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
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
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 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b