[cfe-dev] Inserting a high level transformation pass that uses TreeTransform

David Blaikie dblaikie at gmail.com
Sun Mar 3 12:36:33 PST 2013


On Sun, Mar 3, 2013 at 11:45 AM, JohnH <jan.hoogerbrugge at gmail.com> wrote:
> Hi Sean,
>
> I would like to transform loops like this:
>
>   for(...)
>     S;
>
> to:
>
>   enter_loop(&loop_info_123);
>   for(...)
>   {
>     iteration_loop(&loop_info_123);
>     S;
>   }
>   leave_loop(&loop_info_123);
>
> and certain data accesses like
>
>   a[i]++;
>
> to
>
>   a[(index_expression(i, &index_info_123), i)]++;
>
> The loop_info_XXX/index_info_XXX structs contain line and column information
> of the loop
> and index. I understood that column information is not available at IR level
> and therefore I would like
> to do this transformation at AST level.

These aren't the only two options - the 3rd option would be to modify
Clang IRGen to generate the extra function calls at the relevant
places. (no guarantees about being able to upstream such changes, of
course)

> I am looking for a place in the
> compiler where the AST tree
> is built where I can run TreeTransform passes and I hope that I can express
> my transformations.
> Doing this in a clang plugin would be nice but is not necessary.
>
> Any help is highly appreciated.
>
> Regards,
> John.
>
>
>
> --
> View this message in context: http://clang-developers.42468.n3.nabble.com/Inserting-a-high-level-transformation-pass-that-uses-TreeTransform-tp4030773p4030790.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> 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