LEFT | RIGHT |
(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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 a = optoas(n->op, nl->type); | 239 a = optoas(n->op, nl->type); |
240 goto uop; | 240 goto uop; |
241 | 241 |
242 // symmetric binary | 242 // symmetric binary |
243 case OAND: | 243 case OAND: |
244 case OOR: | 244 case OOR: |
245 case OXOR: | 245 case OXOR: |
246 case OADD: | 246 case OADD: |
247 case OMUL: | 247 case OMUL: |
248 a = optoas(n->op, nl->type); | 248 a = optoas(n->op, nl->type); |
249 » » if(a != AIMULB) | 249 » » if(a == AIMULB) { |
250 » » » goto sbop; | 250 » » » cgen_bmul(n->op, nl, nr, res); |
251 » » cgen_bmul(n->op, nl, nr, res); | 251 » » » break; |
252 » » break; | 252 » » } |
| 253 » » goto sbop; |
253 | 254 |
254 // asymmetric binary | 255 // asymmetric binary |
255 case OSUB: | 256 case OSUB: |
256 a = optoas(n->op, nl->type); | 257 a = optoas(n->op, nl->type); |
257 goto abop; | 258 goto abop; |
258 | 259 |
259 case OCONV: | 260 case OCONV: |
260 if(n->type->width > nl->type->width) { | 261 if(n->type->width > nl->type->width) { |
261 // If loading from memory, do conversion during load, | 262 // If loading from memory, do conversion during load, |
262 // so as to avoid use of 8-bit register in, say, int(*by
teptr). | 263 // so as to avoid use of 8-bit register in, say, int(*by
teptr). |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 n1.xoffset = 0; | 834 n1.xoffset = 0; |
834 gins(ATESTB, nodintconst(0), &n1); | 835 gins(ATESTB, nodintconst(0), &n1); |
835 } | 836 } |
836 } | 837 } |
837 a->op = OINDREG; | 838 a->op = OINDREG; |
838 a->xoffset += n->xoffset; | 839 a->xoffset += n->xoffset; |
839 a->type = n->type; | 840 a->type = n->type; |
840 return; | 841 return; |
841 | 842 |
842 case OCALLFUNC: | 843 case OCALLFUNC: |
| 844 case OCALLMETH: |
| 845 case OCALLINTER: |
| 846 switch(n->op) { |
| 847 case OCALLFUNC: |
| 848 cgen_call(n, 0); |
| 849 break; |
| 850 case OCALLMETH: |
| 851 cgen_callmeth(n, 0); |
| 852 break; |
| 853 case OCALLINTER: |
| 854 cgen_callinter(n, N, 0); |
| 855 break; |
| 856 } |
843 fp = structfirst(&flist, getoutarg(n->left->type)); | 857 fp = structfirst(&flist, getoutarg(n->left->type)); |
844 cgen_call(n, 0); | |
845 memset(a, 0, sizeof *a); | 858 memset(a, 0, sizeof *a); |
846 a->op = OINDREG; | 859 a->op = OINDREG; |
847 a->val.u.reg = D_SP; | 860 a->val.u.reg = D_SP; |
848 a->addable = 1; | 861 a->addable = 1; |
849 a->xoffset = fp->width; | 862 a->xoffset = fp->width; |
850 a->type = n->type; | 863 a->type = n->type; |
851 return; | 864 return; |
852 ········ | 865 ········ |
853 case OINDEX: | 866 case OINDEX: |
854 // Index of fixed-size array by constant can | 867 // Index of fixed-size array by constant can |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 regfree(&nodl); | 1471 regfree(&nodl); |
1459 return 0; | 1472 return 0; |
1460 | 1473 |
1461 yes: | 1474 yes: |
1462 if(freer) | 1475 if(freer) |
1463 regfree(&nodr); | 1476 regfree(&nodr); |
1464 if(freel) | 1477 if(freel) |
1465 regfree(&nodl); | 1478 regfree(&nodl); |
1466 return 1; | 1479 return 1; |
1467 } | 1480 } |
LEFT | RIGHT |