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

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

Issue 9101048: code review 9101048: cmd/gc: inline copy in frontend to call memmove directly. (Closed)
Left Patch Set: Created 11 years, 10 months ago
Right Patch Set: diff -r c47375e68297 https://go.googlecode.com/hg/ Created 11 years, 6 months 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/6g/gsubr.c ('k') | src/cmd/8g/gsubr.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 // 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if(n->type->width < 0) 102 if(n->type->width < 0)
103 fatal("forgot to compute width for %T", n->type); 103 fatal("forgot to compute width for %T", n->type);
104 sgen(n, res, n->type->width); 104 sgen(n, res, n->type->width);
105 return; 105 return;
106 } 106 }
107 107
108 // update addressability for string, slice 108 // update addressability for string, slice
109 // can't do in walk because n->left->addable 109 // can't do in walk because n->left->addable
110 // changes if n->left is an escaping local variable. 110 // changes if n->left is an escaping local variable.
111 switch(n->op) { 111 switch(n->op) {
112 case OSPTR:
112 case OLEN: 113 case OLEN:
113 if(isslice(n->left->type) || istype(n->left->type, TSTRING)) 114 if(isslice(n->left->type) || istype(n->left->type, TSTRING))
114 n->addable = n->left->addable; 115 n->addable = n->left->addable;
115 break; 116 break;
116 case OCAP: 117 case OCAP:
117 if(isslice(n->left->type)) 118 if(isslice(n->left->type))
118 n->addable = n->left->addable; 119 n->addable = n->left->addable;
119 break; 120 break;
120 case OITAB: 121 case OITAB:
121 n->addable = n->left->addable; 122 n->addable = n->left->addable;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 case OIND: 278 case OIND:
278 case ONAME: // PHEAP or PPARAMREF var 279 case ONAME: // PHEAP or PPARAMREF var
279 igen(n, &n1, res); 280 igen(n, &n1, res);
280 gmove(&n1, res); 281 gmove(&n1, res);
281 regfree(&n1); 282 regfree(&n1);
282 break; 283 break;
283 284
284 case OITAB: 285 case OITAB:
285 igen(nl, &n1, res); 286 igen(nl, &n1, res);
286 n1.type = ptrto(types[TUINTPTR]); 287 n1.type = ptrto(types[TUINTPTR]);
288 gmove(&n1, res);
289 regfree(&n1);
290 break;
291
292 case OSPTR:
293 // pointer is the first word of string or slice.
294 if(isconst(nl, CTSTR)) {
295 regalloc(&n1, types[tptr], res);
296 p1 = gins(ALEAL, N, &n1);
297 datastring(nl->val.u.sval->s, nl->val.u.sval->len, &p1-> from);
298 gmove(&n1, res);
299 regfree(&n1);
300 break;
301 }
302 igen(nl, &n1, res);
303 n1.type = n->type;
287 gmove(&n1, res); 304 gmove(&n1, res);
288 regfree(&n1); 305 regfree(&n1);
289 break; 306 break;
290 307
291 case OLEN: 308 case OLEN:
292 if(istype(nl->type, TMAP) || istype(nl->type, TCHAN)) { 309 if(istype(nl->type, TMAP) || istype(nl->type, TCHAN)) {
293 // map has len in the first 32-bit word. 310 // map has len in the first 32-bit word.
294 // a zero pointer means zero length 311 // a zero pointer means zero length
295 tempname(&n1, types[tptr]); 312 tempname(&n1, types[tptr]);
296 cgen(nl, &n1); 313 cgen(nl, &n1);
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 regfree(&nodl); 1429 regfree(&nodl);
1413 return 0; 1430 return 0;
1414 1431
1415 yes: 1432 yes:
1416 if(freer) 1433 if(freer)
1417 regfree(&nodr); 1434 regfree(&nodr);
1418 if(freel) 1435 if(freel)
1419 regfree(&nodl); 1436 regfree(&nodl);
1420 return 1; 1437 return 1;
1421 } 1438 }
LEFTRIGHT

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