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

JohnH jan.hoogerbrugge at gmail.com
Sun Mar 3 11:45:35 PST 2013


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. 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.



More information about the cfe-dev mailing list