[cfe-dev] Clang AST
clattner at apple.com
Tue Apr 29 10:12:20 CDT 2008
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
> 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.
More information about the cfe-dev