LEFT | RIGHT |
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 static void subnode(Node *nr, Node *ni, Node *nc); | 9 static void subnode(Node *nr, Node *ni, Node *nc); |
10 static void minus(Node *nl, Node *res); | 10 static void minus(Node *nl, Node *res); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 complexadd(n->op, nl, nr, res); | 264 complexadd(n->op, nl, nr, res); |
265 break; | 265 break; |
266 | 266 |
267 case OMUL: | 267 case OMUL: |
268 complexmul(nl, nr, res); | 268 complexmul(nl, nr, res); |
269 break; | 269 break; |
270 } | 270 } |
271 } | 271 } |
272 | 272 |
273 void | 273 void |
274 complexbool(int op, Node *nl, Node *nr, int true, Prog *to) | 274 complexbool(int op, Node *nl, Node *nr, int true, int likely, Prog *to) |
275 { | 275 { |
276 Node tnl, tnr; | 276 Node tnl, tnr; |
277 Node n1, n2, n3, n4; | 277 Node n1, n2, n3, n4; |
278 Node na, nb, nc; | 278 Node na, nb, nc; |
279 | 279 |
280 // make both sides addable in ullman order | 280 // make both sides addable in ullman order |
281 if(nr != N) { | 281 if(nr != N) { |
282 if(nl->ullman > nr->ullman && !nl->addable) { | 282 if(nl->ullman > nr->ullman && !nl->addable) { |
283 tempname(&tnl, nl->type); | 283 tempname(&tnl, nl->type); |
284 cgen(nl, &tnl); | 284 cgen(nl, &tnl); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 | 316 |
317 memset(&nc, 0, sizeof(na)); | 317 memset(&nc, 0, sizeof(na)); |
318 nc.op = OEQ; | 318 nc.op = OEQ; |
319 nc.left = &n2; | 319 nc.left = &n2; |
320 nc.right = &n4; | 320 nc.right = &n4; |
321 nc.type = types[TBOOL]; | 321 nc.type = types[TBOOL]; |
322 | 322 |
323 if(op == ONE) | 323 if(op == ONE) |
324 true = !true; | 324 true = !true; |
325 | 325 |
326 » bgen(&na, true, to, 0); | 326 » bgen(&na, true, likely, to); |
327 } | 327 } |
328 | 328 |
329 void | 329 void |
330 nodfconst(Node *n, Type *t, Mpflt* fval) | 330 nodfconst(Node *n, Type *t, Mpflt* fval) |
331 { | 331 { |
332 memset(n, 0, sizeof(*n)); | 332 memset(n, 0, sizeof(*n)); |
333 n->op = OLITERAL; | 333 n->op = OLITERAL; |
334 n->addable = 1; | 334 n->addable = 1; |
335 ullmancalc(n); | 335 ullmancalc(n); |
336 n->val.u.fval = fval; | 336 n->val.u.fval = fval; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 memset(&ra, 0, sizeof(ra)); | 477 memset(&ra, 0, sizeof(ra)); |
478 ra.op = OADD; | 478 ra.op = OADD; |
479 ra.left = &rm1; | 479 ra.left = &rm1; |
480 ra.right = &rm2; | 480 ra.right = &rm2; |
481 ra.type = rm1.type; | 481 ra.type = rm1.type; |
482 cgen(&ra, &n6); | 482 cgen(&ra, &n6); |
483 | 483 |
484 // tmp ->real part | 484 // tmp ->real part |
485 cgen(&tmp, &n5); | 485 cgen(&tmp, &n5); |
486 } | 486 } |
LEFT | RIGHT |