OLD | NEW |
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 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 cgen(nr, &n2); | 1084 cgen(nr, &n2); |
1085 nr = &n2; | 1085 nr = &n2; |
1086 } | 1086 } |
1087 cmp64(nl, nr, a, likely, to); | 1087 cmp64(nl, nr, a, likely, to); |
1088 break; | 1088 break; |
1089 } | 1089 } |
1090 | 1090 |
1091 a = optoas(a, nr->type); | 1091 a = optoas(a, nr->type); |
1092 | 1092 |
1093 if(nr->ullman >= UINF) { | 1093 if(nr->ullman >= UINF) { |
1094 » » » tempname(&n1, nl->type); | 1094 » » » if(!nl->addable) { |
1095 » » » tempname(&tmp, nr->type); | 1095 » » » » tempname(&n1, nl->type); |
1096 » » » cgen(nl, &n1); | 1096 » » » » cgen(nl, &n1); |
1097 » » » cgen(nr, &tmp); | 1097 » » » » nl = &n1; |
| 1098 » » » } |
| 1099 » » » if(!nr->addable) { |
| 1100 » » » » tempname(&tmp, nr->type); |
| 1101 » » » » cgen(nr, &tmp); |
| 1102 » » » » nr = &tmp; |
| 1103 » » » } |
1098 regalloc(&n2, nr->type, N); | 1104 regalloc(&n2, nr->type, N); |
1099 » » » cgen(&tmp, &n2); | 1105 » » » cgen(nr, &n2); |
1100 goto cmp; | 1106 goto cmp; |
1101 } | 1107 } |
1102 | 1108 |
1103 » » tempname(&n1, nl->type); | 1109 » » if(!nl->addable) { |
1104 » » cgen(nl, &n1); | 1110 » » » tempname(&n1, nl->type); |
| 1111 » » » cgen(nl, &n1); |
| 1112 » » » nl = &n1; |
| 1113 » » } |
1105 | 1114 |
1106 if(smallintconst(nr)) { | 1115 if(smallintconst(nr)) { |
1107 » » » gins(optoas(OCMP, nr->type), &n1, nr); | 1116 » » » gins(optoas(OCMP, nr->type), nl, nr); |
1108 patch(gbranch(a, nr->type, likely), to); | 1117 patch(gbranch(a, nr->type, likely), to); |
1109 break; | 1118 break; |
1110 } | 1119 } |
1111 | 1120 |
1112 » » tempname(&tmp, nr->type); | 1121 » » if(!nr->addable) { |
1113 » » cgen(nr, &tmp); | 1122 » » » tempname(&tmp, nr->type); |
| 1123 » » » cgen(nr, &tmp); |
| 1124 » » » nr = &tmp; |
| 1125 » » } |
1114 regalloc(&n2, nr->type, N); | 1126 regalloc(&n2, nr->type, N); |
1115 » » gmove(&tmp, &n2); | 1127 » » gmove(nr, &n2); |
1116 | 1128 |
1117 cmp: | 1129 cmp: |
1118 » » gins(optoas(OCMP, nr->type), &n1, &n2); | 1130 » » gins(optoas(OCMP, nr->type), nl, &n2); |
1119 patch(gbranch(a, nr->type, likely), to); | 1131 patch(gbranch(a, nr->type, likely), to); |
1120 regfree(&n2); | 1132 regfree(&n2); |
1121 break; | 1133 break; |
1122 } | 1134 } |
1123 } | 1135 } |
1124 | 1136 |
1125 /* | 1137 /* |
1126 * n is on stack, either local variable | 1138 * n is on stack, either local variable |
1127 * or return value from function call. | 1139 * or return value from function call. |
1128 * return n's offset from SP. | 1140 * return n's offset from SP. |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1439 regfree(&nodl); | 1451 regfree(&nodl); |
1440 return 0; | 1452 return 0; |
1441 | 1453 |
1442 yes: | 1454 yes: |
1443 if(freer) | 1455 if(freer) |
1444 regfree(&nodr); | 1456 regfree(&nodr); |
1445 if(freel) | 1457 if(freel) |
1446 regfree(&nodl); | 1458 regfree(&nodl); |
1447 return 1; | 1459 return 1; |
1448 } | 1460 } |
OLD | NEW |