Sanjiv Gupta wrote:> On Sun, 2010-04-11 at 10:54 +0800, lucefe wrote:
>
>> Hi, Dear LLVMers
>>
>> I just touch llvm source code for several days, and I didn't know
the
>> interfaces of the analysises and transformations of LLVM. For exampe,
>> how to backtrace CFG, and whether exits a backtracking interator to do
>> such work?
>>
>> For a novice, I also seek for suggestions about how to become familiar
>> with LLVM interfaces as soon as possible. Now I have a plan to write a
>> pass based on LLVM, and my first challenge is how to make the best use
>> of LLVM's analysis and transformations. Is it the best method to
scan
>> the source code, especially the ".h" files?
>>
>> Withe Best Regards!
>> novice
>>
>
> See the doc: Writing an LLVM Pass.
>
I agree. This is the first document you should read. I would also
recommend reading the Language Reference Manual
(http://llvm.org/docs/LangRef.html) and the Programmer's Reference
Manual (http://llvm.org/docs/ProgrammersManual.html). I would also
recommend reading the Analysis and Transformation Pass document
(http://llvm.org/docs/Passes.html) to get an idea of what analyses and
transforms have already been written for LLVM.
> Understand the source in lib/Transforms and lib/Analysis
>
Sanjiv, do you mean that he should read some of the code in
lib/Transforms and lib/Analysis as examples of LLVM passes? While I
think examining a few LLVM passes as examples is good, I wouldn't
recommend reading *all* of the source code in lib/Transforms and
lib/Analysis. That is more than necessary.
What I would recommend is to read the doxygen documentation when you
want to know the specific interfaces of a class
(http://llvm.org/doxygen/). Doxygen can help narrow your code reading
down to that code which you really need to read. For example, if you
need dominator information, you can look up the DominatorTree class in
doxygen to see what methods it provides.
-- John T.