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

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

Issue 160200044: [dev.power64] code review 160200044: build: merge default into dev.power64 (Closed)
Left Patch Set: diff -r be0c14f62257b42485019e9e1db23cf40d2e249f https://code.google.com/p/go Created 10 years, 4 months ago
Right Patch Set: diff -r be0c14f62257b42485019e9e1db23cf40d2e249f https://code.google.com/p/go Created 10 years, 4 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/8l/asm.c ('k') | src/cmd/9c/gc.h » ('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 // cmd/9c/cgen.c from Vita Nuova. 1 // cmd/9c/cgen.c from Vita Nuova.
2 // 2 //
3 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. 3 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
4 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) 4 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
5 // Portions Copyright © 1997-1999 Vita Nuova Limited 5 // Portions Copyright © 1997-1999 Vita Nuova Limited
6 // Portions Copyright © 2000-2008 Vita Nuova Holdings Limited (www.vitanuov a.com) 6 // Portions Copyright © 2000-2008 Vita Nuova Holdings Limited (www.vitanuov a.com)
7 // Portions Copyright © 2004,2006 Bruce Ellis 7 // Portions Copyright © 2004,2006 Bruce Ellis
8 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) 8 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net)
9 // Revisions Copyright © 2000-2008 Lucent Technologies Inc. and others 9 // Revisions Copyright © 2000-2008 Lucent Technologies Inc. and others
10 // Portions Copyright © 2009 The Go Authors. All rights reserved. 10 // Portions Copyright © 2009 The Go Authors. All rights reserved.
(...skipping 27 matching lines...) Expand all
38 Node nod, nod1, nod2, nod3, nod4; 38 Node nod, nod1, nod2, nod3, nod4;
39 int o; 39 int o;
40 int32 v, curs; 40 int32 v, curs;
41 41
42 if(debug['g']) { 42 if(debug['g']) {
43 prtree(nn, "cgen lhs"); 43 prtree(nn, "cgen lhs");
44 prtree(n, "cgen"); 44 prtree(n, "cgen");
45 } 45 }
46 if(n == Z || n->type == T) 46 if(n == Z || n->type == T)
47 return; 47 return;
48 » if(typesu[n->type->etype]) { 48 » if(typesu[n->type->etype] && (n->op != OFUNC || nn != Z)) {
49 sugen(n, nn, n->type->width); 49 sugen(n, nn, n->type->width);
50 return; 50 return;
51 } 51 }
52 l = n->left; 52 l = n->left;
53 r = n->right; 53 r = n->right;
54 o = n->op; 54 o = n->op;
55 if(n->addable >= INDEXED) { 55 if(n->addable >= INDEXED) {
56 if(nn == Z) { 56 if(nn == Z) {
57 switch(o) { 57 switch(o) {
58 default: 58 default:
59 nullwarn(Z, Z); 59 nullwarn(Z, Z);
60 break; 60 break;
61 case OINDEX: 61 case OINDEX:
62 nullwarn(l, r); 62 nullwarn(l, r);
63 break; 63 break;
64 } 64 }
65 return; 65 return;
66 } 66 }
67 gmove(n, nn); 67 gmove(n, nn);
68 return; 68 return;
69 } 69 }
70 curs = cursafe; 70 curs = cursafe;
71 71
72 if(n->complex >= FNX) 72 if(n->complex >= FNX)
73 if(l->complex >= FNX) 73 if(l->complex >= FNX)
74 if(r != Z && r->complex >= FNX) 74 if(r != Z && r->complex >= FNX)
75 switch(o) { 75 switch(o) {
76 default: 76 default:
77 » » regret(&nod, r); 77 » » regret(&nod, r, 0, 0);
78 cgen(r, &nod); 78 cgen(r, &nod);
79 79
80 regsalloc(&nod1, r); 80 regsalloc(&nod1, r);
81 gopcode(OAS, &nod, Z, &nod1); 81 gopcode(OAS, &nod, Z, &nod1);
82 82
83 regfree(&nod); 83 regfree(&nod);
84 nod = *n; 84 nod = *n;
85 nod.right = &nod1; 85 nod.right = &nod1;
86 cgen(&nod, nn); 86 cgen(&nod, nn);
87 return; 87 return;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 break; 317 break;
318 } 318 }
319 lcgen(l, nn); 319 lcgen(l, nn);
320 break; 320 break;
321 321
322 case OFUNC: 322 case OFUNC:
323 if(l->complex >= FNX) { 323 if(l->complex >= FNX) {
324 if(l->op != OIND) 324 if(l->op != OIND)
325 diag(n, "bad function call"); 325 diag(n, "bad function call");
326 326
327 » » » regret(&nod, l->left); 327 » » » regret(&nod, l->left, 0, 0);
328 cgen(l->left, &nod); 328 cgen(l->left, &nod);
329 regsalloc(&nod1, l->left); 329 regsalloc(&nod1, l->left);
330 gopcode(OAS, &nod, Z, &nod1); 330 gopcode(OAS, &nod, Z, &nod1);
331 regfree(&nod); 331 regfree(&nod);
332 332
333 nod = *n; 333 nod = *n;
334 nod.left = &nod2; 334 nod.left = &nod2;
335 nod2 = *l; 335 nod2 = *l;
336 nod2.left = &nod1; 336 nod2.left = &nod1;
337 nod2.complex = 1; 337 nod2.complex = 1;
338 cgen(&nod, nn); 338 cgen(&nod, nn);
339 339
340 return; 340 return;
341 } 341 }
342 if(REGARG >= 0) 342 if(REGARG >= 0)
343 o = reg[REGARG]; 343 o = reg[REGARG];
344 gargs(r, &nod, &nod1); 344 gargs(r, &nod, &nod1);
345 gpcdata(PCDATA_ArgSize, curarg); 345 gpcdata(PCDATA_ArgSize, curarg);
346 if(l->addable < INDEXED) { 346 if(l->addable < INDEXED) {
347 reglcgen(&nod, l, Z); 347 reglcgen(&nod, l, Z);
348 gopcode(OFUNC, Z, Z, &nod); 348 gopcode(OFUNC, Z, Z, &nod);
349 regfree(&nod); 349 regfree(&nod);
350 } else 350 } else
351 gopcode(OFUNC, Z, Z, l); 351 gopcode(OFUNC, Z, Z, l);
352 gpcdata(PCDATA_ArgSize, -1); 352 gpcdata(PCDATA_ArgSize, -1);
353 if(REGARG>=0) 353 if(REGARG>=0)
354 if(o != reg[REGARG]) 354 if(o != reg[REGARG])
355 reg[REGARG]--; 355 reg[REGARG]--;
356 » » if(nn != Z) { 356 » » regret(&nod, n, l->type, 1); // update maxarg if nothing else
357 » » » regret(&nod, n); 357 » » gpcdata(PCDATA_ArgSize, curarg);
358 » » gpcdata(PCDATA_ArgSize, -1);
359 » » if(nn != Z)
358 gopcode(OAS, &nod, Z, nn); 360 gopcode(OAS, &nod, Z, nn);
361 if(nod.op == OREGISTER)
359 regfree(&nod); 362 regfree(&nod);
360 }
361 break; 363 break;
362 364
363 case OIND: 365 case OIND:
364 if(nn == Z) { 366 if(nn == Z) {
365 cgen(l, nn); 367 cgen(l, nn);
366 break; 368 break;
367 } 369 }
368 regialloc(&nod, n, nn); 370 regialloc(&nod, n, nn);
369 r = l; 371 r = l;
370 while(r->op == OADD) 372 while(r->op == OADD)
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 case OGE: 754 case OGE:
753 case OGT: 755 case OGT:
754 case OHI: 756 case OHI:
755 case OHS: 757 case OHS:
756 case OLO: 758 case OLO:
757 case OLS: 759 case OLS:
758 o = n->op; 760 o = n->op;
759 if(true) 761 if(true)
760 o = comrel[relindex(o)]; 762 o = comrel[relindex(o)];
761 if(l->complex >= FNX && r->complex >= FNX) { 763 if(l->complex >= FNX && r->complex >= FNX) {
762 » » » regret(&nod, r); 764 » » » regret(&nod, r, 0, 0);
763 cgen(r, &nod); 765 cgen(r, &nod);
764 regsalloc(&nod1, r); 766 regsalloc(&nod1, r);
765 gopcode(OAS, &nod, Z, &nod1); 767 gopcode(OAS, &nod, Z, &nod1);
766 regfree(&nod); 768 regfree(&nod);
767 nod = *n; 769 nod = *n;
768 nod.right = &nod1; 770 nod.right = &nod1;
769 boolgen(&nod, true, nn); 771 boolgen(&nod, true, nn);
770 break; 772 break;
771 } 773 }
772 if(sconst(r)) { 774 if(sconst(r)) {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 break; 961 break;
960 } 962 }
961 /* BOTCH -- functions can clobber rathole */ 963 /* BOTCH -- functions can clobber rathole */
962 sugen(n->right, nodrat, w); 964 sugen(n->right, nodrat, w);
963 warn(n, "non-interruptable temporary"); 965 warn(n, "non-interruptable temporary");
964 sugen(nodrat, n->left, w); 966 sugen(nodrat, n->left, w);
965 sugen(nodrat, nn, w); 967 sugen(nodrat, nn, w);
966 break; 968 break;
967 969
968 case OFUNC: 970 case OFUNC:
971 if(!hasdotdotdot(n->left->type)) {
972 cgen(n, Z);
973 if(nn != Z) {
974 curarg -= n->type->width;
975 regret(&nod1, n, n->left->type, 1);
976 if(nn->complex >= FNX) {
977 regsalloc(&nod2, n);
978 cgen(&nod1, &nod2);
979 nod1 = nod2;
980 }
981 cgen(&nod1, nn);
982 }
983 break;
984 }
969 if(nn == Z) { 985 if(nn == Z) {
970 sugen(n, nodrat, w); 986 sugen(n, nodrat, w);
971 break; 987 break;
972 } 988 }
973 if(nn->op != OIND) { 989 if(nn->op != OIND) {
974 nn = new1(OADDR, nn, Z); 990 nn = new1(OADDR, nn, Z);
975 nn->type = types[TIND]; 991 nn->type = types[TIND];
976 nn->addable = 0; 992 nn->addable = 0;
977 } else 993 } else
978 nn = nn->left; 994 nn = nn->left;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 gopcode(OAS, &t2, Z, t); 1142 gopcode(OAS, &t2, Z, t);
1127 t->xoffset += SZ_LONG; 1143 t->xoffset += SZ_LONG;
1128 } 1144 }
1129 if(c > 2) { 1145 if(c > 2) {
1130 gopcode(OAS, &t1, Z, t); 1146 gopcode(OAS, &t1, Z, t);
1131 t->xoffset += SZ_LONG; 1147 t->xoffset += SZ_LONG;
1132 } 1148 }
1133 regfree(&t1); 1149 regfree(&t1);
1134 regfree(&t2); 1150 regfree(&t2);
1135 } 1151 }
LEFTRIGHT

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