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

Delta Between Two Patch Sets: src/cmd/gc/fmt.c

Issue 5487077: code review 5487077: gc: inlining, allow empty bodies, fix _ arguments. (Closed)
Left Patch Set: diff -r bba6fb4199df https://go.googlecode.com/hg/ Created 13 years, 3 months ago
Right Patch Set: diff -r b21c01bec273 https://go.googlecode.com/hg/ Created 13 years, 3 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/cmd/gc/inl.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
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 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 "go.h" 7 #include "go.h"
8 #include "opnames.h" 8 #include "opnames.h"
9 9
10 // 10 //
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 break; 673 break;
674 default: 674 default:
675 fmtprint(fp, " %T", getoutargx(t)); 675 fmtprint(fp, " %T", getoutargx(t));
676 break; 676 break;
677 } 677 }
678 return 0; 678 return 0;
679 679
680 case TSTRUCT: 680 case TSTRUCT:
681 if(t->funarg) { 681 if(t->funarg) {
682 fmtstrcpy(fp, "("); 682 fmtstrcpy(fp, "(");
683 » » » if(fmtmode == FTypeId) {» // no argument names on function signature, and no "noescape" tags 683 » » » if(fmtmode == FTypeId || fmtmode == FErr) {» // no ar gument names on function signature, and no "noescape" tags
684 for(t1=t->type; t1!=T; t1=t1->down) 684 for(t1=t->type; t1!=T; t1=t1->down)
685 if(t1->down) 685 if(t1->down)
686 fmtprint(fp, "%hT, ", t1); 686 fmtprint(fp, "%hT, ", t1);
687 else 687 else
688 fmtprint(fp, "%hT", t1); 688 fmtprint(fp, "%hT", t1);
689 } else { 689 } else {
690 for(t1=t->type; t1!=T; t1=t1->down) 690 for(t1=t->type; t1!=T; t1=t1->down)
691 if(t1->down) 691 if(t1->down)
692 fmtprint(fp, "%T, ", t1); 692 fmtprint(fp, "%T, ", t1);
693 else 693 else
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 exprfmt(f, n->right, nprec+1); 1281 exprfmt(f, n->right, nprec+1);
1282 return 0; 1282 return 0;
1283 } 1283 }
1284 1284
1285 return fmtprint(f, "<node %O>", n->op); 1285 return fmtprint(f, "<node %O>", n->op);
1286 } 1286 }
1287 1287
1288 static int 1288 static int
1289 nodefmt(Fmt *f, Node *n) 1289 nodefmt(Fmt *f, Node *n)
1290 { 1290 {
1291 1291 » Type *t;
1292 » if(f->flags&FmtLong && n->type != T) { 1292
1293 » » if(n->type->etype == TNIL) 1293 » t = n->type;
1294 » if(n->orig != N)
1295 » » n = n->orig;
1296
1297 » if(f->flags&FmtLong && t != T) {
1298 » » if(t->etype == TNIL)
1294 return fmtprint(f, "nil"); 1299 return fmtprint(f, "nil");
1295 else 1300 else
1296 » » » return fmtprint(f, "%N (type %T)", n, n->type); 1301 » » » return fmtprint(f, "%N (type %T)", n, t);
1297
1298 } 1302 }
1299 1303
1300 // TODO inlining produces expressions with ninits. we can't print these yet. 1304 // TODO inlining produces expressions with ninits. we can't print these yet.
1301 1305
1302 if(opprec[n->op] < 0) 1306 if(opprec[n->op] < 0)
1303 return stmtfmt(f, n); 1307 return stmtfmt(f, n);
1304 1308
1305 return exprfmt(f, n, 0); 1309 return exprfmt(f, n, 0);
1306 } 1310 }
1307 1311
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1482 n = va_arg(fp->args, Node*); 1486 n = va_arg(fp->args, Node*);
1483 if(n == N) 1487 if(n == N)
1484 return fmtstrcpy(fp, "<N>"); 1488 return fmtstrcpy(fp, "<N>");
1485 sf = fp->flags; 1489 sf = fp->flags;
1486 sm = setfmode(&fp->flags); 1490 sm = setfmode(&fp->flags);
1487 1491
1488 r = -1; 1492 r = -1;
1489 switch(fmtmode) { 1493 switch(fmtmode) {
1490 case FErr: 1494 case FErr:
1491 case FExp: 1495 case FExp:
1492 if(n->orig != N)
1493 n = n->orig;
1494 r = nodefmt(fp, n); 1496 r = nodefmt(fp, n);
1495 break; 1497 break;
1496 case FDbg: 1498 case FDbg:
1497 dumpdepth++; 1499 dumpdepth++;
1498 r = nodedump(fp, n); 1500 r = nodedump(fp, n);
1499 dumpdepth--; 1501 dumpdepth--;
1500 break; 1502 break;
1501 default: 1503 default:
1502 fatal("unhandled %%N mode"); 1504 fatal("unhandled %%N mode");
1503 } 1505 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 dumplist(char *s, NodeList *l) 1569 dumplist(char *s, NodeList *l)
1568 { 1570 {
1569 print("%s\n%+H\n", s, l); 1571 print("%s\n%+H\n", s, l);
1570 } 1572 }
1571 1573
1572 void 1574 void
1573 dump(char *s, Node *n) 1575 dump(char *s, Node *n)
1574 { 1576 {
1575 print("%s [%p]\n%+N\n", s, n, n); 1577 print("%s [%p]\n%+N\n", s, n, n);
1576 } 1578 }
LEFTRIGHT
« no previous file | src/cmd/gc/inl.c » ('j') | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

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