[LLVMdev] llvm control flow analysis?
Chris Lattner
sabre at nondot.org
Tue May 3 15:12:28 PDT 2005
On Tue, 3 May 2005, John Cortes wrote:
> I'm asking for a stepping stone to figure out how to get some control flow
> analysis on llvm IR. I need to find out specificially sections of if/else,
> for loops, and while loop locations in the original source code. I can look
> at the Cbackend and look there, but would there be any analysis code already
> written in your library that takes care of that.
We don't currently have anything like that. The technique is generally
known as "structural analysis" (books like Muchnik's talk about it). The
C backend currently emits unstructured control flow (gotos), but it would
be very useful to enhance it to use structured control flow.
The one piece of the puzzle that we do have is natural loop identification
(see include/llvm/Analysis/LoopInfo.h), which the C backend does use to
provide some primitve structure for compilers that require source-level
loops like GCC 3.x and before.
-Chris
--
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/
More information about the llvm-dev
mailing list