This is the mail archive of the gcc-patches@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] Removal of gotos from cfg based ir


> > I do believe that approach of making CFG part of the IL (not making IL
> > uncomplette) is the most consistent sollution and probably easiest to
> > deal with. My next candidate would be the idea of shadow gotos, but I
> > would preffer to avoid it.

> IF you are entering a part of the optimizer where you are going to do
> this kind of manipulation a lot,  why not simply change all FALLTHRU
> edges in the program to be explicit GOTOs until such time that you no
> longer need it?  Is this what LLVM does? Its seems like the most natural
> way of dealing with the problem if its that sticky of an issue. then
> presumably cfg_cleanup will get rid of them all when you are done, if
> the blocks are indeed still consecutive.

In LLVM, all control flow (for both normal and exceptional control) is
represented explicitly in the program.  For example, "fall-through" edges
are explicit gotos, which are eliminated during code generation.  This
means that a code layout pass only needs to reorder blocks, it does not
need to modify the CFG or instructions _at all_.

An easy way to see what LLVM does to various programs is to try out the
online web form:
http://llvm.cs.uiuc.edu/demo/

Which will print out the LLVM code for any C or C++ translation unit you
give it.

-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]