diff options
author | Anthony Martin <ality@pbrane.org> | 2011-12-14 17:30:40 -0500 |
---|---|---|
committer | Anthony Martin <ality@pbrane.org> | 2011-12-14 17:30:40 -0500 |
commit | 82fb6ef6521fb19a8b55eef80fb2e71835910e3a (patch) | |
tree | 8a6c4a67114a7fff3831ba9fb189e6d0304c63df /src/cmd/6c | |
parent | c5c76a8a78d9edde8708ac530b5e4cc0e61d0954 (diff) | |
download | go-82fb6ef6521fb19a8b55eef80fb2e71835910e3a.tar.gz |
5c, 6c, 8c: support 64-bit switch value
For real this time. :-)
R=rsc, ken
CC=golang-dev
http://codereview.appspot.com/5486061
Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/cmd/6c')
-rw-r--r-- | src/cmd/6c/gc.h | 1 | ||||
-rw-r--r-- | src/cmd/6c/swt.c | 19 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/cmd/6c/gc.h b/src/cmd/6c/gc.h index ed2338731..b0081abb5 100644 --- a/src/cmd/6c/gc.h +++ b/src/cmd/6c/gc.h @@ -299,6 +299,7 @@ void gpseudo(int, Sym*, Node*); int swcmp(const void*, const void*); void doswit(Node*); void swit1(C1*, int, int32, Node*); +void swit2(C1*, int, int32, Node*); void newcase(void); void bitload(Node*, Node*, Node*, Node*, Node*); void bitstore(Node*, Node*, Node*, Node*, Node*); diff --git a/src/cmd/6c/swt.c b/src/cmd/6c/swt.c index 3de86306d..f16d0f78a 100644 --- a/src/cmd/6c/swt.c +++ b/src/cmd/6c/swt.c @@ -33,6 +33,21 @@ void swit1(C1 *q, int nc, int32 def, Node *n) { + Node nreg; + + regalloc(&nreg, n, Z); + if(typev[n->type->etype]) + nreg.type = types[TVLONG]; + else + nreg.type = types[TLONG]; + cgen(n, &nreg); + swit2(q, nc, def, &nreg); + regfree(&nreg); +} + +void +swit2(C1 *q, int nc, int32 def, Node *n) +{ C1 *r; int i; Prog *sp; @@ -58,12 +73,12 @@ swit1(C1 *q, int nc, int32 def, Node *n) gbranch(OGOTO); p->as = AJEQ; patch(p, r->label); - swit1(q, i, def, n); + swit2(q, i, def, n); if(debug['W']) print("case < %.8llux\n", r->val); patch(sp, pc); - swit1(r+1, nc-i-1, def, n); + swit2(r+1, nc-i-1, def, n); } void |