diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-04-28 10:35:15 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-04-28 10:35:15 +0200 |
commit | c1ba1a0fec4aed430709030f98a3bdb90bfeea16 (patch) | |
tree | 3df18657e50a0313ed6defcda30e4474cb28a467 /src/cmd/5g/cgen.c | |
parent | 7b15ed9ef455b6b66c6b376898a88aef5d6a9970 (diff) | |
download | golang-c1ba1a0fec4aed430709030f98a3bdb90bfeea16.tar.gz |
Imported Upstream version 2011.04.27upstream/2011.04.27
Diffstat (limited to 'src/cmd/5g/cgen.c')
-rw-r--r-- | src/cmd/5g/cgen.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/cmd/5g/cgen.c b/src/cmd/5g/cgen.c index 032409bae..4e5f7ebcd 100644 --- a/src/cmd/5g/cgen.c +++ b/src/cmd/5g/cgen.c @@ -43,6 +43,8 @@ cgen(Node *n, Node *res) } if(isfat(n->type)) { + if(n->type->width < 0) + fatal("forgot to compute width for %T", n->type); sgen(n, res, n->type->width); goto ret; } @@ -960,7 +962,7 @@ bgen(Node *n, int true, Prog *to) } // make simplest on right - if(nl->op == OLITERAL || nl->ullman < nr->ullman) { + if(nl->op == OLITERAL || (nl->ullman < UINF && nl->ullman < nr->ullman)) { a = brrev(a); r = nl; nl = nr; @@ -1071,18 +1073,18 @@ bgen(Node *n, int true, Prog *to) a = optoas(a, nr->type); if(nr->ullman >= UINF) { - regalloc(&n1, nr->type, N); - cgen(nr, &n1); + regalloc(&n1, nl->type, N); + cgen(nl, &n1); - tempname(&tmp, nr->type); + tempname(&tmp, nl->type); gmove(&n1, &tmp); regfree(&n1); - regalloc(&n1, nl->type, N); - cgen(nl, &n1); - regalloc(&n2, nr->type, N); - cgen(&tmp, &n2); + cgen(nr, &n2); + + regalloc(&n1, nl->type, N); + cgen(&tmp, &n1); gcmp(optoas(OCMP, nr->type), &n1, &n2); patch(gbranch(a, nr->type), to); |