[cfe-dev] Clang AST

caiwei cworce at 126.com
Tue Apr 29 20:43:23 PDT 2008


 
 
 
 

在2008-04-29,"Chris Lattner" <clattner at apple.com> 写道:

On Apr 28, 2008, at 10:39 PM, caiwei wrote:
> Hi all,
> I am new to the list and have been lurking a few days. I am interested
> in clang mainly as a possible tool for optimization.If there are any  
> suggestions
> for small tasks (TODOs) that may give me  a good introduction to
> developing for clang, that would be nice.how can I modify the AST  
> for my project?
>
> for example,After changing the AST code of Clang, the clang compiler  
> optimize  x *2 to x << 2.
> and how to use of the clang AST interface ?

>What sort of optimization are you trying to do?  Are you working with  
>native code generation, or trying to do a source to source optimizer?

>If you are focused on native code generation, it is much better to  
>implement optimizations in the llvm optimizer and/or backend.  If you  
>are interested in source to source transformations (e.g. outputting a  
>modified C file), you can use the AST interfaces and rewriter to do  
>this.  Take a look at the ObjC Rewriter for examples.  If you have a  
>specific question, I'd be happy to try to help.

>-Chris
Thanks Chris,
I need to do AST transformations about inerting nodes and setting existing ones,thus getting optimum code(source to modified source code).
cai
?
?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080430/1beffed2/attachment.html>


More information about the cfe-dev mailing list