diff options
author | Stefan Kempf <stefan@cvs.openbsd.org> | 2007-11-22 15:06:44 +0000 |
---|---|---|
committer | Stefan Kempf <stefan@cvs.openbsd.org> | 2007-11-22 15:06:44 +0000 |
commit | 7abafbe7948887da7ef709612930fdb77ee8eed9 (patch) | |
tree | fbfa7c7793f3e2004f9d3ce25351e32415818d6f /usr.bin/pcc/mips | |
parent | 9f7362ac1c12b1c54bcafe0722250b9effa94b3e (diff) |
Pull from master repo:
Put the genswitch() code that is found in most backends into
the MI part. The backend version is renamed to mygenswitch()
and can provide improved translations for switch statements.
Improved implementation of the switch constraints/semantics
described in the standard.
ok ragge@, otto@
With help and comments from ragge and gmcgarry
Diffstat (limited to 'usr.bin/pcc/mips')
-rw-r--r-- | usr.bin/pcc/mips/code.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/usr.bin/pcc/mips/code.c b/usr.bin/pcc/mips/code.c index bbeecd96146..99847602da6 100644 --- a/usr.bin/pcc/mips/code.c +++ b/usr.bin/pcc/mips/code.c @@ -1,4 +1,4 @@ -/* $OpenBSD: code.c,v 1.2 2007/11/16 08:34:55 otto Exp $ */ +/* $OpenBSD: code.c,v 1.3 2007/11/22 15:06:43 stefan Exp $ */ /* * Copyright (c) 2003 Anders Magnusson (ragge@ludd.luth.se). * All rights reserved. @@ -216,28 +216,13 @@ fldty(struct symtab *p) { } -/* p points to an array of structures, each consisting - * of a constant value and a label. - * The first is >=0 if there is a default label; - * its value is the label number - * The entries p[1] to p[n] are the nontrivial cases +/* * XXX - fix genswitch. */ -void -genswitch(int num, struct swents **p, int n) +int +mygenswitch(int num, TWORD type, struct swents **p, int n) { - NODE *r; - int i; - - /* simple switch code */ - for (i = 1; i <= n; ++i) { - /* already in 1 */ - r = tempnode(num, INT, 0, MKSUE(INT)); - r = buildtree(NE, r, bcon(p[i]->sval)); - cbranch(buildtree(NOT, r, NIL), bcon(p[i]->slab)); - } - if (p[0]->slab > 0) - branch(p[0]->slab); + return 0; } static void |