Dear all,
I am doing some analysis of source code using GCC Plugin 4.5. I am
registering my GIMPLE pass before "SSA" pass. To process each statement
in each basic block, I am using statement iterator and FOR_EACH_BB
macro. I am facing following problems:
1) At this pass, I am not able to recognize label and goto (except when
programmer put them) statements using gimple_code(stmt). Therefore, it
is hard to check which block is under which condition. Also, when I am
trying to get (true and false condition) label from condition statement
it is showing null. For example: tree truelabel =
gimple_cond_true_label(stmt); Here, truelabel is null.
2) In each BB I am trying to get loop info using loop_optimizer_init().
It gives the loop num value but it is NOT estimating number of
iterations. I tried to using SCEV (the header file for the same is not
available for Plugin, therefore I pasted it in plugin include folder),
but still no success. For your perusal following is my code.
scev_initialize();
loop_optimizer_init(LOOPS_MAY_HAVE_MULTIPLE_LATCHES);
FOR_EACH_BB(bb) // Traverse each basic block
{
scev_initialize();
loop=bb->loop_father;
cout<<"BLOCK NO "<<bb->index<<"LOOP
"<<loop->num<<"STATE"<<loop->estimate_state<<endl;
gimple_stmt_iterator gsi;
gsi = gsi_start_bb(bb);
//iterate over all statements within basic block
for (gsi; !gsi_end_p(gsi); gsi_next(&gsi)) {
processGimpleStatement(gsi_stmt(gsi), &gsi);
}
}
scev_finalize();
loop_optimizer_finalize() ;
Can anyone help me in this regard?
Thanks,
Anupam