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

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

Issue 91850043: code review 91850043: cmd/gc: alias more variables during register allocation (Closed)
Left Patch Set: diff -r acf346c00e56 https://code.google.com/p/go Created 10 years, 11 months ago
Right Patch Set: diff -r e4248ed0037c https://code.google.com/p/go Created 10 years, 11 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/gc/bits.c ('k') | src/cmd/gc/go.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 // 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 /* 5 /*
6 * portable half of code generator. 6 * portable half of code generator.
7 * mainly statements and control flow. 7 * mainly statements and control flow.
8 */ 8 */
9 9
10 #include <u.h> 10 #include <u.h>
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 ········ 822 ········
823 base = temp(types[TUINTPTR]); 823 base = temp(types[TUINTPTR]);
824 824
825 if(isnil(n->left)) { 825 if(isnil(n->left)) {
826 tempname(&src, n->left->type); 826 tempname(&src, n->left->type);
827 cgen(n->left, &src); 827 cgen(n->left, &src);
828 } else 828 } else
829 src = *n->left; 829 src = *n->left;
830 if(n->op == OSLICE || n->op == OSLICE3 || n->op == OSLICESTR) 830 if(n->op == OSLICE || n->op == OSLICE3 || n->op == OSLICESTR)
831 src.xoffset += Array_array; 831 src.xoffset += Array_array;
832 src.type = types[TUINTPTR];
833 832
834 if(n->op == OSLICEARR || n->op == OSLICE3ARR) { 833 if(n->op == OSLICEARR || n->op == OSLICE3ARR) {
835 if(!isptr[n->left->type->etype]) 834 if(!isptr[n->left->type->etype])
836 fatal("slicearr is supposed to work on pointer: %+N\n", n); 835 fatal("slicearr is supposed to work on pointer: %+N\n", n);
837 cgen(&src, base); 836 cgen(&src, base);
838 cgen_checknil(base); 837 cgen_checknil(base);
839 if(offs != N) { 838 if(offs != N) {
840 add = nod(OADD, base, offs); 839 add = nod(OADD, base, offs);
841 typecheck(&add, Erv); 840 typecheck(&add, Erv);
842 cgen(add, base); 841 cgen(add, base);
843 } 842 }
844 } else if(offs == N) { 843 } else if(offs == N) {
844 src.type = types[tptr];
845 cgen(&src, base); 845 cgen(&src, base);
846 } else { 846 } else {
847 » » add = nod(OADD, &src, offs); 847 » » src.type = types[tptr];
848 » » add = nod(OADDPTR, &src, offs);
848 typecheck(&add, Erv); 849 typecheck(&add, Erv);
849 cgen(add, base); 850 cgen(add, base);
850 } 851 }
851 ········ 852 ········
852 // committed to the update 853 // committed to the update
853 gvardef(res); 854 gvardef(res);
854 855
855 // dst.array = src.array [ + lo *width ] 856 // dst.array = src.array [ + lo *width ]
856 dst = *res; 857 dst = *res;
857 dst.xoffset += Array_array; 858 dst.xoffset += Array_array;
858 » dst.type = types[TUINTPTR]; 859 » dst.type = types[tptr];
859 ········ 860 ········
860 cgen(base, &dst); 861 cgen(base, &dst);
861 862
862 // dst.len = hi [ - lo ] 863 // dst.len = hi [ - lo ]
863 dst = *res; 864 dst = *res;
864 dst.xoffset += Array_nel; 865 dst.xoffset += Array_nel;
865 dst.type = types[simtype[TUINT]]; 866 dst.type = types[simtype[TUINT]];
866 cgen(len, &dst); 867 cgen(len, &dst);
867 868
868 if(n->op != OSLICESTR) { 869 if(n->op != OSLICESTR) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 Node* 963 Node*
963 temp(Type *t) 964 temp(Type *t)
964 { 965 {
965 Node *n; 966 Node *n;
966 ········ 967 ········
967 n = nod(OXXX, N, N); 968 n = nod(OXXX, N, N);
968 tempname(n, t); 969 tempname(n, t);
969 n->sym->def->used = 1; 970 n->sym->def->used = 1;
970 return n->orig; 971 return n->orig;
971 } 972 }
LEFTRIGHT

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