This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

a question about code instrumentation in RTL level


The GCC internals explicitly introduced code manipulation APIs in TREE representation (bsi_insert_before, bsi_remove etc). But I did not see the equivalent for RTL representation.

Say, I want to enable a counter for a n-depth-nested loop. For example, I want to add a counter instruction to count 2-depth-nested loop, then I need to transform the following code as shown.
------------before transformation-------------------------
for (i=0; i< 5; i++ ){
for(j=0; j< 5; j++{
sum = sum+j;
}
}
-----------after transformation-------------------------
for (i=0; i< 5; i++ ){
for(j=0; j< 5; j++{
sum = sum+j;
}
}
counter++;


I found the following struct seemlessly provides information for above purpose.
struct loop{
...
int depth;
rtx end;
}


i.e., it seems that I can simply do something like the following as long as there is an API to manipulate RTL representation.

if (this_loop.depth ==2){
 insert_after(this_loop.end);
}

Would you please kindly give me some hint to find out such APIs(I am sure there is somewhere)? Thanks a lot.

_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to get there! http://lifeevents.msn.com/category.aspx?cid=Retirement



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]