Re: Help needed: Code generation for CASE/SWITCH statements

johnmce@world.std.com (John McEnerney)
5 Dec 1997 01:04:25 -0500

          From comp.compilers

Related articles
Re: Help needed: Code generation for CASE/SWITCH statements johnmce@world.std.com (1997-12-05)
Re: Help needed: Code generation for CASE/SWITCH statements srw@pspf47.ih.lucent.com (1997-12-05)
Re: Help needed: Code generation for CASE/SWITCH statements dwight@pentasoft.com (1997-12-05)
Re: Help needed: Code generation for CASE/SWITCH statements preston@cs.rice.edu (1997-12-05)
Re: Help needed: Code generation for CASE/SWITCH statements dlmoore@ix.netcom.com (David L Moore) (1997-12-05)
Re: Help needed: Code generation for CASE/SWITCH statements drh@microsoft.com (Dave Hanson) (1997-12-05)
Re: Help needed: Code generation for CASE/SWITCH statements wilson@marker.cs.utah.edu (Wilson C Hsieh) (1997-12-05)
[13 later articles]
| List of all articles for this month |
From: johnmce@world.std.com (John McEnerney)
Newsgroups: comp.compilers,comp.lang.c.moderated
Date: 5 Dec 1997 01:04:25 -0500
Organization: Metrowerks, Inc.
References: <clcm-19971204-0012@plethora.net>
Keywords: C, code

jakob@iar_.se (Jakob) wrote:
> I would like to know if anybody knows of any references (articles,
> books, online sources) where information can be found about how to
> select implementation strategies for switch statements (case for Ada
> and Pascal).


In Fraser & Hanson's "A retargetable C compiler: design and
implementation" they describe one possible analysis of switches. They
analyze the set of case labels and decide whether to use an indexed jump,
a binary-search, or simple comparisons, and they'll even decompose a
sparse range table so that it uses e.g. a binary tree of dense indexed
jump tables.


--
John McEnerney (mcenerney@metrowerks.com)
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.