[cfe-dev] Adding constant optimizations to Clang AST
jahanian
fjahanian at apple.com
Wed Feb 6 14:33:13 PST 2013
On Feb 6, 2013, at 2:23 PM, David Blaikie <dblaikie at gmail.com> wrote:
> On Wed, Feb 6, 2013 at 2:18 PM, dmanatunga <manatunga at gmail.com> wrote:
>> David Blaikie wrote
>>> Why? LLVM optimizations will already do the right thing with this sort of
>>> code.
>>
>> It is for an assignment that has been given to me. The Professor wants it
>> done it for the Clang AST as opposed to the llvm IR.
>>
>> David Blaikie wrote
>>> Are you trying to transform the user's code for them? (ie: do you
>>> expect to modify the original source files or otherwise give this
>>> source back to the user in some form) Or just produce better binaries?
>>
>> I am not modifying the original source file, or expect to give the source
>> back to the user in some form. Just producing a better binary. I understand
>> Clang tries to retain as much of the original code specification in the AST
>> as possible, but I am basically ignoring that.
>
> In short: the AST is not designed to be mutated so this may not be an
> easy task. I don't really have any particularly useful pointers on how
> you might achieve it.
One place to look at is the objective-C rewriter which walks the AST tree, makes local AST changes and
writes it back out as source. This is good way to visualize things.
- fariborz
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
More information about the cfe-dev
mailing list