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.
在2008-04-29，“Chris Lattner” firstname.lastname@example.org 写道：