This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] Switch stmts and inserting on edge


On 30 May 2003, Diego Novillo wrote:
> On Fri, 2003-05-30 at 15:06, Chris Lattner wrote:
> > FWIW, this is what LLVM does, and it works quite well.  All fall-throughs
> > are made into explicit gotos (the labels being merged if appropriate), and
> > switch statements become multiway branches.

> Cool.  Do you guys change to decision trees if the case space is too
> scattered?

We don't currently, but I plan to add that at some point.  We do have a
lowering pass that reduces ALL switch statements to branches, but that is
just to make writing code generators easier, *shrug*.

> I think we do this in RTL, but I don't know how we decide as
> there may be target constraints as well.

In LLVM it's straight-forward to write target-independent transformations
that use information about the target.  In this case we could expose
things like how sparse the switch needs to be before we break it up into a
binary tree.  Also you can use profile information to make the hot paths
shorter, and other optimizations...

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]