1
0
mirror of https://github.com/golang/go synced 2024-10-04 03:21:22 -06:00

gc: avoid re-genning ninit in branches involving float comparison.

R=rsc
CC=golang-dev
https://golang.org/cl/5451050
This commit is contained in:
Luuk van Dijk 2011-12-01 14:46:32 +01:00
parent c4d0ac0e2f
commit 6bee4e556f
3 changed files with 12 additions and 0 deletions

View File

@ -850,6 +850,7 @@ bgen(Node *n, int true, Prog *to)
int et, a; int et, a;
Node *nl, *nr, *r; Node *nl, *nr, *r;
Node n1, n2, n3, n4, tmp; Node n1, n2, n3, n4, tmp;
NodeList *ll;
Prog *p1, *p2; Prog *p1, *p2;
USED(n4); // in unreachable code below USED(n4); // in unreachable code below
@ -950,7 +951,10 @@ bgen(Node *n, int true, Prog *to)
p1 = gbranch(AB, T); p1 = gbranch(AB, T);
p2 = gbranch(AB, T); p2 = gbranch(AB, T);
patch(p1, pc); patch(p1, pc);
ll = n->ninit;
n->ninit = nil;
bgen(n, 1, p2); bgen(n, 1, p2);
n->ninit = ll;
patch(gbranch(AB, T), to); patch(gbranch(AB, T), to);
patch(p2, pc); patch(p2, pc);
goto ret; goto ret;

View File

@ -717,6 +717,7 @@ bgen(Node *n, int true, Prog *to)
int et, a; int et, a;
Node *nl, *nr, *l, *r; Node *nl, *nr, *l, *r;
Node n1, n2, tmp; Node n1, n2, tmp;
NodeList *ll;
Prog *p1, *p2; Prog *p1, *p2;
if(debug['g']) { if(debug['g']) {
@ -834,7 +835,10 @@ bgen(Node *n, int true, Prog *to)
p1 = gbranch(AJMP, T); p1 = gbranch(AJMP, T);
p2 = gbranch(AJMP, T); p2 = gbranch(AJMP, T);
patch(p1, pc); patch(p1, pc);
ll = n->ninit; // avoid re-genning ninit
n->ninit = nil;
bgen(n, 1, p2); bgen(n, 1, p2);
n->ninit = ll;
patch(gbranch(AJMP, T), to); patch(gbranch(AJMP, T), to);
patch(p2, pc); patch(p2, pc);
goto ret; goto ret;

View File

@ -787,6 +787,7 @@ bgen(Node *n, int true, Prog *to)
int et, a; int et, a;
Node *nl, *nr, *r; Node *nl, *nr, *r;
Node n1, n2, tmp, t1, t2, ax; Node n1, n2, tmp, t1, t2, ax;
NodeList *ll;
Prog *p1, *p2; Prog *p1, *p2;
if(debug['g']) { if(debug['g']) {
@ -902,7 +903,10 @@ bgen(Node *n, int true, Prog *to)
p1 = gbranch(AJMP, T); p1 = gbranch(AJMP, T);
p2 = gbranch(AJMP, T); p2 = gbranch(AJMP, T);
patch(p1, pc); patch(p1, pc);
ll = n->ninit; // avoid re-genning ninit
n->ninit = nil;
bgen(n, 1, p2); bgen(n, 1, p2);
n->ninit = ll;
patch(gbranch(AJMP, T), to); patch(gbranch(AJMP, T), to);
patch(p2, pc); patch(p2, pc);
break; break;