From 7abafbe7948887da7ef709612930fdb77ee8eed9 Mon Sep 17 00:00:00 2001 From: Stefan Kempf Date: Thu, 22 Nov 2007 15:06:44 +0000 Subject: 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 --- usr.bin/pcc/mips/code.c | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) (limited to 'usr.bin/pcc/mips') 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 -- cgit v1.2.3