[cfe-dev] source-to-source transformation: how-to?

Ute Wappler wappler at se.inf.tu-dresden.de
Tue Feb 19 08:54:51 PST 2008


Hello Ted and Taras,

> A potentially better approach for your needs is to use the rewriter
> module, although I imagine it really depends on the kinds of
> transformations you want to do.  

Many thanks for that hint. I am still quite disappointed that I overlooked the 
rewriter.

I think that the rewriter is sufficient. I will not change the general 
structure of the program. I will just replace instructions such as additions 
and so on with code which implements those instruction in a more safe way. 

At some points such as loops or if statements I am required to add a bit more 
code which even will contain a bit of additional control flow. Furthermore, I 
will move the computation of the conditions so that for example if(a<b){...} 
will become int c = a < b; if ( c ){...}. It seems to me that the rewriter 
supports that too.

> There is an arguable more mature alternative to clang for this. Elsa
> supports the kind of workflow that you prose here. People have done
> similar transforms using elsa.

I had a look at elsa but I must admit, I was faster in getting results with 
clang and the rewriter. I will have a look at clang and elsa to decide which 
is better suited for my needs. In principle everything could be done with the 
rewriter. But maybe elsa is more comfortable.

Many thanks again,
Ute





More information about the cfe-dev mailing list